From 8ad06b6ea3f03f0403342a49386eeb3077039141 Mon Sep 17 00:00:00 2001 From: aman-095 Date: Mon, 5 Aug 2024 12:58:46 +0530 Subject: [PATCH 01/26] feat: add BLAS Level 3 routine for sgemm --- .../@stdlib/blas/base/sgemm/README.md | 0 .../blas/base/sgemm/benchmark/benchmark.js | 0 .../@stdlib/blas/base/sgemm/docs/repl.txt | 0 .../blas/base/sgemm/docs/types/index.d.ts | 0 .../blas/base/sgemm/docs/types/test.ts | 0 .../@stdlib/blas/base/sgemm/examples/index.js | 57 +++++ .../@stdlib/blas/base/sgemm/lib/base.js | 206 ++++++++++++++++++ .../@stdlib/blas/base/sgemm/lib/index.js | 72 ++++++ .../@stdlib/blas/base/sgemm/lib/main.js | 35 +++ .../@stdlib/blas/base/sgemm/lib/ndarray.js | 128 +++++++++++ .../@stdlib/blas/base/sgemm/lib/sgemm.js | 151 +++++++++++++ .../@stdlib/blas/base/sgemm/package.json | 68 ++++++ .../@stdlib/blas/base/sgemm/test/test.js | 0 .../blas/base/sgemm/test/test.ndarray.js | 0 .../blas/base/sgemm/test/test.sgemm.js | 0 15 files changed, 717 insertions(+) create mode 100644 lib/node_modules/@stdlib/blas/base/sgemm/README.md create mode 100644 lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark.js create mode 100644 lib/node_modules/@stdlib/blas/base/sgemm/docs/repl.txt create mode 100644 lib/node_modules/@stdlib/blas/base/sgemm/docs/types/index.d.ts create mode 100644 lib/node_modules/@stdlib/blas/base/sgemm/docs/types/test.ts create mode 100644 lib/node_modules/@stdlib/blas/base/sgemm/examples/index.js create mode 100644 lib/node_modules/@stdlib/blas/base/sgemm/lib/base.js create mode 100644 lib/node_modules/@stdlib/blas/base/sgemm/lib/index.js create mode 100644 lib/node_modules/@stdlib/blas/base/sgemm/lib/main.js create mode 100644 lib/node_modules/@stdlib/blas/base/sgemm/lib/ndarray.js create mode 100644 lib/node_modules/@stdlib/blas/base/sgemm/lib/sgemm.js create mode 100644 lib/node_modules/@stdlib/blas/base/sgemm/package.json create mode 100644 lib/node_modules/@stdlib/blas/base/sgemm/test/test.js create mode 100644 lib/node_modules/@stdlib/blas/base/sgemm/test/test.ndarray.js create mode 100644 lib/node_modules/@stdlib/blas/base/sgemm/test/test.sgemm.js diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/README.md b/lib/node_modules/@stdlib/blas/base/sgemm/README.md new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark.js new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/docs/repl.txt b/lib/node_modules/@stdlib/blas/base/sgemm/docs/repl.txt new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/docs/types/index.d.ts b/lib/node_modules/@stdlib/blas/base/sgemm/docs/types/index.d.ts new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/docs/types/test.ts b/lib/node_modules/@stdlib/blas/base/sgemm/docs/types/test.ts new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/examples/index.js b/lib/node_modules/@stdlib/blas/base/sgemm/examples/index.js new file mode 100644 index 000000000000..067bc52c1348 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/sgemm/examples/index.js @@ -0,0 +1,57 @@ +/** +* @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'; + +var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); +var sgemm = require( './../lib' ); + +// var opts = { +// 'dtype': 'float32' +// }; + +// var M = 3; +// var N = 3; + +// 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', 'none', M, N, 1.0, A, N, x, -1, 2, 1.0, y, -1, 2 ); +// console.log( y ); +// int order = 102; +// int transA = 112; +// int transB = 112; +// int M = 1; +// int N = 2; +// int K = 4; +// float alpha = 0.1f; +// float beta = 1.0f; +// float A[] = { -0.753f, -0.074f, -0.247f, -0.19f }; +// int lda = 4; +// float B[] = { 0.061f, 0.743f, 0.22f, -0.682f, 0.733f, 0.417f, 0.772f, 0.665f }; +// int ldb = 2; +// float C[] = { -0.253f, 0.972f }; +// int ldc = 1; +// float C_expected[] = { -0.291994f, 0.898164f }; +var Float32Array = require('@stdlib/array/float32'); +var A = new Float32Array([1, 4, 2, 5, 3, 6 ]); +var B = new Float32Array([ 1, 5, 2, 6, 3, 7, 4, 8 ]); +var C = new Float32Array([0,0,0,0,0,0,0,0,0,0,0,0]); +sgemm( 'row-major', 'none', 'transpose', 3, 4, 2, 1.0, A, 2, B, 2, 1.0, C, 4 ); +console.log( C ); diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/lib/base.js b/lib/node_modules/@stdlib/blas/base/sgemm/lib/base.js new file mode 100644 index 000000000000..3a2b21cb7ab8 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/sgemm/lib/base.js @@ -0,0 +1,206 @@ +/** +* @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 isRowMajor = require( '@stdlib/ndarray/base/assert/is-row-major' ); +var f32 = require( '@stdlib/number/float64/base/to-float32' ); + + +// MAIN // + +/** +* Performs one of the matrix-matrix operation `C = α*op(A)*op(B) + β*C` where `op(A)` is one of the `op(A) = A`, or `op(A) = A^T`, `α` and `β` are scalars, `A`, `B`, and `C` are matrices, with op(A) an `M` by `K` matrix, op(B) a `K` by `N` matrix and C an `M` by `N` matrix. +* +* @private +* @param {string} transA - specifies whether `A` should be transposed, conjugate-transposed, or not transposed +* @param {string} transB - specifies whether `B` should be transposed, conjugate-transposed, or not transposed +* @param {NonNegativeInteger} M - specifies the rows of the matrix `op(A)` and of the matrix `C` +* @param {NonNegativeInteger} N - specifies the columns of the matrix `op(B)` and of the matrix `C` +* @param {NonNegativeInteger} K - specifies the column of the matrix `op(A)` and row of the matrix `op(B)` +* @param {number} alpha - scalar constant +* @param {Float32Array} A - first matrix +* @param {integer} strideA1 - stride of the first dimension of `A` +* @param {integer} strideA2 - stride of the second dimension of `A` +* @param {NonNegativeInteger} offsetA - starting index for `A` +* @param {Float32Array} B - second matrix +* @param {integer} strideB1 - stride of the first dimension of `B` +* @param {integer} strideB2 - stride of the second dimension of `B` +* @param {NonNegativeInteger} offsetB - starting index for `B` +* @param {number} beta - scalar constant +* @param {Float32Array} C - third matrix +* @param {integer} strideC1 - stride of the first dimension of `C` +* @param {integer} strideC2 - stride of the second dimension of `C` +* @param {NonNegativeInteger} offsetC - starting index for `C` +* @returns {Float32Array} `C` +* +* @example +* var Float32Array = require( '@stdlib/array/float32' ); +* +* var A = new Float32Array( [ 1.0, 2.0, 3.0, 4.0 ] ); +* var B = new Float32Array( [ 1.0, 1.0, 0.0, 1.0 ] ); +* var C = new Float32Array( [ 1.0, 2.0, 3.0, 4.0 ] ); +* +* sgemm( 'no-transpose', 'no-transpose', 2, 2, 2, 1.0, A, 2, 1, 0, B, 2, 1, 0, 1.0, C, 2, 1, 0 ); +* // C => [ 2.0, 5.0, 6.0, 11.0 ] +*/ +function sgemm( transA, transB, M, N, K, alpha, A, strideA1, strideA2, offsetA, B, strideB1, strideB2, offsetB, beta, C, strideC1, strideC2, offsetC ) { // eslint-disable-line max-params + var isrma; + var isrmb; + var isrmc; + var sa0; + var sa1; + var sb0; + var sb1; + var sc0; + var sc1; + var i0; + var i1; + var i2; + + isrma = isRowMajor( [ strideA1, strideA2 ] ); + isrmb = isRowMajor( [ strideB1, strideB2 ] ); + isrmc = isRowMajor( [ strideC1, strideC2 ] ); + + if ( isrma ) { // row-major + // For row-major matrices, the last dimension has the fastest changing index... + sa0 = strideA2; // stride for innermost loop + sa1 = strideA1; // stride for outermost loop + } else { // column-major + // For column-major matrices, the first dimension has the fastest changing index... + sa0 = strideA1; // stride for innermost loop + sa1 = strideA2; // stride for outermost loop + } + if ( isrmb ) { // row-major + sb0 = strideB2; // stride for innermost loop + sb1 = strideB1; // stride for outermost loop + } else { // column-major + sb0 = strideB1; // stride for innermost loop + sb1 = strideB2; // stride for outermost loop + } + if ( isrmc ) { // row-major + sc0 = strideC2; // stride for innermost loop + sc1 = strideC1; // stride for outermost loop + } else { // column-major + sc0 = strideC1; // stride for innermost loop + sc1 = strideC2; // stride for outermost loop + } + // if( transA === 'none' && transB === 'none' ) { + // for( i = 0; i < M; i++ ) { + // for( j = 0; j < N; j++ ) { + // temp = 0.0; + // for( k = 0; k < K; k++ ) { + // temp += A[ i * LDA + k ] * B[ k * LDB + j ]; + // } + // C[ i * LDC + j ] += alpha * temp; + // } + // } + // return C; + // } + // if( order === 'column-major' && transA === 'transpose' && transB === 'transpose' ) { + // for( i = 0; i < M; i++ ) { + // for( j = 0; j < N; j++ ) { + // temp = 0.0; + // for( k = 0; k < K; k++ ) { + // temp += A[ i * LDA + k ] * B[ k * LDB + j ]; + // } + // C[ i + LDC * j ] += alpha * temp; + // } + // } + // return C; + // } + // if( order === 'row-major' && transA === 'transpose' && transB === 'transpose' ) { + // for( i = 0; i < M; i++ ) { + // for( j = 0; j < N; j++ ) { + // temp = 0.0; + // for( k = 0; k < K; k++ ) { + // temp += A[ i + LDA * k ] * B[ k + LDB * j ]; + // } + // C[ i * LDC + j ] += alpha * temp; + // } + // } + // return C; + // } + // if( order === 'column-major' && transA === 'none' && transB === 'none' ) { + // for( i = 0; i < M; i++ ) { + // for( j = 0; j < N; j++ ) { + // temp = 0.0; + // for( k = 0; k < K; k++ ) { + // temp += A[ i + LDA * k ] * B[ k + LDB * j ]; + // } + // C[ i + LDC * j ] += alpha * temp; + // } + // } + // return C; + // } + // if( order === 'row-major' && transA === 'transpose' && transB === 'none' ) { + // for( i = 0; i < M; i++ ) { + // for( j = 0; j < N; j++ ) { + // temp = 0.0; + // for( k = 0; k < K; k++ ) { + // temp += A[ i + LDA * k ] * B[ k * LDB + j ]; + // } + // C[ i * LDC + j ] += alpha * temp; + // } + // } + // return C; + // } + // if( order === 'column-major' && transA === 'none' && transB === 'transpose' ) { + // for( i = 0; i < M; i++ ) { + // for( j = 0; j < N; j++ ) { + // temp = 0.0; + // for( k = 0; k < K; k++ ) { + // temp += A[ i + LDA * k ] * B[ k * LDB + j ]; + // } + // C[ i + LDC * j ] += alpha * temp; + // } + // } + // return C; + // } + // if( order === 'row-major' && transA === 'none' && transB === 'transpose' ) { + // for( i = 0; i < M; i++ ) { + // for( j = 0; j < N; j++ ) { + // temp = 0.0; + // for( k = 0; k < K; k++ ) { + // temp += A[ i * LDA + k ] * B[ k + LDB * j ]; + // } + // C[ i * LDC + j ] += alpha * temp; + // } + // } + // return C; + // } + // if( order === 'column-major' && transA === 'transpose' && transB === 'none' ) { + // for( i = 0; i < M; i++ ) { + // for( j = 0; j < N; j++ ) { + // temp = 0.0; + // for( k = 0; k < K; k++ ) { + // temp += A[ i * LDA + k ] * B[ k + LDB * j ]; + // } + // C[ i + LDC * j ] += alpha * temp; + // } + // } + // return C; + // } +} + + +// EXPORTS // + +module.exports = sgemm; diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/lib/index.js b/lib/node_modules/@stdlib/blas/base/sgemm/lib/index.js new file mode 100644 index 000000000000..f3289b7bdfff --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/sgemm/lib/index.js @@ -0,0 +1,72 @@ +/** +* @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 3 routine to perform one of the matrix-matrix operation `C = α*op(A)*op(B) + β*C` where `op(A)` is one of the `op(A) = A`, or `op(A) = A^T`, `α` and `β` are scalars, `A`, `B`, and `C` are matrices, with op(A) an `M` by `K` matrix, op(B) a `K` by `N` matrix and C an `M` by `N` matrix. +* +* @module @stdlib/blas/base/sgemm +* +* @example +* var Float32Array = require( '@stdlib/array/float32' ); +* var sgemm = require( '@stdlib/blas/base/sgemm' ); +* +* var A = new Float32Array( [ 1.0, 2.0, 3.0, 4.0 ] ); +* var B = new Float32Array( [ 1.0, 1.0, 0.0, 1.0 ] ); +* var C = new Float32Array( [ 1.0, 2.0, 3.0, 4.0 ] ); +* +* sgemm( 'row-major', 'no-transpose', 'no-transpose', 2, 2, 2, 1.0, A, 2, B, 2, 1.0, C, 2 ); +* // C => [ 2.0, 5.0, 6.0, 11.0 ] +* +* @example +* var Float32Array = require( '@stdlib/array/float32' ); +* var sgemm = require( '@stdlib/blas/base/sgemm' ); +* +* var A = new Float32Array( [ 1.0, 2.0, 3.0, 4.0 ] ); +* var B = new Float32Array( [ 1.0, 1.0, 0.0, 1.0 ] ); +* var C = new Float32Array( [ 1.0, 2.0, 3.0, 4.0 ] ); +* +* sgemm.ndarray( 'no-transpose', 'no-transpose', 2, 2, 2, 1.0, A, 2, 1, 0, B, 2, 1, 0, 1.0, C, 2, 1, 0 ); +* // C => [ 2.0, 5.0, 6.0, 11.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 sgemm; +var tmp = tryRequire( join( __dirname, './native.js' ) ); +if ( isError( tmp ) ) { + sgemm = main; +} else { + sgemm = tmp; +} + + +// EXPORTS // + +module.exports = sgemm; + +// exports: { "ndarray": "sgemm.ndarray" } diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/lib/main.js b/lib/node_modules/@stdlib/blas/base/sgemm/lib/main.js new file mode 100644 index 000000000000..3b3042c2e39e --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/sgemm/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 sgemm = require( './sgemm.js' ); +var ndarray = require( './ndarray.js' ); + + +// MAIN // + +setReadOnly( sgemm, 'ndarray', ndarray ); + + +// EXPORTS // + +module.exports = sgemm; diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/lib/ndarray.js b/lib/node_modules/@stdlib/blas/base/sgemm/lib/ndarray.js new file mode 100644 index 000000000000..0c81fb3ec977 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/sgemm/lib/ndarray.js @@ -0,0 +1,128 @@ +/** +* @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 isRowMajor = require( '@stdlib/ndarray/base/assert/is-row-major' ); +var isMatrixTranspose = require( '@stdlib/blas/base/assert/is-transpose-operation' ); +var format = require( '@stdlib/string/format' ); +var base = require( './base.js' ); + + +// MAIN // + +/** +* Performs one of the matrix-matrix operation `C = α*op(A)*op(B) + β*C` where `op(A)` is one of the `op(A) = A`, or `op(A) = A^T`, `α` and `β` are scalars, `A`, `B`, and `C` are matrices, with op(A) an `M` by `K` matrix, op(B) a `K` by `N` matrix and C an `M` by `N` matrix. +* +* @param {string} transA - specifies whether `A` should be transposed, conjugate-transposed, or not transposed +* @param {string} transB - specifies whether `B` should be transposed, conjugate-transposed, or not transposed +* @param {NonNegativeInteger} M - specifies the rows of the matrix `op(A)` and of the matrix `C` +* @param {NonNegativeInteger} N - specifies the columns of the matrix `op(B)` and of the matrix `C` +* @param {NonNegativeInteger} K - specifies the column of the matrix `op(A)` and row of the matrix `op(B)` +* @param {number} alpha - scalar constant +* @param {Float32Array} A - first matrix +* @param {integer} strideA1 - stride of the first dimension of `A` +* @param {integer} strideA2 - stride of the second dimension of `A` +* @param {NonNegativeInteger} offsetA - starting index for `A` +* @param {Float32Array} B - second matrix +* @param {integer} strideB1 - stride of the first dimension of `B` +* @param {integer} strideB2 - stride of the second dimension of `B` +* @param {NonNegativeInteger} offsetB - starting index for `B` +* @param {number} beta - scalar constant +* @param {Float32Array} C - third matrix +* @param {integer} strideC1 - stride of the first dimension of `C` +* @param {integer} strideC2 - stride of the second dimension of `C` +* @param {NonNegativeInteger} offsetC - starting index for `C` +* @throws {TypeError} first argument must be a valid transpose operation +* @throws {TypeError} second argument must be a valid transpose operation +* @throws {RangeError} third argument must be a nonnegative integer +* @throws {RangeError} fourth argument must be a nonnegative integer +* @throws {RangeError} fifth argument must be a nonnegative integer +* @returns {Float32Array} `C` +* +* @example +* var Float32Array = require( '@stdlib/array/float32' ); +* +* var A = new Float32Array( [ 1.0, 2.0, 3.0, 4.0 ] ); +* var B = new Float32Array( [ 1.0, 1.0, 0.0, 1.0 ] ); +* var C = new Float32Array( [ 1.0, 2.0, 3.0, 4.0 ] ); +* +* sgemm( 'no-transpose', 'no-transpose', 2, 2, 2, 1.0, A, 2, 1, 0, B, 2, 1, 0, 1.0, C, 2, 1, 0 ); +* // C => [ 2.0, 5.0, 6.0, 11.0 ] +*/ +function sgemm( transA, transB, M, N, K, alpha, A, strideA1, strideA2, offsetA, B, strideB1, strideB2, offsetB, beta, C, strideC1, strideC2, offsetC ) { // eslint-disable-line max-params, max-len + var isrm; + var sc0; + var sc1; + var oc; + + if ( !isMatrixTranspose( transA ) ) { + throw new TypeError( format( 'invalid argument. First argument must be a valid transpose operation. Value: `%s`.', transA ) ); + } + if ( !isMatrixTranspose( transB ) ) { + throw new TypeError( format( 'invalid argument. Second argument must be a valid transpose operation. Value: `%s`.', transB ) ); + } + if ( M < 0 ) { + throw new RangeError( format( 'invalid argument. Third argument must be a nonnegative integer. Value: `%d`.', M ) ); + } + if ( N < 0 ) { + throw new RangeError( format( 'invalid argument. Fourth argument must be a nonnegative integer. Value: `%d`.', M ) ); + } + if ( K < 0 ) { + throw new RangeError( format( 'invalid argument. Fifth argument must be a nonnegative integer. Value: `%d`.', K ) ); + } + if ( M === 0 || N === 0 || ( ( ( alpha === 0.0 ) || ( K === 0 ) ) && ( beta === 1.0 ) ) ) { + return C; + } + isrm = isRowMajor( strideC1, strideC2 ); + if ( isrm ) { + // For row-major matrices, the last dimension has the fastest changing index... + sc0 = strideC2; // stride for innermost loop + sc1 = strideC1; // stride for outermost loop + } else { // isColMajor + // For column-major matrices, the first dimension has the fastest changing index... + sc0 = strideC1; // stride for innermost loop + sc1 = strideC2; // stride for outermost loop + } + if( beta === 0.0 ) { + for( i1 = 0; i1 < N; i1++ ) { + oc = offsetC + (sc1*i1); + for( i0 = 0; i0 < M; i0++ ) { + C[ oc+(sc0*i0) ] = 0.0; + } + } + } else if( beta !== 1.0 ) { + for( i1 = 0; i1 < N; i1++ ) { + oc = offsetC + (sc1*i1); + for( i0 = 0; i0 < M; i0++ ) { + C[ oc+(sc0*i0) ] *= beta; + } + } + } + if( alpha === 0.0 ) { + return C; + } + return base( transA, transB, M, N, K, alpha, A, strideA1, strideA2, offsetA, B, strideB1, strideB2, offsetB, beta, C, strideC1, strideC2, offsetC ); // eslint-disable-line max-len +} + + +// EXPORTS // + +module.exports = sgemm; diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/lib/sgemm.js b/lib/node_modules/@stdlib/blas/base/sgemm/lib/sgemm.js new file mode 100644 index 000000000000..5c1574461aa8 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/sgemm/lib/sgemm.js @@ -0,0 +1,151 @@ +/** +* @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 sfill = require( '@stdlib/blas/ext/base/sfill' ); +var sscal = require( '@stdlib/blas/base/sscal' ); +var max = require( '@stdlib/math/base/special/fast/max' ); +var isLayout = require( '@stdlib/blas/base/assert/is-layout' ); +var isMatrixTranspose = require( '@stdlib/blas/base/assert/is-transpose-operation' ); +var format = require( '@stdlib/string/format' ); +var base = require( './base.js' ); + + +// MAIN // + +/** +* Performs one of the matrix-matrix operation `C = α*op(A)*op(B) + β*C` where `op(A)` is one of the `op(A) = A`, or `op(A) = A^T`, `α` and `β` are scalars, `A`, `B`, and `C` are matrices, with op(A) an `M` by `K` matrix, op(B) a `K` by `N` matrix and C an `M` by `N` matrix. +* +* @param {string} order - storage layout +* @param {string} transA - specifies whether `A` should be transposed, conjugate-transposed, or not transposed +* @param {string} transB - specifies whether `B` should be transposed, conjugate-transposed, or not transposed +* @param {NonNegativeInteger} M - specifies the rows of the matrix `op(A)` and of the matrix `C` +* @param {NonNegativeInteger} N - specifies the columns of the matrix `op(B)` and of the matrix `C` +* @param {NonNegativeInteger} K - specifies the column of the matrix `op(A)` and row of the matrix `op(B)` +* @param {number} alpha - scalar constant +* @param {Float32Array} A - first matrix +* @param {PositiveInteger} LDA - stride of the first dimension of `A` (a.k.a., leading dimension of the matrix `A`) +* @param {Float32Array} B - second matrix +* @param {PositiveInteger} LDB - stride of the first dimension of `B` (a.k.a., leading dimension of the matrix `B`) +* @param {number} beta - scalar constant +* @param {Float32Array} C - third matrix +* @param {PositiveInteger} LDC - stride of the first dimension of `C` (a.k.a., leading dimension of the matrix `C`) +* @throws {TypeError} first argument must be a valid order +* @throws {TypeError} second argument must be a valid transpose operation +* @throws {TypeError} third argument must be a valid transpose operation +* @throws {RangeError} fourth argument must be a nonnegative integer +* @throws {RangeError} fifth argument must be a nonnegative integer +* @throws {RangeError} sixth argument must be a nonnegative integer +* @throws {RangeError} ninth argument must be greater than or equal to max( 1 , nrowa ) +* @throws {RangeError} eleventh argument must be greater than or equal to max( 1 , nrowb ) +* @throws {RangeError} fourteenth argument must be greater than or equal to max( 1 , M ) +* @returns {Float32Array} `C` +* +* @example +* var Float32Array = require( '@stdlib/array/float32' ); +* +* var A = new Float32Array( [ 1.0, 2.0, 3.0, 4.0 ] ); +* var B = new Float32Array( [ 1.0, 1.0, 0.0, 1.0 ] ); +* var C = new Float32Array( [ 1.0, 2.0, 3.0, 4.0 ] ); +* +* sgemm( 'row-major', 'no-transpose', 'no-transpose', 2, 2, 2, 1.0, A, 2, B, 2, 1.0, C, 2 ); +* // C => [ 2.0, 5.0, 6.0, 11.0 ] +*/ +function sgemm( order, transA, transB, M, N, K, alpha, A, LDA, B, LDB, beta, C, LDC ) { // eslint-disable-line max-params, max-len + var nrowa; + var nrowb; + var sa1; + var sa2; + var sb1; + var sb2; + var sc1; + var sc2; + + if( transA === 'none' ) { + nrowa = K; + } else { + nrowa = M; + } + if( transB === 'none' ) { + nrowb = N; + } else { + nrowb = K; + } + if ( !isLayout( order ) ) { + throw new TypeError( format( 'invalid argument. First argument must be a valid order. Value: `%s`.', order ) ); + } + if ( !isMatrixTranspose( transA ) ) { + throw new TypeError( format( 'invalid argument. Second argument must be a valid transpose operation. Value: `%s`.', transA ) ); + } + if ( !isMatrixTranspose( transB ) ) { + throw new TypeError( format( 'invalid argument. Third argument must be a valid transpose operation. Value: `%s`.', transB ) ); + } + if ( M < 0 ) { + throw new RangeError( format( 'invalid argument. Fourth argument must be a nonnegative integer. Value: `%d`.', M ) ); + } + if ( N < 0 ) { + throw new RangeError( format( 'invalid argument. Fifth argument must be a nonnegative integer. Value: `%d`.', M ) ); + } + if ( K < 0 ) { + throw new RangeError( format( 'invalid argument. Sixth argument must be a nonnegative integer. Value: `%d`.', K ) ); + } + if ( LDA < max( 1, nrowa ) ) { + throw new RangeError( format( 'invalid argument. Ninth argument must be greater than or equal to max(1,%d). Value: `%d`.', nrowa, LDA ) ); + } + if ( LDB < max( 1, nrowb ) ) { + throw new RangeError( format( 'invalid argument. Eleventh argument must be greater than or equal to max(1,%d). Value: `%d`.', nrowb, LDB ) ); + } + if ( LDC < max( 1, M ) ) { + throw new RangeError( format( 'invalid argument. Fourteenth argument must be greater than or equal to max(1,%d). Value: `%d`.', M, LDC ) ); + } + if ( M === 0 || N === 0 || ( ( ( alpha === 0.0 ) || ( K === 0 ) ) && ( beta === 1.0 ) ) ) { + return C; + } + if( beta === 0.0 ) { + sfill( M*N, 0.0, C, 1 ); + } else if( beta !== 1.0 ) { + sscal( M*N, beta, C, 1 ); + } + if( alpha === 0.0 ) { + return C; + } + if ( order === 'column-major' ) { + sa1 = 1; + sa2 = LDA; + sb1 = 1; + sb2 = LDB; + sc1 = 1; + sc2 = LDC; + } else { // order === 'row-major' + sa1 = LDA; + sa2 = 1; + sb1 = LDB; + sb2 = 1; + sc1 = LDC; + sc2 = 1; + } + return base( transA, transB, M, N, K, alpha, A, sa1, sa2, 0, B, sb1, sb2, 0, beta, C, sc1, sc2, 0 ); // eslint-disable-line max-len +} + + +// EXPORTS // + +module.exports = sgemm; diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/package.json b/lib/node_modules/@stdlib/blas/base/sgemm/package.json new file mode 100644 index 000000000000..4c257cf5cb03 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/sgemm/package.json @@ -0,0 +1,68 @@ +{ + "name": "@stdlib/blas/base/sgemm", + "version": "0.0.0", + "description": "Perform one of the matrix-matrix operation `C = α*op(A)*op(B) + β*C` where `op(A)` is one of the `op(A) = A`, or `op(A) = A^T`.", + "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 3", + "sgemm", + "linear", + "algebra", + "subroutines", + "array", + "ndarray", + "float32", + "float", + "float32array" + ] +} diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/test/test.js b/lib/node_modules/@stdlib/blas/base/sgemm/test/test.js new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/test/test.ndarray.js b/lib/node_modules/@stdlib/blas/base/sgemm/test/test.ndarray.js new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/test/test.sgemm.js b/lib/node_modules/@stdlib/blas/base/sgemm/test/test.sgemm.js new file mode 100644 index 000000000000..e69de29bb2d1 From ce70f163975d728605810d4ad68cf1f3d9453d78 Mon Sep 17 00:00:00 2001 From: Athan Reines Date: Wed, 7 Aug 2024 02:47:21 -0700 Subject: [PATCH 02/26] docs: update description --- lib/node_modules/@stdlib/blas/base/sgemm/lib/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/lib/index.js b/lib/node_modules/@stdlib/blas/base/sgemm/lib/index.js index f3289b7bdfff..b0fab50bd66e 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/lib/index.js +++ b/lib/node_modules/@stdlib/blas/base/sgemm/lib/index.js @@ -19,7 +19,7 @@ 'use strict'; /** -* BLAS level 3 routine to perform one of the matrix-matrix operation `C = α*op(A)*op(B) + β*C` where `op(A)` is one of the `op(A) = A`, or `op(A) = A^T`, `α` and `β` are scalars, `A`, `B`, and `C` are matrices, with op(A) an `M` by `K` matrix, op(B) a `K` by `N` matrix and C an `M` by `N` matrix. +* BLAS level 3 routine to perform the matrix-matrix operation `C = α*op(A)*op(B) + β*C` where `op(A)` is either `op(A) = A` or `op(A) = A^T`, `α` and `β` are scalars, `A`, `B`, and `C` are matrices, with `op(A)` an `M` by `K` matrix, `op(B)` a `K` by `N` matrix, and `C` an `M` by `N` matrix. * * @module @stdlib/blas/base/sgemm * From 07e4a0efd35453fa3951fc4ee23c9850db4e4a4e Mon Sep 17 00:00:00 2001 From: Athan Reines Date: Fri, 9 Aug 2024 00:11:47 -0700 Subject: [PATCH 03/26] temp: refactor implementation --- .../@stdlib/blas/base/sgemm/lib/base.js | 390 +++++++++++++----- .../@stdlib/blas/base/sgemm/lib/index.js | 2 +- .../@stdlib/blas/base/sgemm/lib/ndarray.js | 48 +-- .../@stdlib/blas/base/sgemm/lib/sgemm.js | 62 ++- 4 files changed, 324 insertions(+), 178 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/lib/base.js b/lib/node_modules/@stdlib/blas/base/sgemm/lib/base.js index 3a2b21cb7ab8..959244400a26 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/lib/base.js +++ b/lib/node_modules/@stdlib/blas/base/sgemm/lib/base.js @@ -16,6 +16,8 @@ * limitations under the License. */ +/* eslint-disable max-len, max-params */ + 'use strict'; // MODULES // @@ -24,17 +26,247 @@ var isRowMajor = require( '@stdlib/ndarray/base/assert/is-row-major' ); var f32 = require( '@stdlib/number/float64/base/to-float32' ); +// FUNCTIONS // + +/** +* Tests whether a provided string indicates to transpose a matrix. +* +* @private +* @param {string} str - input string +* @returns {boolean} boolean indicating whether to transpose a matrix +* +* @example +* var bool = isTransposed( 'transpose' ); +* // returns true +* +* @example +* var bool = isTransposed( 'conjugate-transpose' ); +* // returns true +* +* @example +* var bool = isTransposed( 'no-transpose' ); +* // returns false +*/ +function isTransposed( str ) { + return ( str !== 'no-transpose' ); +} + +/** +* Fills a matrix with zeros. +* +* @private +* @param {NonNegativeInteger} M - number of rows +* @param {NonNegativeInteger} N - number of columns +* @param {Float32Array} X - matrix to fill +* @param {integer} strideX1 - stride of the first dimension of `X` +* @param {integer} strideX2 - stride of the second dimension of `X` +* @param {NonNegativeInteger} offsetX - starting index for `X` +* @returns {Float32Array} input matrix +* +* @example +* var Float32Array = require( '@stdlib/array/float32' ); +* +* var X = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); +* +* zeros( 2, 3, X, 3, 1, 0 ); +* // X => [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] +* +* @example +* var Float32Array = require( '@stdlib/array/float32' ); +* +* var X = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); +* +* zeros( 2, 3, X, 1, 2, 0 ); +* // X => [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] +*/ +function zeros( M, N, X, strideX1, strideX2, offsetX ) { + var dx0; + var dx1; + var S0; + var S1; + var i0; + var i1; + var ix; + + if ( isRowMajor( [ strideX1, strideX2 ] ) ) { + // For row-major matrices, the last dimension has the fastest changing index... + S0 = N; + S1 = M; + dx0 = strideX2; // offset increment for innermost loop + dx1 = strideX1 - ( S0*strideX2 ); // offset increment for outermost loop + } else { // column-major + // For column-major matrices, the first dimension has the fastest changing index... + S0 = M; + S1 = N; + dx0 = strideX1; // offset increment for innermost loop + dx1 = strideX2 - ( S0*strideX1 ); // offset increment for outermost loop + } + ix = offsetX; + for ( i1 = 0; i1 < S1; i1++ ) { + for ( i0 = 0; i0 < S0; i0++ ) { + X[ ix ] = 0.0; + ix += dx0; + } + ix += dx1; + } + return X; +} + +/** +* Scales each element in a matrix by a scalar `β`. +* +* @private +* @param {NonNegativeInteger} M - number of rows +* @param {NonNegativeInteger} N - number of columns +* @param {number} beta - scalar +* @param {Float32Array} X - matrix to fill +* @param {integer} strideX1 - stride of the first dimension of `X` +* @param {integer} strideX2 - stride of the second dimension of `X` +* @param {NonNegativeInteger} offsetX - starting index for `X` +* @returns {Float32Array} input matrix +* +* @example +* var Float32Array = require( '@stdlib/array/float32' ); +* +* var X = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); +* +* scal( 2, 3, 5.0, X, 3, 1, 0 ); +* // X => [ 5.0, 10.0, 15.0, 20.0, 25.0, 30.0 ] +* +* @example +* var Float32Array = require( '@stdlib/array/float32' ); +* +* var X = new Float32Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] ); +* +* scal( 2, 3, 5.0, X, 1, 2, 0 ); +* // X => [ 5.0, 10.0, 15.0, 20.0, 25.0, 30.0 ] +*/ +function scal( M, N, beta, X, strideX1, strideX2, offsetX ) { + var dx0; + var dx1; + var S0; + var S1; + var i0; + var i1; + var ix; + + if ( isRowMajor( [ strideX1, strideX2 ] ) ) { + // For row-major matrices, the last dimension has the fastest changing index... + S0 = N; + S1 = M; + dx0 = strideX2; // offset increment for innermost loop + dx1 = strideX1 - ( S0*strideX2 ); // offset increment for outermost loop + } else { // column-major + // For column-major matrices, the first dimension has the fastest changing index... + S0 = M; + S1 = N; + dx0 = strideX1; // offset increment for innermost loop + dx1 = strideX2 - ( S0*strideX1 ); // offset increment for outermost loop + } + ix = offsetX; + for ( i1 = 0; i1 < S1; i1++ ) { + for ( i0 = 0; i0 < S0; i0++ ) { + X[ ix ] *= beta; + ix += dx0; + } + ix += dx1; + } + return X; +} + +/** +* Performs matrix multiplication using a naive algorithm which is cache-optimal when `A` is row-major and `B` is column-major. +* +* @private +* @param {NonNegativeInteger} M - number of rows in the matrix `op(A)` and in the matrix `C` +* @param {NonNegativeInteger} N - number of columns in the matrix `op(B)` and in the matrix `C` +* @param {NonNegativeInteger} K - number of columns in the matrix `op(A)` and number of rows in the matrix `op(B)` +* @param {number} alpha - scalar constant +* @param {Float32Array} A - first matrix +* @param {integer} strideA1 - stride of the first dimension of `A` +* @param {integer} strideA2 - stride of the second dimension of `A` +* @param {NonNegativeInteger} offsetA - starting index for `A` +* @param {Float32Array} B - second matrix +* @param {integer} strideB1 - stride of the first dimension of `B` +* @param {integer} strideB2 - stride of the second dimension of `B` +* @param {NonNegativeInteger} offsetB - starting index for `B` +* @param {Float32Array} C - third matrix +* @param {integer} strideC1 - stride of the first dimension of `C` +* @param {integer} strideC2 - stride of the second dimension of `C` +* @param {NonNegativeInteger} offsetC - starting index for `C` +* @returns {Float32Array} `C` +* +* @example +* var Float32Array = require( '@stdlib/array/float32' ); +* +* var A = new Float32Array( [ 1.0, 2.0, 3.0, 4.0 ] ); +* var B = new Float32Array( [ 1.0, 1.0, 0.0, 1.0 ] ); +* var C = new Float32Array( [ 1.0, 2.0, 3.0, 4.0 ] ); +* +* naive( 2, 2, 2, 1.0, A, 2, 1, 0, B, 2, 1, 0, C, 2, 1, 0 ); +* // C => [ 2.0, 5.0, 6.0, 11.0 ] +*/ +function naive( M, N, K, alpha, A, strideA1, strideA2, offsetA, B, strideB1, strideB2, offsetB, C, strideC1, strideC2, offsetC ) { + var da0; + var db0; + var dc0; + var dc1; + var S0; + var S1; + var i0; + var i1; + var ia; + var ib; + var ic; + var r; + var k; + + // Note on variable naming convention: S#, dx#, dy#, i# where # corresponds to the loop number, with `0` being the innermost loop... + + S0 = N; + S1 = M; + da0 = strideA2; + db0 = strideB1; + dc0 = strideC2; // offset increment for innermost loop + dc1 = strideC1 - ( S0*strideC2 ); // offset increment for outermost loop + + ic = offsetC; + for ( i1 = 0; i1 < S1; i1++ ) { + for ( i0 = 0; i0 < S0; i0++ ) { + // Compute index offsets... + ia = offsetA + ( i1*strideA1 ); + ib = offsetB + ( i0*strideB2 ); + + // Compute the dot product... + r = 0.0; // initialize dot product result + for ( k = 0; k < K; k++ ) { + r = f32( r + f32( A[ ia ] * B[ ib ] ) ); + ia += da0; + ib += db0; + } + // Scale the dot product by `α`: + r = f32( r * alpha ); + + C[ ic ] += r; + ic += dc0; + } + ic += dc1; + } + return C; +} + + // MAIN // /** -* Performs one of the matrix-matrix operation `C = α*op(A)*op(B) + β*C` where `op(A)` is one of the `op(A) = A`, or `op(A) = A^T`, `α` and `β` are scalars, `A`, `B`, and `C` are matrices, with op(A) an `M` by `K` matrix, op(B) a `K` by `N` matrix and C an `M` by `N` matrix. +* Performs the matrix-matrix operation `C = α*op(A)*op(B) + β*C` where `op(A)` is either `op(A) = A` or `op(A) = A^T`, `α` and `β` are scalars, `A`, `B`, and `C` are matrices, with `op(A)` an `M` by `K` matrix, `op(B)` a `K` by `N` matrix, and `C` an `M` by `N` matrix. * * @private * @param {string} transA - specifies whether `A` should be transposed, conjugate-transposed, or not transposed * @param {string} transB - specifies whether `B` should be transposed, conjugate-transposed, or not transposed -* @param {NonNegativeInteger} M - specifies the rows of the matrix `op(A)` and of the matrix `C` -* @param {NonNegativeInteger} N - specifies the columns of the matrix `op(B)` and of the matrix `C` -* @param {NonNegativeInteger} K - specifies the column of the matrix `op(A)` and row of the matrix `op(B)` +* @param {NonNegativeInteger} M - number of rows in the matrix `op(A)` and in the matrix `C` +* @param {NonNegativeInteger} N - number of columns in the matrix `op(B)` and in the matrix `C` +* @param {NonNegativeInteger} K - number of columns in the matrix `op(A)` and number of rows in the matrix `op(B)` * @param {number} alpha - scalar constant * @param {Float32Array} A - first matrix * @param {integer} strideA1 - stride of the first dimension of `A` @@ -61,7 +293,7 @@ var f32 = require( '@stdlib/number/float64/base/to-float32' ); * sgemm( 'no-transpose', 'no-transpose', 2, 2, 2, 1.0, A, 2, 1, 0, B, 2, 1, 0, 1.0, C, 2, 1, 0 ); * // C => [ 2.0, 5.0, 6.0, 11.0 ] */ -function sgemm( transA, transB, M, N, K, alpha, A, strideA1, strideA2, offsetA, B, strideB1, strideB2, offsetB, beta, C, strideC1, strideC2, offsetC ) { // eslint-disable-line max-params +function sgemm( transA, transB, M, N, K, alpha, A, strideA1, strideA2, offsetA, B, strideB1, strideB2, offsetB, beta, C, strideC1, strideC2, offsetC ) { var isrma; var isrmb; var isrmc; @@ -71,12 +303,47 @@ function sgemm( transA, transB, M, N, K, alpha, A, strideA1, strideA2, offsetA, var sb1; var sc0; var sc1; - var i0; - var i1; - var i2; + var tmp; + + // Form: C = β⋅C + if ( beta === 0.0 ) { + C = zeros( M, N, C, strideC1, strideC2, offsetC ); + } else if ( beta !== 1.0 ) { + C = scal( M, N, beta, C, strideC1, strideC2, offsetC ); + } + + // Check whether we can early return... + if ( alpha === 0.0 ) { + return C; + } + // Determine the memory layouts of `A` and `B`... isrma = isRowMajor( [ strideA1, strideA2 ] ); isrmb = isRowMajor( [ strideB1, strideB2 ] ); + + // Check whether we can avoid loop tiling and simply use the "naive" (cache-optimal) algorithm for performing matrix multiplication... + if ( isrma ) { // orderA === 'row-major' + if ( !isTransposed( transA ) ) { + if ( !isrmb && !isTransposed( transB ) ) { // orderB === 'column-major' + // Form: C = α⋅A⋅B + C + return naive( M, N, K, alpha, A, strideA1, strideA2, offsetA, B, strideB1, strideB2, offsetB, C, strideC1, strideC2, offsetC ); + } + if ( isrmb && isTransposed( transB ) ) { // orderB === 'row-major' + // Form: C = α⋅A⋅B^T + C + return naive( M, N, K, alpha, A, strideA1, strideA2, offsetA, B, strideB2, strideB1, offsetB, C, strideC1, strideC2, offsetC ); + } + } + } else if ( isTransposed( transA ) ) { // orderA === 'column-major' + if ( isrmb && isTransposed( transB ) ) { // orderB === 'row-major' + // Form: C = α⋅A^T⋅B^T + C + return naive( M, N, K, alpha, A, strideA2, strideA1, offsetA, B, strideB2, strideB1, offsetB, C, strideC1, strideC2, offsetC ); + } + if ( !isrmb && !isTransposed( transB ) ) { // orderB === 'column-major' + // Form: C = α⋅A^T⋅B + C + return naive( M, N, K, alpha, A, strideA2, strideA1, offsetA, B, strideB1, strideB2, offsetB, C, strideC1, strideC2, offsetC ); + } + } + isrmc = isRowMajor( [ strideC1, strideC2 ] ); if ( isrma ) { // row-major @@ -88,6 +355,11 @@ function sgemm( transA, transB, M, N, K, alpha, A, strideA1, strideA2, offsetA, sa0 = strideA1; // stride for innermost loop sa1 = strideA2; // stride for outermost loop } + if ( transA !== 'no-transpose' ) { + tmp = sa0; + sa0 = sa1; + sa1 = tmp; + } if ( isrmb ) { // row-major sb0 = strideB2; // stride for innermost loop sb1 = strideB1; // stride for outermost loop @@ -95,6 +367,11 @@ function sgemm( transA, transB, M, N, K, alpha, A, strideA1, strideA2, offsetA, sb0 = strideB1; // stride for innermost loop sb1 = strideB2; // stride for outermost loop } + if ( transB !== 'non-transpose' ) { + tmp = sb0; + sb0 = sb1; + sb1 = tmp; + } if ( isrmc ) { // row-major sc0 = strideC2; // stride for innermost loop sc1 = strideC1; // stride for outermost loop @@ -102,102 +379,7 @@ function sgemm( transA, transB, M, N, K, alpha, A, strideA1, strideA2, offsetA, sc0 = strideC1; // stride for innermost loop sc1 = strideC2; // stride for outermost loop } - // if( transA === 'none' && transB === 'none' ) { - // for( i = 0; i < M; i++ ) { - // for( j = 0; j < N; j++ ) { - // temp = 0.0; - // for( k = 0; k < K; k++ ) { - // temp += A[ i * LDA + k ] * B[ k * LDB + j ]; - // } - // C[ i * LDC + j ] += alpha * temp; - // } - // } - // return C; - // } - // if( order === 'column-major' && transA === 'transpose' && transB === 'transpose' ) { - // for( i = 0; i < M; i++ ) { - // for( j = 0; j < N; j++ ) { - // temp = 0.0; - // for( k = 0; k < K; k++ ) { - // temp += A[ i * LDA + k ] * B[ k * LDB + j ]; - // } - // C[ i + LDC * j ] += alpha * temp; - // } - // } - // return C; - // } - // if( order === 'row-major' && transA === 'transpose' && transB === 'transpose' ) { - // for( i = 0; i < M; i++ ) { - // for( j = 0; j < N; j++ ) { - // temp = 0.0; - // for( k = 0; k < K; k++ ) { - // temp += A[ i + LDA * k ] * B[ k + LDB * j ]; - // } - // C[ i * LDC + j ] += alpha * temp; - // } - // } - // return C; - // } - // if( order === 'column-major' && transA === 'none' && transB === 'none' ) { - // for( i = 0; i < M; i++ ) { - // for( j = 0; j < N; j++ ) { - // temp = 0.0; - // for( k = 0; k < K; k++ ) { - // temp += A[ i + LDA * k ] * B[ k + LDB * j ]; - // } - // C[ i + LDC * j ] += alpha * temp; - // } - // } - // return C; - // } - // if( order === 'row-major' && transA === 'transpose' && transB === 'none' ) { - // for( i = 0; i < M; i++ ) { - // for( j = 0; j < N; j++ ) { - // temp = 0.0; - // for( k = 0; k < K; k++ ) { - // temp += A[ i + LDA * k ] * B[ k * LDB + j ]; - // } - // C[ i * LDC + j ] += alpha * temp; - // } - // } - // return C; - // } - // if( order === 'column-major' && transA === 'none' && transB === 'transpose' ) { - // for( i = 0; i < M; i++ ) { - // for( j = 0; j < N; j++ ) { - // temp = 0.0; - // for( k = 0; k < K; k++ ) { - // temp += A[ i + LDA * k ] * B[ k * LDB + j ]; - // } - // C[ i + LDC * j ] += alpha * temp; - // } - // } - // return C; - // } - // if( order === 'row-major' && transA === 'none' && transB === 'transpose' ) { - // for( i = 0; i < M; i++ ) { - // for( j = 0; j < N; j++ ) { - // temp = 0.0; - // for( k = 0; k < K; k++ ) { - // temp += A[ i * LDA + k ] * B[ k + LDB * j ]; - // } - // C[ i * LDC + j ] += alpha * temp; - // } - // } - // return C; - // } - // if( order === 'column-major' && transA === 'transpose' && transB === 'none' ) { - // for( i = 0; i < M; i++ ) { - // for( j = 0; j < N; j++ ) { - // temp = 0.0; - // for( k = 0; k < K; k++ ) { - // temp += A[ i * LDA + k ] * B[ k + LDB * j ]; - // } - // C[ i + LDC * j ] += alpha * temp; - // } - // } - // return C; - // } + } diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/lib/index.js b/lib/node_modules/@stdlib/blas/base/sgemm/lib/index.js index b0fab50bd66e..18dd6ce818b3 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/lib/index.js +++ b/lib/node_modules/@stdlib/blas/base/sgemm/lib/index.js @@ -19,7 +19,7 @@ 'use strict'; /** -* BLAS level 3 routine to perform the matrix-matrix operation `C = α*op(A)*op(B) + β*C` where `op(A)` is either `op(A) = A` or `op(A) = A^T`, `α` and `β` are scalars, `A`, `B`, and `C` are matrices, with `op(A)` an `M` by `K` matrix, `op(B)` a `K` by `N` matrix, and `C` an `M` by `N` matrix. +* BLAS level 3 routine to perform the matrix-matrix operation `C = α*op(A)*op(B) + β*C` where `op(X)` is either `op(X) = X` or `op(X) = X^T`, `α` and `β` are scalars, `A`, `B`, and `C` are matrices, with `op(A)` an `M` by `K` matrix, `op(B)` a `K` by `N` matrix, and `C` an `M` by `N` matrix. * * @module @stdlib/blas/base/sgemm * diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/lib/ndarray.js b/lib/node_modules/@stdlib/blas/base/sgemm/lib/ndarray.js index 0c81fb3ec977..9c7e4ea09f84 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/lib/ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/sgemm/lib/ndarray.js @@ -20,7 +20,6 @@ // MODULES // -var isRowMajor = require( '@stdlib/ndarray/base/assert/is-row-major' ); var isMatrixTranspose = require( '@stdlib/blas/base/assert/is-transpose-operation' ); var format = require( '@stdlib/string/format' ); var base = require( './base.js' ); @@ -29,13 +28,13 @@ var base = require( './base.js' ); // MAIN // /** -* Performs one of the matrix-matrix operation `C = α*op(A)*op(B) + β*C` where `op(A)` is one of the `op(A) = A`, or `op(A) = A^T`, `α` and `β` are scalars, `A`, `B`, and `C` are matrices, with op(A) an `M` by `K` matrix, op(B) a `K` by `N` matrix and C an `M` by `N` matrix. +* Performs the matrix-matrix operation `C = α*op(A)*op(B) + β*C` where `op(A)` is either `op(A) = A` or `op(A) = A^T`, `α` and `β` are scalars, `A`, `B`, and `C` are matrices, with `op(A)` an `M` by `K` matrix, `op(B)` a `K` by `N` matrix, and `C` an `M` by `N` matrix. * * @param {string} transA - specifies whether `A` should be transposed, conjugate-transposed, or not transposed * @param {string} transB - specifies whether `B` should be transposed, conjugate-transposed, or not transposed -* @param {NonNegativeInteger} M - specifies the rows of the matrix `op(A)` and of the matrix `C` -* @param {NonNegativeInteger} N - specifies the columns of the matrix `op(B)` and of the matrix `C` -* @param {NonNegativeInteger} K - specifies the column of the matrix `op(A)` and row of the matrix `op(B)` +* @param {NonNegativeInteger} M - number of rows in the matrix `op(A)` and in the matrix `C` +* @param {NonNegativeInteger} N - number of columns in the matrix `op(B)` and in the matrix `C` +* @param {NonNegativeInteger} K - number of columns in the matrix `op(A)` and number of rows in the matrix `op(B)` * @param {number} alpha - scalar constant * @param {Float32Array} A - first matrix * @param {integer} strideA1 - stride of the first dimension of `A` @@ -68,11 +67,6 @@ var base = require( './base.js' ); * // C => [ 2.0, 5.0, 6.0, 11.0 ] */ function sgemm( transA, transB, M, N, K, alpha, A, strideA1, strideA2, offsetA, B, strideB1, strideB2, offsetB, beta, C, strideC1, strideC2, offsetC ) { // eslint-disable-line max-params, max-len - var isrm; - var sc0; - var sc1; - var oc; - if ( !isMatrixTranspose( transA ) ) { throw new TypeError( format( 'invalid argument. First argument must be a valid transpose operation. Value: `%s`.', transA ) ); } @@ -88,35 +82,11 @@ function sgemm( transA, transB, M, N, K, alpha, A, strideA1, strideA2, offsetA, if ( K < 0 ) { throw new RangeError( format( 'invalid argument. Fifth argument must be a nonnegative integer. Value: `%d`.', K ) ); } - if ( M === 0 || N === 0 || ( ( ( alpha === 0.0 ) || ( K === 0 ) ) && ( beta === 1.0 ) ) ) { - return C; - } - isrm = isRowMajor( strideC1, strideC2 ); - if ( isrm ) { - // For row-major matrices, the last dimension has the fastest changing index... - sc0 = strideC2; // stride for innermost loop - sc1 = strideC1; // stride for outermost loop - } else { // isColMajor - // For column-major matrices, the first dimension has the fastest changing index... - sc0 = strideC1; // stride for innermost loop - sc1 = strideC2; // stride for outermost loop - } - if( beta === 0.0 ) { - for( i1 = 0; i1 < N; i1++ ) { - oc = offsetC + (sc1*i1); - for( i0 = 0; i0 < M; i0++ ) { - C[ oc+(sc0*i0) ] = 0.0; - } - } - } else if( beta !== 1.0 ) { - for( i1 = 0; i1 < N; i1++ ) { - oc = offsetC + (sc1*i1); - for( i0 = 0; i0 < M; i0++ ) { - C[ oc+(sc0*i0) ] *= beta; - } - } - } - if( alpha === 0.0 ) { + if ( + M === 0 || + N === 0 || + ( ( beta === 1.0 ) && ( ( alpha === 0.0 ) || ( K === 0 ) ) ) + ) { return C; } return base( transA, transB, M, N, K, alpha, A, strideA1, strideA2, offsetA, B, strideB1, strideB2, offsetB, beta, C, strideC1, strideC2, offsetC ); // eslint-disable-line max-len diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/lib/sgemm.js b/lib/node_modules/@stdlib/blas/base/sgemm/lib/sgemm.js index 5c1574461aa8..0c61268092d1 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/lib/sgemm.js +++ b/lib/node_modules/@stdlib/blas/base/sgemm/lib/sgemm.js @@ -20,8 +20,6 @@ // MODULES // -var sfill = require( '@stdlib/blas/ext/base/sfill' ); -var sscal = require( '@stdlib/blas/base/sscal' ); var max = require( '@stdlib/math/base/special/fast/max' ); var isLayout = require( '@stdlib/blas/base/assert/is-layout' ); var isMatrixTranspose = require( '@stdlib/blas/base/assert/is-transpose-operation' ); @@ -32,14 +30,14 @@ var base = require( './base.js' ); // MAIN // /** -* Performs one of the matrix-matrix operation `C = α*op(A)*op(B) + β*C` where `op(A)` is one of the `op(A) = A`, or `op(A) = A^T`, `α` and `β` are scalars, `A`, `B`, and `C` are matrices, with op(A) an `M` by `K` matrix, op(B) a `K` by `N` matrix and C an `M` by `N` matrix. +* Performs the matrix-matrix operation `C = α*op(A)*op(B) + β*C` where `op(A)` is either `op(X) = X` or `op(X) = X^T`, `α` and `β` are scalars, `A`, `B`, and `C` are matrices, with `op(A)` an `M` by `K` matrix, `op(B)` a `K` by `N` matrix, and `C` an `M` by `N` matrix. * * @param {string} order - storage layout * @param {string} transA - specifies whether `A` should be transposed, conjugate-transposed, or not transposed * @param {string} transB - specifies whether `B` should be transposed, conjugate-transposed, or not transposed -* @param {NonNegativeInteger} M - specifies the rows of the matrix `op(A)` and of the matrix `C` -* @param {NonNegativeInteger} N - specifies the columns of the matrix `op(B)` and of the matrix `C` -* @param {NonNegativeInteger} K - specifies the column of the matrix `op(A)` and row of the matrix `op(B)` +* @param {NonNegativeInteger} M - number of rows in the matrix `op(A)` and in the matrix `C` +* @param {NonNegativeInteger} N - number of columns in the matrix `op(B)` and in the matrix `C` +* @param {NonNegativeInteger} K - number of columns in the matrix `op(A)` and number of rows in the matrix `op(B)` * @param {number} alpha - scalar constant * @param {Float32Array} A - first matrix * @param {PositiveInteger} LDA - stride of the first dimension of `A` (a.k.a., leading dimension of the matrix `A`) @@ -54,9 +52,9 @@ var base = require( './base.js' ); * @throws {RangeError} fourth argument must be a nonnegative integer * @throws {RangeError} fifth argument must be a nonnegative integer * @throws {RangeError} sixth argument must be a nonnegative integer -* @throws {RangeError} ninth argument must be greater than or equal to max( 1 , nrowa ) -* @throws {RangeError} eleventh argument must be greater than or equal to max( 1 , nrowb ) -* @throws {RangeError} fourteenth argument must be greater than or equal to max( 1 , M ) +* @throws {RangeError} ninth argument must be greater than or equal to max(1,M) when `A` is not transposed and max(1,K) otherwise +* @throws {RangeError} eleventh argument must be greater than or equal to max(1,K) when `B` is not transposed and max(1,N) otherwise +* @throws {RangeError} fourteenth argument must be greater than or equal to max(1,M) * @returns {Float32Array} `C` * * @example @@ -70,8 +68,8 @@ var base = require( './base.js' ); * // C => [ 2.0, 5.0, 6.0, 11.0 ] */ function sgemm( order, transA, transB, M, N, K, alpha, A, LDA, B, LDB, beta, C, LDC ) { // eslint-disable-line max-params, max-len - var nrowa; - var nrowb; + var nrowsa; + var nrowsb; var sa1; var sa2; var sb1; @@ -79,16 +77,6 @@ function sgemm( order, transA, transB, M, N, K, alpha, A, LDA, B, LDB, beta, C, var sc1; var sc2; - if( transA === 'none' ) { - nrowa = K; - } else { - nrowa = M; - } - if( transB === 'none' ) { - nrowb = N; - } else { - nrowb = K; - } if ( !isLayout( order ) ) { throw new TypeError( format( 'invalid argument. First argument must be a valid order. Value: `%s`.', order ) ); } @@ -107,24 +95,30 @@ function sgemm( order, transA, transB, M, N, K, alpha, A, LDA, B, LDB, beta, C, if ( K < 0 ) { throw new RangeError( format( 'invalid argument. Sixth argument must be a nonnegative integer. Value: `%d`.', K ) ); } - if ( LDA < max( 1, nrowa ) ) { - throw new RangeError( format( 'invalid argument. Ninth argument must be greater than or equal to max(1,%d). Value: `%d`.', nrowa, LDA ) ); + if ( transA === 'none' ) { + nrowsa = K; + } else { + nrowsa = M; } - if ( LDB < max( 1, nrowb ) ) { - throw new RangeError( format( 'invalid argument. Eleventh argument must be greater than or equal to max(1,%d). Value: `%d`.', nrowb, LDB ) ); + if ( transB === 'none' ) { + nrowsb = N; + } else { + nrowsb = K; } - if ( LDC < max( 1, M ) ) { - throw new RangeError( format( 'invalid argument. Fourteenth argument must be greater than or equal to max(1,%d). Value: `%d`.', M, LDC ) ); + if ( LDA < max( 1, nrowsa ) ) { + throw new RangeError( format( 'invalid argument. Ninth argument must be greater than or equal to max(1,%d). Value: `%d`.', nrowsa, LDA ) ); } - if ( M === 0 || N === 0 || ( ( ( alpha === 0.0 ) || ( K === 0 ) ) && ( beta === 1.0 ) ) ) { - return C; + if ( LDB < max( 1, nrowsb ) ) { + throw new RangeError( format( 'invalid argument. Eleventh argument must be greater than or equal to max(1,%d). Value: `%d`.', nrowsb, LDB ) ); } - if( beta === 0.0 ) { - sfill( M*N, 0.0, C, 1 ); - } else if( beta !== 1.0 ) { - sscal( M*N, beta, C, 1 ); + if ( LDC < max( 1, M ) ) { + throw new RangeError( format( 'invalid argument. Fourteenth argument must be greater than or equal to max(1,%d). Value: `%d`.', M, LDC ) ); } - if( alpha === 0.0 ) { + if ( + M === 0 || + N === 0 || + ( ( beta === 1.0 ) && ( ( alpha === 0.0 ) || ( K === 0 ) ) ) + ) { return C; } if ( order === 'column-major' ) { From bd3fafff789c49de35c8817e955d2acddb4468a4 Mon Sep 17 00:00:00 2001 From: Athan Reines Date: Fri, 9 Aug 2024 00:12:39 -0700 Subject: [PATCH 04/26] refactor: replace loop with BLAS sdot --- .../@stdlib/blas/base/sgemm/lib/base.js | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/lib/base.js b/lib/node_modules/@stdlib/blas/base/sgemm/lib/base.js index 959244400a26..d836ae88f68c 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/lib/base.js +++ b/lib/node_modules/@stdlib/blas/base/sgemm/lib/base.js @@ -23,6 +23,7 @@ // MODULES // var isRowMajor = require( '@stdlib/ndarray/base/assert/is-row-major' ); +var sdot = require( '@stdlib/blas/base/sdot' ).ndarray; var f32 = require( '@stdlib/number/float64/base/to-float32' ); @@ -218,8 +219,6 @@ function naive( M, N, K, alpha, A, strideA1, strideA2, offsetA, B, strideB1, str var ia; var ib; var ic; - var r; - var k; // Note on variable naming convention: S#, dx#, dy#, i# where # corresponds to the loop number, with `0` being the innermost loop... @@ -233,21 +232,14 @@ function naive( M, N, K, alpha, A, strideA1, strideA2, offsetA, B, strideB1, str ic = offsetC; for ( i1 = 0; i1 < S1; i1++ ) { for ( i0 = 0; i0 < S0; i0++ ) { - // Compute index offsets... + // Compute index offsets: ia = offsetA + ( i1*strideA1 ); ib = offsetB + ( i0*strideB2 ); - // Compute the dot product... - r = 0.0; // initialize dot product result - for ( k = 0; k < K; k++ ) { - r = f32( r + f32( A[ ia ] * B[ ib ] ) ); - ia += da0; - ib += db0; - } - // Scale the dot product by `α`: - r = f32( r * alpha ); + // Compute the dot product and scale by `α`: + C[ ic ] += f32( alpha * sdot( K, A, da0, ia, B, db0, ib ) ); - C[ ic ] += r; + // Increment the pointer to the next element of `C` to update: ic += dc0; } ic += dc1; From 0b644bf620c4e1a07298980d85588c2864e32fb2 Mon Sep 17 00:00:00 2001 From: Athan Reines Date: Fri, 9 Aug 2024 02:49:54 -0700 Subject: [PATCH 05/26] refactor: add loop tiling algorithm --- .../@stdlib/blas/base/sgemm/lib/base.js | 188 +++++++++++++----- 1 file changed, 140 insertions(+), 48 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/lib/base.js b/lib/node_modules/@stdlib/blas/base/sgemm/lib/base.js index d836ae88f68c..21c9770471de 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/lib/base.js +++ b/lib/node_modules/@stdlib/blas/base/sgemm/lib/base.js @@ -24,9 +24,15 @@ var isRowMajor = require( '@stdlib/ndarray/base/assert/is-row-major' ); var sdot = require( '@stdlib/blas/base/sdot' ).ndarray; +var blockSize = require( '@stdlib/ndarray/base/unary-tiling-block-size' ); var f32 = require( '@stdlib/number/float64/base/to-float32' ); +// VARIABLES // + +var bsize = blockSize( 'float32' ); + + // FUNCTIONS // /** @@ -220,7 +226,7 @@ function naive( M, N, K, alpha, A, strideA1, strideA2, offsetA, B, strideB1, str var ib; var ic; - // Note on variable naming convention: S#, dx#, dy#, i# where # corresponds to the loop number, with `0` being the innermost loop... + // Note on variable naming convention: S#, da#, db#, dc#, i# where # corresponds to the loop number, with `0` being the innermost loop... S0 = N; S1 = M; @@ -231,15 +237,10 @@ function naive( M, N, K, alpha, A, strideA1, strideA2, offsetA, B, strideB1, str ic = offsetC; for ( i1 = 0; i1 < S1; i1++ ) { + ia = offsetA + ( i1*strideA1 ); for ( i0 = 0; i0 < S0; i0++ ) { - // Compute index offsets: - ia = offsetA + ( i1*strideA1 ); ib = offsetB + ( i0*strideB2 ); - - // Compute the dot product and scale by `α`: C[ ic ] += f32( alpha * sdot( K, A, da0, ia, B, db0, ib ) ); - - // Increment the pointer to the next element of `C` to update: ic += dc0; } ic += dc1; @@ -247,6 +248,121 @@ function naive( M, N, K, alpha, A, strideA1, strideA2, offsetA, B, strideB1, str return C; } +/** +* Performs matrix multiplication using loop tiling. +* +* @private +* @param {NonNegativeInteger} M - number of rows in the matrix `op(A)` and in the matrix `C` +* @param {NonNegativeInteger} N - number of columns in the matrix `op(B)` and in the matrix `C` +* @param {NonNegativeInteger} K - number of columns in the matrix `op(A)` and number of rows in the matrix `op(B)` +* @param {number} alpha - scalar constant +* @param {Float32Array} A - first matrix +* @param {integer} strideA1 - stride of the first dimension of `A` +* @param {integer} strideA2 - stride of the second dimension of `A` +* @param {NonNegativeInteger} offsetA - starting index for `A` +* @param {Float32Array} B - second matrix +* @param {integer} strideB1 - stride of the first dimension of `B` +* @param {integer} strideB2 - stride of the second dimension of `B` +* @param {NonNegativeInteger} offsetB - starting index for `B` +* @param {Float32Array} C - third matrix +* @param {integer} strideC1 - stride of the first dimension of `C` +* @param {integer} strideC2 - stride of the second dimension of `C` +* @param {NonNegativeInteger} offsetC - starting index for `C` +* @returns {Float32Array} `C` +* +* @example +* var Float32Array = require( '@stdlib/array/float32' ); +* +* var A = new Float32Array( [ 1.0, 2.0, 3.0, 4.0 ] ); +* var B = new Float32Array( [ 1.0, 1.0, 0.0, 1.0 ] ); +* var C = new Float32Array( [ 1.0, 2.0, 3.0, 4.0 ] ); +* +* blocked( 2, 2, 2, 1.0, A, 2, 1, 0, B, 2, 1, 0, C, 2, 1, 0 ); +* // C => [ 2.0, 5.0, 6.0, 11.0 ] +*/ +function blocked( M, N, K, alpha, A, strideA1, strideA2, offsetA, B, strideB1, strideB2, offsetB, C, strideC1, strideC2, offsetC ) { + var da0; + var db0; + var dc0; + var dc1; + var oa1; + var ob0; + var oc1; + var S0; + var S1; + var s0; + var s1; + var sk; + var i0; + var i1; + var j0; + var j1; + var ia; + var ib; + var ic; + var oa; + var ob; + var k; + + // Note on variable naming convention: S#, da#, db#, dc#, i#, j# where # corresponds to the loop number, with `0` being the innermost loop... + + S0 = N; + S1 = M; + + da0 = strideA2; + db0 = strideB1; + dc0 = strideC2; // offset increment for innermost loop + dc1 = strideC1 - ( S0*strideC2 ); // offset increment for outermost loop + + // Iterate over blocks... + for ( j1 = S1; j1 > 0; ) { + if ( j1 < bsize ) { + s1 = j1; + j1 = 0; + } else { + s1 = bsize; + j1 -= bsize; + } + oa1 = offsetA + ( j1*strideA1 ); + oc1 = offsetC + ( j1*strideC1 ); + for ( j0 = S0; j0 > 0; ) { + if ( j0 < bsize ) { + s0 = j0; + j0 = 0; + } else { + s0 = bsize; + j0 -= bsize; + } + ob0 = offsetB + ( j0*strideB2 ); + + ic = oc1 + ( j0*strideC2 ); // index offset for `C` for the current block + dc1 = strideC1 - ( s0*strideC2 ); // loop offset increment for `C` + + for ( k = K; k > 0; ) { + if ( k < bsize ) { + sk = k; + k = 0; + } else { + sk = bsize; + k -= bsize; + } + oa = oa1 + ( k*strideA2 ); + ob = ob0 + ( k*strideB1 ); + for ( i1 = 0; i1 < s1; i1++ ) { + ia = oa + ( i1*strideA1 ); + for ( i0 = 0; i0 < s0; i0++ ) { + ib = ob + ( i0*strideB2 ); + C[ ic ] += f32( alpha * sdot( sk, A, da0, ia, B, db0, ib ) ); + ic += dc0; + } + ic += dc1; + } + } + } + } + return C; +} + // MAIN // @@ -288,14 +404,10 @@ function naive( M, N, K, alpha, A, strideA1, strideA2, offsetA, B, strideB1, str function sgemm( transA, transB, M, N, K, alpha, A, strideA1, strideA2, offsetA, B, strideB1, strideB2, offsetB, beta, C, strideC1, strideC2, offsetC ) { var isrma; var isrmb; - var isrmc; - var sa0; var sa1; - var sb0; + var sa2; var sb1; - var sc0; - var sc1; - var tmp; + var sb2; // Form: C = β⋅C if ( beta === 0.0 ) { @@ -335,43 +447,23 @@ function sgemm( transA, transB, M, N, K, alpha, A, strideA1, strideA2, offsetA, return naive( M, N, K, alpha, A, strideA2, strideA1, offsetA, B, strideB1, strideB2, offsetB, C, strideC1, strideC2, offsetC ); } } - - isrmc = isRowMajor( [ strideC1, strideC2 ] ); - - if ( isrma ) { // row-major - // For row-major matrices, the last dimension has the fastest changing index... - sa0 = strideA2; // stride for innermost loop - sa1 = strideA1; // stride for outermost loop - } else { // column-major - // For column-major matrices, the first dimension has the fastest changing index... - sa0 = strideA1; // stride for innermost loop - sa1 = strideA2; // stride for outermost loop + // Swap strides to perform transposes... + if ( isTransposed( transA ) ) { + sa1 = strideA2; + sa2 = strideA1; + } else { + sa1 = strideA1; + sa2 = strideA2; } - if ( transA !== 'no-transpose' ) { - tmp = sa0; - sa0 = sa1; - sa1 = tmp; - } - if ( isrmb ) { // row-major - sb0 = strideB2; // stride for innermost loop - sb1 = strideB1; // stride for outermost loop - } else { // column-major - sb0 = strideB1; // stride for innermost loop - sb1 = strideB2; // stride for outermost loop + if ( isTransposed( transB ) ) { + sb1 = strideB2; + sb2 = strideB1; + } else { + sb1 = strideB1; + sb2 = strideB2; } - if ( transB !== 'non-transpose' ) { - tmp = sb0; - sb0 = sb1; - sb1 = tmp; - } - if ( isrmc ) { // row-major - sc0 = strideC2; // stride for innermost loop - sc1 = strideC1; // stride for outermost loop - } else { // column-major - sc0 = strideC1; // stride for innermost loop - sc1 = strideC2; // stride for outermost loop - } - + // Perform loop tiling to promote cache locality: + return blocked( M, N, K, alpha, A, sa1, sa2, offsetA, B, sb1, sb2, offsetB, C, strideC1, strideC2, offsetC ); } From 6a8041fd5b85720c6ec536a9b5ddf2c7c5b2cbc8 Mon Sep 17 00:00:00 2001 From: Athan Reines Date: Fri, 9 Aug 2024 02:53:22 -0700 Subject: [PATCH 06/26] fix: update transpose literal --- lib/node_modules/@stdlib/blas/base/sgemm/examples/index.js | 2 +- lib/node_modules/@stdlib/blas/base/sgemm/lib/sgemm.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/examples/index.js b/lib/node_modules/@stdlib/blas/base/sgemm/examples/index.js index 067bc52c1348..1649c2ee3aad 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/examples/index.js +++ b/lib/node_modules/@stdlib/blas/base/sgemm/examples/index.js @@ -53,5 +53,5 @@ var Float32Array = require('@stdlib/array/float32'); var A = new Float32Array([1, 4, 2, 5, 3, 6 ]); var B = new Float32Array([ 1, 5, 2, 6, 3, 7, 4, 8 ]); var C = new Float32Array([0,0,0,0,0,0,0,0,0,0,0,0]); -sgemm( 'row-major', 'none', 'transpose', 3, 4, 2, 1.0, A, 2, B, 2, 1.0, C, 4 ); +sgemm( 'row-major', 'no-transpose', 'transpose', 3, 4, 2, 1.0, A, 2, B, 2, 1.0, C, 4 ); console.log( C ); diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/lib/sgemm.js b/lib/node_modules/@stdlib/blas/base/sgemm/lib/sgemm.js index 0c61268092d1..6d66aa94e403 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/lib/sgemm.js +++ b/lib/node_modules/@stdlib/blas/base/sgemm/lib/sgemm.js @@ -95,12 +95,12 @@ function sgemm( order, transA, transB, M, N, K, alpha, A, LDA, B, LDB, beta, C, if ( K < 0 ) { throw new RangeError( format( 'invalid argument. Sixth argument must be a nonnegative integer. Value: `%d`.', K ) ); } - if ( transA === 'none' ) { + if ( transA === 'no-transpose' ) { nrowsa = K; } else { nrowsa = M; } - if ( transB === 'none' ) { + if ( transB === 'no-transpose' ) { nrowsb = N; } else { nrowsb = K; From bab523b8ec042aeed2a12471941363cedeb8b364 Mon Sep 17 00:00:00 2001 From: Athan Reines Date: Fri, 9 Aug 2024 03:02:10 -0700 Subject: [PATCH 07/26] docs: update example --- .../@stdlib/blas/base/sgemm/examples/index.js | 40 +++++-------------- 1 file changed, 10 insertions(+), 30 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/examples/index.js b/lib/node_modules/@stdlib/blas/base/sgemm/examples/index.js index 1649c2ee3aad..0acb03081a7f 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/examples/index.js +++ b/lib/node_modules/@stdlib/blas/base/sgemm/examples/index.js @@ -21,37 +21,17 @@ var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); var sgemm = require( './../lib' ); -// var opts = { -// 'dtype': 'float32' -// }; +var opts = { + 'dtype': 'float32' +}; -// var M = 3; -// var N = 3; +var M = 3; +var N = 4; +var K = 2; -// var A = discreteUniform( M*N, 0, 255, opts ); -// var x = discreteUniform( N, 0, 255, opts ); -// var y = discreteUniform( M, 0, 255, opts ); +var A = discreteUniform( M*K, 0, 10, opts ); // 3x2 +var B = discreteUniform( K*N, 0, 10, opts ); // 2x4 +var C = discreteUniform( M*N, 0, 10, opts ); // 3x4 -// sgemv.ndarray( 'row-major', 'none', M, N, 1.0, A, N, x, -1, 2, 1.0, y, -1, 2 ); -// console.log( y ); -// int order = 102; -// int transA = 112; -// int transB = 112; -// int M = 1; -// int N = 2; -// int K = 4; -// float alpha = 0.1f; -// float beta = 1.0f; -// float A[] = { -0.753f, -0.074f, -0.247f, -0.19f }; -// int lda = 4; -// float B[] = { 0.061f, 0.743f, 0.22f, -0.682f, 0.733f, 0.417f, 0.772f, 0.665f }; -// int ldb = 2; -// float C[] = { -0.253f, 0.972f }; -// int ldc = 1; -// float C_expected[] = { -0.291994f, 0.898164f }; -var Float32Array = require('@stdlib/array/float32'); -var A = new Float32Array([1, 4, 2, 5, 3, 6 ]); -var B = new Float32Array([ 1, 5, 2, 6, 3, 7, 4, 8 ]); -var C = new Float32Array([0,0,0,0,0,0,0,0,0,0,0,0]); -sgemm( 'row-major', 'no-transpose', 'transpose', 3, 4, 2, 1.0, A, 2, B, 2, 1.0, C, 4 ); +sgemm( 'row-major', 'no-transpose', 'no-transpose', M, N, K, 1.0, A, K, B, N, 1.0, C, N ); console.log( C ); From 50ff368f410cfdfe02d631366dc599918cbfc361 Mon Sep 17 00:00:00 2001 From: aman-095 Date: Sat, 10 Aug 2024 12:21:11 +0530 Subject: [PATCH 08/26] bench: add benchmark for native and ndarray implementation --- .../blas/base/sgemm/benchmark/benchmark.js | 0 .../benchmark_ca_cb_cc_nta_ntb.ndarray.js | 105 ++++++++++++++++++ .../benchmark_ca_cb_cc_nta_tb.ndarray.js | 105 ++++++++++++++++++ .../benchmark_ca_cb_cc_ta_ntb.ndarray.js | 105 ++++++++++++++++++ .../benchmark_ca_cb_cc_ta_tb.ndarray.js | 105 ++++++++++++++++++ .../benchmark_ca_cb_rc_nta_ntb.ndarray.js | 105 ++++++++++++++++++ .../benchmark_ca_cb_rc_nta_tb.ndarray.js | 105 ++++++++++++++++++ .../benchmark_ca_cb_rc_ta_ntb.ndarray.js | 105 ++++++++++++++++++ .../benchmark_ca_cb_rc_ta_tb.ndarray.js | 105 ++++++++++++++++++ .../benchmark_ca_rb_cc_nta_ntb.ndarray.js | 105 ++++++++++++++++++ .../benchmark_ca_rb_cc_nta_tb.ndarray.js | 105 ++++++++++++++++++ .../benchmark_ca_rb_cc_ta_ntb.ndarray.js | 105 ++++++++++++++++++ .../benchmark_ca_rb_cc_ta_tb.ndarray.js | 105 ++++++++++++++++++ .../benchmark_ca_rb_rc_nta_ntb.ndarray.js | 105 ++++++++++++++++++ .../benchmark_ca_rb_rc_nta_tb.ndarray.js | 105 ++++++++++++++++++ .../benchmark_ca_rb_rc_ta_ntb.ndarray.js | 105 ++++++++++++++++++ .../benchmark_ca_rb_rc_ta_tb.ndarray.js | 105 ++++++++++++++++++ .../benchmark_column_major_nta_ntb.js | 105 ++++++++++++++++++ .../benchmark_column_major_nta_tb.js | 105 ++++++++++++++++++ .../benchmark_column_major_ta_ntb.js | 105 ++++++++++++++++++ .../benchmark/benchmark_column_major_ta_tb.js | 105 ++++++++++++++++++ .../benchmark_ra_cb_cc_nta_ntb.ndarray.js | 105 ++++++++++++++++++ .../benchmark_ra_cb_cc_nta_tb.ndarray.js | 105 ++++++++++++++++++ .../benchmark_ra_cb_cc_ta_ntb.ndarray.js | 105 ++++++++++++++++++ .../benchmark_ra_cb_cc_ta_tb.ndarray.js | 105 ++++++++++++++++++ .../benchmark_ra_cb_rc_nta_ntb.ndarray.js | 105 ++++++++++++++++++ .../benchmark_ra_cb_rc_nta_tb.ndarray.js | 105 ++++++++++++++++++ .../benchmark_ra_cb_rc_ta_ntb.ndarray.js | 105 ++++++++++++++++++ .../benchmark_ra_cb_rc_ta_tb.ndarray.js | 105 ++++++++++++++++++ .../benchmark_ra_rb_cc_nta_ntb.ndarray.js | 105 ++++++++++++++++++ .../benchmark_ra_rb_cc_nta_tb.ndarray.js | 105 ++++++++++++++++++ .../benchmark_ra_rb_cc_ta_ntb.ndarray.js | 105 ++++++++++++++++++ .../benchmark_ra_rb_cc_ta_tb.ndarray.js | 105 ++++++++++++++++++ .../benchmark_ra_rb_rc_nta_ntb.ndarray.js | 105 ++++++++++++++++++ .../benchmark_ra_rb_rc_nta_tb.ndarray.js | 105 ++++++++++++++++++ .../benchmark_ra_rb_rc_ta_ntb.ndarray.js | 105 ++++++++++++++++++ .../benchmark_ra_rb_rc_ta_tb.ndarray.js | 105 ++++++++++++++++++ .../benchmark/benchmark_row_major_nta_ntb.js | 105 ++++++++++++++++++ .../benchmark/benchmark_row_major_nta_tb.js | 105 ++++++++++++++++++ .../benchmark/benchmark_row_major_ta_ntb.js | 105 ++++++++++++++++++ .../benchmark/benchmark_row_major_ta_tb.js | 105 ++++++++++++++++++ 41 files changed, 4200 insertions(+) delete mode 100644 lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark.js create mode 100644 lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_cb_cc_nta_ntb.ndarray.js create mode 100644 lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_cb_cc_nta_tb.ndarray.js create mode 100644 lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_cb_cc_ta_ntb.ndarray.js create mode 100644 lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_cb_cc_ta_tb.ndarray.js create mode 100644 lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_cb_rc_nta_ntb.ndarray.js create mode 100644 lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_cb_rc_nta_tb.ndarray.js create mode 100644 lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_cb_rc_ta_ntb.ndarray.js create mode 100644 lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_cb_rc_ta_tb.ndarray.js create mode 100644 lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_rb_cc_nta_ntb.ndarray.js create mode 100644 lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_rb_cc_nta_tb.ndarray.js create mode 100644 lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_rb_cc_ta_ntb.ndarray.js create mode 100644 lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_rb_cc_ta_tb.ndarray.js create mode 100644 lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_rb_rc_nta_ntb.ndarray.js create mode 100644 lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_rb_rc_nta_tb.ndarray.js create mode 100644 lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_rb_rc_ta_ntb.ndarray.js create mode 100644 lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_rb_rc_ta_tb.ndarray.js create mode 100644 lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_column_major_nta_ntb.js create mode 100644 lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_column_major_nta_tb.js create mode 100644 lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_column_major_ta_ntb.js create mode 100644 lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_column_major_ta_tb.js create mode 100644 lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_cb_cc_nta_ntb.ndarray.js create mode 100644 lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_cb_cc_nta_tb.ndarray.js create mode 100644 lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_cb_cc_ta_ntb.ndarray.js create mode 100644 lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_cb_cc_ta_tb.ndarray.js create mode 100644 lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_cb_rc_nta_ntb.ndarray.js create mode 100644 lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_cb_rc_nta_tb.ndarray.js create mode 100644 lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_cb_rc_ta_ntb.ndarray.js create mode 100644 lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_cb_rc_ta_tb.ndarray.js create mode 100644 lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_rb_cc_nta_ntb.ndarray.js create mode 100644 lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_rb_cc_nta_tb.ndarray.js create mode 100644 lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_rb_cc_ta_ntb.ndarray.js create mode 100644 lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_rb_cc_ta_tb.ndarray.js create mode 100644 lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_rb_rc_nta_ntb.ndarray.js create mode 100644 lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_rb_rc_nta_tb.ndarray.js create mode 100644 lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_rb_rc_ta_ntb.ndarray.js create mode 100644 lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_rb_rc_ta_tb.ndarray.js create mode 100644 lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_row_major_nta_ntb.js create mode 100644 lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_row_major_nta_tb.js create mode 100644 lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_row_major_ta_ntb.js create mode 100644 lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_row_major_ta_tb.js diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark.js deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_cb_cc_nta_ntb.ndarray.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_cb_cc_nta_ntb.ndarray.js new file mode 100644 index 000000000000..1647ba6109b7 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_cb_cc_nta_ntb.ndarray.js @@ -0,0 +1,105 @@ +/** +* @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 isnanf = require( '@stdlib/math/base/assert/is-nanf' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var pkg = require( './../package.json' ).name; +var sgemm = require( './../lib/ndarray.js' ); + + +// VARIABLES // + +var options = { + 'dtype': 'float32' +}; + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} N - array dimension size +* @returns {Function} benchmark function +*/ +function createBenchmark( N ) { + var A = uniform( N*N, -10.0, 10.0, options ); + var B = uniform( N*N, -10.0, 10.0, options ); + var C = uniform( N*N, -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 = sgemm( 'no-transpose', 'no-transpose', N, N, N, 1.0, A, 1, N, 0, B, 1, N, 0, 1.0, C, 1, N, 0 ); + if ( isnanf( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnanf( 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 = 6; // 10^max + + for ( i = min; i <= max; i++ ) { + len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + f = createBenchmark( len ); + bench( pkg+':ndarray:size='+(len*len), f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_cb_cc_nta_tb.ndarray.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_cb_cc_nta_tb.ndarray.js new file mode 100644 index 000000000000..c0c368d2c73b --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_cb_cc_nta_tb.ndarray.js @@ -0,0 +1,105 @@ +/** +* @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 isnanf = require( '@stdlib/math/base/assert/is-nanf' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var pkg = require( './../package.json' ).name; +var sgemm = require( './../lib/ndarray.js' ); + + +// VARIABLES // + +var options = { + 'dtype': 'float32' +}; + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} N - array dimension size +* @returns {Function} benchmark function +*/ +function createBenchmark( N ) { + var A = uniform( N*N, -10.0, 10.0, options ); + var B = uniform( N*N, -10.0, 10.0, options ); + var C = uniform( N*N, -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 = sgemm( 'no-transpose', 'transpose', N, N, N, 1.0, A, 1, N, 0, B, 1, N, 0, 1.0, C, 1, N, 0 ); + if ( isnanf( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnanf( 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 = 6; // 10^max + + for ( i = min; i <= max; i++ ) { + len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + f = createBenchmark( len ); + bench( pkg+':ndarray:size='+(len*len), f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_cb_cc_ta_ntb.ndarray.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_cb_cc_ta_ntb.ndarray.js new file mode 100644 index 000000000000..0f3358f6ec6f --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_cb_cc_ta_ntb.ndarray.js @@ -0,0 +1,105 @@ +/** +* @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 isnanf = require( '@stdlib/math/base/assert/is-nanf' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var pkg = require( './../package.json' ).name; +var sgemm = require( './../lib/ndarray.js' ); + + +// VARIABLES // + +var options = { + 'dtype': 'float32' +}; + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} N - array dimension size +* @returns {Function} benchmark function +*/ +function createBenchmark( N ) { + var A = uniform( N*N, -10.0, 10.0, options ); + var B = uniform( N*N, -10.0, 10.0, options ); + var C = uniform( N*N, -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 = sgemm( 'transpose', 'no-transpose', N, N, N, 1.0, A, 1, N, 0, B, 1, N, 0, 1.0, C, 1, N, 0 ); + if ( isnanf( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnanf( 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 = 6; // 10^max + + for ( i = min; i <= max; i++ ) { + len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + f = createBenchmark( len ); + bench( pkg+':ndarray:size='+(len*len), f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_cb_cc_ta_tb.ndarray.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_cb_cc_ta_tb.ndarray.js new file mode 100644 index 000000000000..bcbc12778f56 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_cb_cc_ta_tb.ndarray.js @@ -0,0 +1,105 @@ +/** +* @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 isnanf = require( '@stdlib/math/base/assert/is-nanf' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var pkg = require( './../package.json' ).name; +var sgemm = require( './../lib/ndarray.js' ); + + +// VARIABLES // + +var options = { + 'dtype': 'float32' +}; + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} N - array dimension size +* @returns {Function} benchmark function +*/ +function createBenchmark( N ) { + var A = uniform( N*N, -10.0, 10.0, options ); + var B = uniform( N*N, -10.0, 10.0, options ); + var C = uniform( N*N, -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 = sgemm( 'transpose', 'transpose', N, N, N, 1.0, A, 1, N, 0, B, 1, N, 0, 1.0, C, 1, N, 0 ); + if ( isnanf( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnanf( 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 = 6; // 10^max + + for ( i = min; i <= max; i++ ) { + len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + f = createBenchmark( len ); + bench( pkg+':ndarray:size='+(len*len), f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_cb_rc_nta_ntb.ndarray.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_cb_rc_nta_ntb.ndarray.js new file mode 100644 index 000000000000..2ed48a2e2acc --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_cb_rc_nta_ntb.ndarray.js @@ -0,0 +1,105 @@ +/** +* @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 isnanf = require( '@stdlib/math/base/assert/is-nanf' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var pkg = require( './../package.json' ).name; +var sgemm = require( './../lib/ndarray.js' ); + + +// VARIABLES // + +var options = { + 'dtype': 'float32' +}; + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} N - array dimension size +* @returns {Function} benchmark function +*/ +function createBenchmark( N ) { + var A = uniform( N*N, -10.0, 10.0, options ); + var B = uniform( N*N, -10.0, 10.0, options ); + var C = uniform( N*N, -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 = sgemm( 'no-transpose', 'no-transpose', N, N, N, 1.0, A, 1, N, 0, B, 1, N, 0, 1.0, C, N, 1, 0 ); + if ( isnanf( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnanf( 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 = 6; // 10^max + + for ( i = min; i <= max; i++ ) { + len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + f = createBenchmark( len ); + bench( pkg+':ndarray:size='+(len*len), f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_cb_rc_nta_tb.ndarray.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_cb_rc_nta_tb.ndarray.js new file mode 100644 index 000000000000..3b0916a2ed6c --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_cb_rc_nta_tb.ndarray.js @@ -0,0 +1,105 @@ +/** +* @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 isnanf = require( '@stdlib/math/base/assert/is-nanf' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var pkg = require( './../package.json' ).name; +var sgemm = require( './../lib/ndarray.js' ); + + +// VARIABLES // + +var options = { + 'dtype': 'float32' +}; + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} N - array dimension size +* @returns {Function} benchmark function +*/ +function createBenchmark( N ) { + var A = uniform( N*N, -10.0, 10.0, options ); + var B = uniform( N*N, -10.0, 10.0, options ); + var C = uniform( N*N, -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 = sgemm( 'no-transpose', 'transpose', N, N, N, 1.0, A, 1, N, 0, B, 1, N, 0, 1.0, C, N, 1, 0 ); + if ( isnanf( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnanf( 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 = 6; // 10^max + + for ( i = min; i <= max; i++ ) { + len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + f = createBenchmark( len ); + bench( pkg+':ndarray:size='+(len*len), f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_cb_rc_ta_ntb.ndarray.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_cb_rc_ta_ntb.ndarray.js new file mode 100644 index 000000000000..e317af3acea4 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_cb_rc_ta_ntb.ndarray.js @@ -0,0 +1,105 @@ +/** +* @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 isnanf = require( '@stdlib/math/base/assert/is-nanf' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var pkg = require( './../package.json' ).name; +var sgemm = require( './../lib/ndarray.js' ); + + +// VARIABLES // + +var options = { + 'dtype': 'float32' +}; + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} N - array dimension size +* @returns {Function} benchmark function +*/ +function createBenchmark( N ) { + var A = uniform( N*N, -10.0, 10.0, options ); + var B = uniform( N*N, -10.0, 10.0, options ); + var C = uniform( N*N, -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 = sgemm( 'transpose', 'no-transpose', N, N, N, 1.0, A, 1, N, 0, B, 1, N, 0, 1.0, C, N, 1, 0 ); + if ( isnanf( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnanf( 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 = 6; // 10^max + + for ( i = min; i <= max; i++ ) { + len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + f = createBenchmark( len ); + bench( pkg+':ndarray:size='+(len*len), f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_cb_rc_ta_tb.ndarray.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_cb_rc_ta_tb.ndarray.js new file mode 100644 index 000000000000..4e4a329710eb --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_cb_rc_ta_tb.ndarray.js @@ -0,0 +1,105 @@ +/** +* @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 isnanf = require( '@stdlib/math/base/assert/is-nanf' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var pkg = require( './../package.json' ).name; +var sgemm = require( './../lib/ndarray.js' ); + + +// VARIABLES // + +var options = { + 'dtype': 'float32' +}; + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} N - array dimension size +* @returns {Function} benchmark function +*/ +function createBenchmark( N ) { + var A = uniform( N*N, -10.0, 10.0, options ); + var B = uniform( N*N, -10.0, 10.0, options ); + var C = uniform( N*N, -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 = sgemm( 'transpose', 'transpose', N, N, N, 1.0, A, 1, N, 0, B, 1, N, 0, 1.0, C, N, 1, 0 ); + if ( isnanf( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnanf( 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 = 6; // 10^max + + for ( i = min; i <= max; i++ ) { + len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + f = createBenchmark( len ); + bench( pkg+':ndarray:size='+(len*len), f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_rb_cc_nta_ntb.ndarray.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_rb_cc_nta_ntb.ndarray.js new file mode 100644 index 000000000000..045c35e18d3f --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_rb_cc_nta_ntb.ndarray.js @@ -0,0 +1,105 @@ +/** +* @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 isnanf = require( '@stdlib/math/base/assert/is-nanf' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var pkg = require( './../package.json' ).name; +var sgemm = require( './../lib/ndarray.js' ); + + +// VARIABLES // + +var options = { + 'dtype': 'float32' +}; + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} N - array dimension size +* @returns {Function} benchmark function +*/ +function createBenchmark( N ) { + var A = uniform( N*N, -10.0, 10.0, options ); + var B = uniform( N*N, -10.0, 10.0, options ); + var C = uniform( N*N, -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 = sgemm( 'no-transpose', 'no-transpose', N, N, N, 1.0, A, 1, N, 0, B, N, 1, 0, 1.0, C, 1, N, 0 ); + if ( isnanf( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnanf( 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 = 6; // 10^max + + for ( i = min; i <= max; i++ ) { + len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + f = createBenchmark( len ); + bench( pkg+':ndarray:size='+(len*len), f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_rb_cc_nta_tb.ndarray.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_rb_cc_nta_tb.ndarray.js new file mode 100644 index 000000000000..c200b407ffcb --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_rb_cc_nta_tb.ndarray.js @@ -0,0 +1,105 @@ +/** +* @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 isnanf = require( '@stdlib/math/base/assert/is-nanf' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var pkg = require( './../package.json' ).name; +var sgemm = require( './../lib/ndarray.js' ); + + +// VARIABLES // + +var options = { + 'dtype': 'float32' +}; + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} N - array dimension size +* @returns {Function} benchmark function +*/ +function createBenchmark( N ) { + var A = uniform( N*N, -10.0, 10.0, options ); + var B = uniform( N*N, -10.0, 10.0, options ); + var C = uniform( N*N, -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 = sgemm( 'no-transpose', 'transpose', N, N, N, 1.0, A, 1, N, 0, B, N, 1, 0, 1.0, C, 1, N, 0 ); + if ( isnanf( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnanf( 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 = 6; // 10^max + + for ( i = min; i <= max; i++ ) { + len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + f = createBenchmark( len ); + bench( pkg+':ndarray:size='+(len*len), f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_rb_cc_ta_ntb.ndarray.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_rb_cc_ta_ntb.ndarray.js new file mode 100644 index 000000000000..2fd160655189 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_rb_cc_ta_ntb.ndarray.js @@ -0,0 +1,105 @@ +/** +* @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 isnanf = require( '@stdlib/math/base/assert/is-nanf' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var pkg = require( './../package.json' ).name; +var sgemm = require( './../lib/ndarray.js' ); + + +// VARIABLES // + +var options = { + 'dtype': 'float32' +}; + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} N - array dimension size +* @returns {Function} benchmark function +*/ +function createBenchmark( N ) { + var A = uniform( N*N, -10.0, 10.0, options ); + var B = uniform( N*N, -10.0, 10.0, options ); + var C = uniform( N*N, -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 = sgemm( 'transpose', 'no-transpose', N, N, N, 1.0, A, 1, N, 0, B, N, 1, 0, 1.0, C, 1, N, 0 ); + if ( isnanf( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnanf( 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 = 6; // 10^max + + for ( i = min; i <= max; i++ ) { + len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + f = createBenchmark( len ); + bench( pkg+':ndarray:size='+(len*len), f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_rb_cc_ta_tb.ndarray.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_rb_cc_ta_tb.ndarray.js new file mode 100644 index 000000000000..3cbc1a0a5023 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_rb_cc_ta_tb.ndarray.js @@ -0,0 +1,105 @@ +/** +* @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 isnanf = require( '@stdlib/math/base/assert/is-nanf' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var pkg = require( './../package.json' ).name; +var sgemm = require( './../lib/ndarray.js' ); + + +// VARIABLES // + +var options = { + 'dtype': 'float32' +}; + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} N - array dimension size +* @returns {Function} benchmark function +*/ +function createBenchmark( N ) { + var A = uniform( N*N, -10.0, 10.0, options ); + var B = uniform( N*N, -10.0, 10.0, options ); + var C = uniform( N*N, -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 = sgemm( 'transpose', 'transpose', N, N, N, 1.0, A, 1, N, 0, B, N, 1, 0, 1.0, C, 1, N, 0 ); + if ( isnanf( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnanf( 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 = 6; // 10^max + + for ( i = min; i <= max; i++ ) { + len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + f = createBenchmark( len ); + bench( pkg+':ndarray:size='+(len*len), f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_rb_rc_nta_ntb.ndarray.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_rb_rc_nta_ntb.ndarray.js new file mode 100644 index 000000000000..45ba997539c7 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_rb_rc_nta_ntb.ndarray.js @@ -0,0 +1,105 @@ +/** +* @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 isnanf = require( '@stdlib/math/base/assert/is-nanf' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var pkg = require( './../package.json' ).name; +var sgemm = require( './../lib/ndarray.js' ); + + +// VARIABLES // + +var options = { + 'dtype': 'float32' +}; + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} N - array dimension size +* @returns {Function} benchmark function +*/ +function createBenchmark( N ) { + var A = uniform( N*N, -10.0, 10.0, options ); + var B = uniform( N*N, -10.0, 10.0, options ); + var C = uniform( N*N, -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 = sgemm( 'no-transpose', 'no-transpose', N, N, N, 1.0, A, 1, N, 0, B, N, 1, 0, 1.0, C, N, 1, 0 ); + if ( isnanf( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnanf( 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 = 6; // 10^max + + for ( i = min; i <= max; i++ ) { + len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + f = createBenchmark( len ); + bench( pkg+':ndarray:size='+(len*len), f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_rb_rc_nta_tb.ndarray.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_rb_rc_nta_tb.ndarray.js new file mode 100644 index 000000000000..f3a1d24699fa --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_rb_rc_nta_tb.ndarray.js @@ -0,0 +1,105 @@ +/** +* @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 isnanf = require( '@stdlib/math/base/assert/is-nanf' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var pkg = require( './../package.json' ).name; +var sgemm = require( './../lib/ndarray.js' ); + + +// VARIABLES // + +var options = { + 'dtype': 'float32' +}; + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} N - array dimension size +* @returns {Function} benchmark function +*/ +function createBenchmark( N ) { + var A = uniform( N*N, -10.0, 10.0, options ); + var B = uniform( N*N, -10.0, 10.0, options ); + var C = uniform( N*N, -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 = sgemm( 'no-transpose', 'transpose', N, N, N, 1.0, A, 1, N, 0, B, N, 1, 0, 1.0, C, N, 1, 0 ); + if ( isnanf( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnanf( 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 = 6; // 10^max + + for ( i = min; i <= max; i++ ) { + len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + f = createBenchmark( len ); + bench( pkg+':ndarray:size='+(len*len), f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_rb_rc_ta_ntb.ndarray.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_rb_rc_ta_ntb.ndarray.js new file mode 100644 index 000000000000..28b32b952a7e --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_rb_rc_ta_ntb.ndarray.js @@ -0,0 +1,105 @@ +/** +* @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 isnanf = require( '@stdlib/math/base/assert/is-nanf' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var pkg = require( './../package.json' ).name; +var sgemm = require( './../lib/ndarray.js' ); + + +// VARIABLES // + +var options = { + 'dtype': 'float32' +}; + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} N - array dimension size +* @returns {Function} benchmark function +*/ +function createBenchmark( N ) { + var A = uniform( N*N, -10.0, 10.0, options ); + var B = uniform( N*N, -10.0, 10.0, options ); + var C = uniform( N*N, -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 = sgemm( 'transpose', 'no-transpose', N, N, N, 1.0, A, 1, N, 0, B, N, 1, 0, 1.0, C, N, 1, 0 ); + if ( isnanf( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnanf( 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 = 6; // 10^max + + for ( i = min; i <= max; i++ ) { + len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + f = createBenchmark( len ); + bench( pkg+':ndarray:size='+(len*len), f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_rb_rc_ta_tb.ndarray.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_rb_rc_ta_tb.ndarray.js new file mode 100644 index 000000000000..f2928e08cd03 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_rb_rc_ta_tb.ndarray.js @@ -0,0 +1,105 @@ +/** +* @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 isnanf = require( '@stdlib/math/base/assert/is-nanf' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var pkg = require( './../package.json' ).name; +var sgemm = require( './../lib/ndarray.js' ); + + +// VARIABLES // + +var options = { + 'dtype': 'float32' +}; + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} N - array dimension size +* @returns {Function} benchmark function +*/ +function createBenchmark( N ) { + var A = uniform( N*N, -10.0, 10.0, options ); + var B = uniform( N*N, -10.0, 10.0, options ); + var C = uniform( N*N, -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 = sgemm( 'transpose', 'transpose', N, N, N, 1.0, A, 1, N, 0, B, N, 1, 0, 1.0, C, N, 1, 0 ); + if ( isnanf( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnanf( 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 = 6; // 10^max + + for ( i = min; i <= max; i++ ) { + len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + f = createBenchmark( len ); + bench( pkg+':ndarray:size='+(len*len), f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_column_major_nta_ntb.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_column_major_nta_ntb.js new file mode 100644 index 000000000000..36c38ee6d044 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_column_major_nta_ntb.js @@ -0,0 +1,105 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2024 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var uniform = require( '@stdlib/random/array/uniform' ); +var isnanf = require( '@stdlib/math/base/assert/is-nanf' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var pkg = require( './../package.json' ).name; +var sgemm = require( './../lib/sgemm.js' ); + + +// VARIABLES // + +var options = { + 'dtype': 'float32' +}; + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} N - array dimension size +* @returns {Function} benchmark function +*/ +function createBenchmark( N ) { + var A = uniform( N*N, -10.0, 10.0, options ); + var B = uniform( N*N, -10.0, 10.0, options ); + var C = uniform( N*N, -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 = sgemm( 'column-major', 'no-transpose', 'no-transpose', N, N, N, 1.0, A, N, B, N, 1.0, C, N ); + if ( isnanf( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnanf( 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 = 6; // 10^max + + for ( i = min; i <= max; i++ ) { + len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + f = createBenchmark( len ); + bench( pkg+':size='+(len*len), f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_column_major_nta_tb.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_column_major_nta_tb.js new file mode 100644 index 000000000000..7b26c84d4b42 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_column_major_nta_tb.js @@ -0,0 +1,105 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2024 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var uniform = require( '@stdlib/random/array/uniform' ); +var isnanf = require( '@stdlib/math/base/assert/is-nanf' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var pkg = require( './../package.json' ).name; +var sgemm = require( './../lib/sgemm.js' ); + + +// VARIABLES // + +var options = { + 'dtype': 'float32' +}; + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} N - array dimension size +* @returns {Function} benchmark function +*/ +function createBenchmark( N ) { + var A = uniform( N*N, -10.0, 10.0, options ); + var B = uniform( N*N, -10.0, 10.0, options ); + var C = uniform( N*N, -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 = sgemm( 'column-major', 'no-transpose', 'transpose', N, N, N, 1.0, A, N, B, N, 1.0, C, N ); + if ( isnanf( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnanf( 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 = 6; // 10^max + + for ( i = min; i <= max; i++ ) { + len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + f = createBenchmark( len ); + bench( pkg+':size='+(len*len), f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_column_major_ta_ntb.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_column_major_ta_ntb.js new file mode 100644 index 000000000000..caacdf0d4452 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_column_major_ta_ntb.js @@ -0,0 +1,105 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2024 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var uniform = require( '@stdlib/random/array/uniform' ); +var isnanf = require( '@stdlib/math/base/assert/is-nanf' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var pkg = require( './../package.json' ).name; +var sgemm = require( './../lib/sgemm.js' ); + + +// VARIABLES // + +var options = { + 'dtype': 'float32' +}; + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} N - array dimension size +* @returns {Function} benchmark function +*/ +function createBenchmark( N ) { + var A = uniform( N*N, -10.0, 10.0, options ); + var B = uniform( N*N, -10.0, 10.0, options ); + var C = uniform( N*N, -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 = sgemm( 'column-major', 'transpose', 'no-transpose', N, N, N, 1.0, A, N, B, N, 1.0, C, N ); + if ( isnanf( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnanf( 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 = 6; // 10^max + + for ( i = min; i <= max; i++ ) { + len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + f = createBenchmark( len ); + bench( pkg+':size='+(len*len), f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_column_major_ta_tb.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_column_major_ta_tb.js new file mode 100644 index 000000000000..6f627eb4174d --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_column_major_ta_tb.js @@ -0,0 +1,105 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2024 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var uniform = require( '@stdlib/random/array/uniform' ); +var isnanf = require( '@stdlib/math/base/assert/is-nanf' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var pkg = require( './../package.json' ).name; +var sgemm = require( './../lib/sgemm.js' ); + + +// VARIABLES // + +var options = { + 'dtype': 'float32' +}; + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} N - array dimension size +* @returns {Function} benchmark function +*/ +function createBenchmark( N ) { + var A = uniform( N*N, -10.0, 10.0, options ); + var B = uniform( N*N, -10.0, 10.0, options ); + var C = uniform( N*N, -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 = sgemm( 'column-major', 'transpose', 'transpose', N, N, N, 1.0, A, N, B, N, 1.0, C, N ); + if ( isnanf( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnanf( 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 = 6; // 10^max + + for ( i = min; i <= max; i++ ) { + len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + f = createBenchmark( len ); + bench( pkg+':size='+(len*len), f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_cb_cc_nta_ntb.ndarray.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_cb_cc_nta_ntb.ndarray.js new file mode 100644 index 000000000000..ddbd75501bf7 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_cb_cc_nta_ntb.ndarray.js @@ -0,0 +1,105 @@ +/** +* @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 isnanf = require( '@stdlib/math/base/assert/is-nanf' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var pkg = require( './../package.json' ).name; +var sgemm = require( './../lib/ndarray.js' ); + + +// VARIABLES // + +var options = { + 'dtype': 'float32' +}; + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} N - array dimension size +* @returns {Function} benchmark function +*/ +function createBenchmark( N ) { + var A = uniform( N*N, -10.0, 10.0, options ); + var B = uniform( N*N, -10.0, 10.0, options ); + var C = uniform( N*N, -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 = sgemm( 'no-transpose', 'no-transpose', N, N, N, 1.0, A, N, 1, 0, B, 1, N, 0, 1.0, C, 1, N, 0 ); + if ( isnanf( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnanf( 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 = 6; // 10^max + + for ( i = min; i <= max; i++ ) { + len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + f = createBenchmark( len ); + bench( pkg+':ndarray:size='+(len*len), f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_cb_cc_nta_tb.ndarray.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_cb_cc_nta_tb.ndarray.js new file mode 100644 index 000000000000..c0e0485bf611 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_cb_cc_nta_tb.ndarray.js @@ -0,0 +1,105 @@ +/** +* @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 isnanf = require( '@stdlib/math/base/assert/is-nanf' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var pkg = require( './../package.json' ).name; +var sgemm = require( './../lib/ndarray.js' ); + + +// VARIABLES // + +var options = { + 'dtype': 'float32' +}; + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} N - array dimension size +* @returns {Function} benchmark function +*/ +function createBenchmark( N ) { + var A = uniform( N*N, -10.0, 10.0, options ); + var B = uniform( N*N, -10.0, 10.0, options ); + var C = uniform( N*N, -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 = sgemm( 'no-transpose', 'transpose', N, N, N, 1.0, A, N, 1, 0, B, 1, N, 0, 1.0, C, 1, N, 0 ); + if ( isnanf( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnanf( 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 = 6; // 10^max + + for ( i = min; i <= max; i++ ) { + len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + f = createBenchmark( len ); + bench( pkg+':ndarray:size='+(len*len), f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_cb_cc_ta_ntb.ndarray.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_cb_cc_ta_ntb.ndarray.js new file mode 100644 index 000000000000..5d851e4e8120 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_cb_cc_ta_ntb.ndarray.js @@ -0,0 +1,105 @@ +/** +* @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 isnanf = require( '@stdlib/math/base/assert/is-nanf' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var pkg = require( './../package.json' ).name; +var sgemm = require( './../lib/ndarray.js' ); + + +// VARIABLES // + +var options = { + 'dtype': 'float32' +}; + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} N - array dimension size +* @returns {Function} benchmark function +*/ +function createBenchmark( N ) { + var A = uniform( N*N, -10.0, 10.0, options ); + var B = uniform( N*N, -10.0, 10.0, options ); + var C = uniform( N*N, -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 = sgemm( 'transpose', 'no-transpose', N, N, N, 1.0, A, N, 1, 0, B, 1, N, 0, 1.0, C, 1, N, 0 ); + if ( isnanf( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnanf( 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 = 6; // 10^max + + for ( i = min; i <= max; i++ ) { + len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + f = createBenchmark( len ); + bench( pkg+':ndarray:size='+(len*len), f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_cb_cc_ta_tb.ndarray.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_cb_cc_ta_tb.ndarray.js new file mode 100644 index 000000000000..57baf31d728c --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_cb_cc_ta_tb.ndarray.js @@ -0,0 +1,105 @@ +/** +* @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 isnanf = require( '@stdlib/math/base/assert/is-nanf' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var pkg = require( './../package.json' ).name; +var sgemm = require( './../lib/ndarray.js' ); + + +// VARIABLES // + +var options = { + 'dtype': 'float32' +}; + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} N - array dimension size +* @returns {Function} benchmark function +*/ +function createBenchmark( N ) { + var A = uniform( N*N, -10.0, 10.0, options ); + var B = uniform( N*N, -10.0, 10.0, options ); + var C = uniform( N*N, -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 = sgemm( 'transpose', 'transpose', N, N, N, 1.0, A, N, 1, 0, B, 1, N, 0, 1.0, C, 1, N, 0 ); + if ( isnanf( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnanf( 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 = 6; // 10^max + + for ( i = min; i <= max; i++ ) { + len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + f = createBenchmark( len ); + bench( pkg+':ndarray:size='+(len*len), f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_cb_rc_nta_ntb.ndarray.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_cb_rc_nta_ntb.ndarray.js new file mode 100644 index 000000000000..696bfcdc404a --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_cb_rc_nta_ntb.ndarray.js @@ -0,0 +1,105 @@ +/** +* @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 isnanf = require( '@stdlib/math/base/assert/is-nanf' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var pkg = require( './../package.json' ).name; +var sgemm = require( './../lib/ndarray.js' ); + + +// VARIABLES // + +var options = { + 'dtype': 'float32' +}; + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} N - array dimension size +* @returns {Function} benchmark function +*/ +function createBenchmark( N ) { + var A = uniform( N*N, -10.0, 10.0, options ); + var B = uniform( N*N, -10.0, 10.0, options ); + var C = uniform( N*N, -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 = sgemm( 'no-transpose', 'no-transpose', N, N, N, 1.0, A, N, 1, 0, B, 1, N, 0, 1.0, C, N, 1, 0 ); + if ( isnanf( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnanf( 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 = 6; // 10^max + + for ( i = min; i <= max; i++ ) { + len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + f = createBenchmark( len ); + bench( pkg+':ndarray:size='+(len*len), f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_cb_rc_nta_tb.ndarray.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_cb_rc_nta_tb.ndarray.js new file mode 100644 index 000000000000..a8d80058da8a --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_cb_rc_nta_tb.ndarray.js @@ -0,0 +1,105 @@ +/** +* @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 isnanf = require( '@stdlib/math/base/assert/is-nanf' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var pkg = require( './../package.json' ).name; +var sgemm = require( './../lib/ndarray.js' ); + + +// VARIABLES // + +var options = { + 'dtype': 'float32' +}; + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} N - array dimension size +* @returns {Function} benchmark function +*/ +function createBenchmark( N ) { + var A = uniform( N*N, -10.0, 10.0, options ); + var B = uniform( N*N, -10.0, 10.0, options ); + var C = uniform( N*N, -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 = sgemm( 'no-transpose', 'transpose', N, N, N, 1.0, A, N, 1, 0, B, 1, N, 0, 1.0, C, N, 1, 0 ); + if ( isnanf( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnanf( 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 = 6; // 10^max + + for ( i = min; i <= max; i++ ) { + len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + f = createBenchmark( len ); + bench( pkg+':ndarray:size='+(len*len), f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_cb_rc_ta_ntb.ndarray.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_cb_rc_ta_ntb.ndarray.js new file mode 100644 index 000000000000..17d73ed5f066 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_cb_rc_ta_ntb.ndarray.js @@ -0,0 +1,105 @@ +/** +* @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 isnanf = require( '@stdlib/math/base/assert/is-nanf' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var pkg = require( './../package.json' ).name; +var sgemm = require( './../lib/ndarray.js' ); + + +// VARIABLES // + +var options = { + 'dtype': 'float32' +}; + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} N - array dimension size +* @returns {Function} benchmark function +*/ +function createBenchmark( N ) { + var A = uniform( N*N, -10.0, 10.0, options ); + var B = uniform( N*N, -10.0, 10.0, options ); + var C = uniform( N*N, -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 = sgemm( 'transpose', 'no-transpose', N, N, N, 1.0, A, N, 1, 0, B, 1, N, 0, 1.0, C, N, 1, 0 ); + if ( isnanf( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnanf( 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 = 6; // 10^max + + for ( i = min; i <= max; i++ ) { + len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + f = createBenchmark( len ); + bench( pkg+':ndarray:size='+(len*len), f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_cb_rc_ta_tb.ndarray.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_cb_rc_ta_tb.ndarray.js new file mode 100644 index 000000000000..d51f51c5a83a --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_cb_rc_ta_tb.ndarray.js @@ -0,0 +1,105 @@ +/** +* @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 isnanf = require( '@stdlib/math/base/assert/is-nanf' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var pkg = require( './../package.json' ).name; +var sgemm = require( './../lib/ndarray.js' ); + + +// VARIABLES // + +var options = { + 'dtype': 'float32' +}; + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} N - array dimension size +* @returns {Function} benchmark function +*/ +function createBenchmark( N ) { + var A = uniform( N*N, -10.0, 10.0, options ); + var B = uniform( N*N, -10.0, 10.0, options ); + var C = uniform( N*N, -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 = sgemm( 'transpose', 'transpose', N, N, N, 1.0, A, N, 1, 0, B, 1, N, 0, 1.0, C, N, 1, 0 ); + if ( isnanf( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnanf( 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 = 6; // 10^max + + for ( i = min; i <= max; i++ ) { + len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + f = createBenchmark( len ); + bench( pkg+':ndarray:size='+(len*len), f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_rb_cc_nta_ntb.ndarray.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_rb_cc_nta_ntb.ndarray.js new file mode 100644 index 000000000000..51687d96259f --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_rb_cc_nta_ntb.ndarray.js @@ -0,0 +1,105 @@ +/** +* @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 isnanf = require( '@stdlib/math/base/assert/is-nanf' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var pkg = require( './../package.json' ).name; +var sgemm = require( './../lib/ndarray.js' ); + + +// VARIABLES // + +var options = { + 'dtype': 'float32' +}; + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} N - array dimension size +* @returns {Function} benchmark function +*/ +function createBenchmark( N ) { + var A = uniform( N*N, -10.0, 10.0, options ); + var B = uniform( N*N, -10.0, 10.0, options ); + var C = uniform( N*N, -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 = sgemm( 'no-transpose', 'no-transpose', N, N, N, 1.0, A, N, 1, 0, B, N, 1, 0, 1.0, C, 1, N, 0 ); + if ( isnanf( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnanf( 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 = 6; // 10^max + + for ( i = min; i <= max; i++ ) { + len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + f = createBenchmark( len ); + bench( pkg+':ndarray:size='+(len*len), f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_rb_cc_nta_tb.ndarray.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_rb_cc_nta_tb.ndarray.js new file mode 100644 index 000000000000..3769c53cede0 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_rb_cc_nta_tb.ndarray.js @@ -0,0 +1,105 @@ +/** +* @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 isnanf = require( '@stdlib/math/base/assert/is-nanf' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var pkg = require( './../package.json' ).name; +var sgemm = require( './../lib/ndarray.js' ); + + +// VARIABLES // + +var options = { + 'dtype': 'float32' +}; + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} N - array dimension size +* @returns {Function} benchmark function +*/ +function createBenchmark( N ) { + var A = uniform( N*N, -10.0, 10.0, options ); + var B = uniform( N*N, -10.0, 10.0, options ); + var C = uniform( N*N, -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 = sgemm( 'no-transpose', 'transpose', N, N, N, 1.0, A, N, 1, 0, B, N, 1, 0, 1.0, C, 1, N, 0 ); + if ( isnanf( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnanf( 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 = 6; // 10^max + + for ( i = min; i <= max; i++ ) { + len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + f = createBenchmark( len ); + bench( pkg+':ndarray:size='+(len*len), f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_rb_cc_ta_ntb.ndarray.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_rb_cc_ta_ntb.ndarray.js new file mode 100644 index 000000000000..559e55db04d7 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_rb_cc_ta_ntb.ndarray.js @@ -0,0 +1,105 @@ +/** +* @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 isnanf = require( '@stdlib/math/base/assert/is-nanf' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var pkg = require( './../package.json' ).name; +var sgemm = require( './../lib/ndarray.js' ); + + +// VARIABLES // + +var options = { + 'dtype': 'float32' +}; + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} N - array dimension size +* @returns {Function} benchmark function +*/ +function createBenchmark( N ) { + var A = uniform( N*N, -10.0, 10.0, options ); + var B = uniform( N*N, -10.0, 10.0, options ); + var C = uniform( N*N, -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 = sgemm( 'transpose', 'no-transpose', N, N, N, 1.0, A, N, 1, 0, B, N, 1, 0, 1.0, C, 1, N, 0 ); + if ( isnanf( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnanf( 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 = 6; // 10^max + + for ( i = min; i <= max; i++ ) { + len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + f = createBenchmark( len ); + bench( pkg+':ndarray:size='+(len*len), f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_rb_cc_ta_tb.ndarray.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_rb_cc_ta_tb.ndarray.js new file mode 100644 index 000000000000..8cde23800805 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_rb_cc_ta_tb.ndarray.js @@ -0,0 +1,105 @@ +/** +* @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 isnanf = require( '@stdlib/math/base/assert/is-nanf' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var pkg = require( './../package.json' ).name; +var sgemm = require( './../lib/ndarray.js' ); + + +// VARIABLES // + +var options = { + 'dtype': 'float32' +}; + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} N - array dimension size +* @returns {Function} benchmark function +*/ +function createBenchmark( N ) { + var A = uniform( N*N, -10.0, 10.0, options ); + var B = uniform( N*N, -10.0, 10.0, options ); + var C = uniform( N*N, -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 = sgemm( 'transpose', 'transpose', N, N, N, 1.0, A, N, 1, 0, B, N, 1, 0, 1.0, C, 1, N, 0 ); + if ( isnanf( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnanf( 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 = 6; // 10^max + + for ( i = min; i <= max; i++ ) { + len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + f = createBenchmark( len ); + bench( pkg+':ndarray:size='+(len*len), f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_rb_rc_nta_ntb.ndarray.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_rb_rc_nta_ntb.ndarray.js new file mode 100644 index 000000000000..286adfcd1d17 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_rb_rc_nta_ntb.ndarray.js @@ -0,0 +1,105 @@ +/** +* @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 isnanf = require( '@stdlib/math/base/assert/is-nanf' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var pkg = require( './../package.json' ).name; +var sgemm = require( './../lib/ndarray.js' ); + + +// VARIABLES // + +var options = { + 'dtype': 'float32' +}; + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} N - array dimension size +* @returns {Function} benchmark function +*/ +function createBenchmark( N ) { + var A = uniform( N*N, -10.0, 10.0, options ); + var B = uniform( N*N, -10.0, 10.0, options ); + var C = uniform( N*N, -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 = sgemm( 'no-transpose', 'no-transpose', N, N, N, 1.0, A, N, 1, 0, B, N, 1, 0, 1.0, C, N, 1, 0 ); + if ( isnanf( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnanf( 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 = 6; // 10^max + + for ( i = min; i <= max; i++ ) { + len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + f = createBenchmark( len ); + bench( pkg+':ndarray:size='+(len*len), f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_rb_rc_nta_tb.ndarray.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_rb_rc_nta_tb.ndarray.js new file mode 100644 index 000000000000..b5c0f865991f --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_rb_rc_nta_tb.ndarray.js @@ -0,0 +1,105 @@ +/** +* @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 isnanf = require( '@stdlib/math/base/assert/is-nanf' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var pkg = require( './../package.json' ).name; +var sgemm = require( './../lib/ndarray.js' ); + + +// VARIABLES // + +var options = { + 'dtype': 'float32' +}; + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} N - array dimension size +* @returns {Function} benchmark function +*/ +function createBenchmark( N ) { + var A = uniform( N*N, -10.0, 10.0, options ); + var B = uniform( N*N, -10.0, 10.0, options ); + var C = uniform( N*N, -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 = sgemm( 'no-transpose', 'transpose', N, N, N, 1.0, A, N, 1, 0, B, N, 1, 0, 1.0, C, N, 1, 0 ); + if ( isnanf( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnanf( 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 = 6; // 10^max + + for ( i = min; i <= max; i++ ) { + len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + f = createBenchmark( len ); + bench( pkg+':ndarray:size='+(len*len), f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_rb_rc_ta_ntb.ndarray.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_rb_rc_ta_ntb.ndarray.js new file mode 100644 index 000000000000..bb3553277368 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_rb_rc_ta_ntb.ndarray.js @@ -0,0 +1,105 @@ +/** +* @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 isnanf = require( '@stdlib/math/base/assert/is-nanf' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var pkg = require( './../package.json' ).name; +var sgemm = require( './../lib/ndarray.js' ); + + +// VARIABLES // + +var options = { + 'dtype': 'float32' +}; + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} N - array dimension size +* @returns {Function} benchmark function +*/ +function createBenchmark( N ) { + var A = uniform( N*N, -10.0, 10.0, options ); + var B = uniform( N*N, -10.0, 10.0, options ); + var C = uniform( N*N, -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 = sgemm( 'transpose', 'no-transpose', N, N, N, 1.0, A, N, 1, 0, B, N, 1, 0, 1.0, C, N, 1, 0 ); + if ( isnanf( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnanf( 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 = 6; // 10^max + + for ( i = min; i <= max; i++ ) { + len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + f = createBenchmark( len ); + bench( pkg+':ndarray:size='+(len*len), f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_rb_rc_ta_tb.ndarray.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_rb_rc_ta_tb.ndarray.js new file mode 100644 index 000000000000..75255d96cc56 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_rb_rc_ta_tb.ndarray.js @@ -0,0 +1,105 @@ +/** +* @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 isnanf = require( '@stdlib/math/base/assert/is-nanf' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var pkg = require( './../package.json' ).name; +var sgemm = require( './../lib/ndarray.js' ); + + +// VARIABLES // + +var options = { + 'dtype': 'float32' +}; + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} N - array dimension size +* @returns {Function} benchmark function +*/ +function createBenchmark( N ) { + var A = uniform( N*N, -10.0, 10.0, options ); + var B = uniform( N*N, -10.0, 10.0, options ); + var C = uniform( N*N, -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 = sgemm( 'transpose', 'transpose', N, N, N, 1.0, A, N, 1, 0, B, N, 1, 0, 1.0, C, N, 1, 0 ); + if ( isnanf( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnanf( 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 = 6; // 10^max + + for ( i = min; i <= max; i++ ) { + len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + f = createBenchmark( len ); + bench( pkg+':ndarray:size='+(len*len), f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_row_major_nta_ntb.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_row_major_nta_ntb.js new file mode 100644 index 000000000000..1da17a4617ee --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_row_major_nta_ntb.js @@ -0,0 +1,105 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2024 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var uniform = require( '@stdlib/random/array/uniform' ); +var isnanf = require( '@stdlib/math/base/assert/is-nanf' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var pkg = require( './../package.json' ).name; +var sgemm = require( './../lib/sgemm.js' ); + + +// VARIABLES // + +var options = { + 'dtype': 'float32' +}; + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} N - array dimension size +* @returns {Function} benchmark function +*/ +function createBenchmark( N ) { + var A = uniform( N*N, -10.0, 10.0, options ); + var B = uniform( N*N, -10.0, 10.0, options ); + var C = uniform( N*N, -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 = sgemm( 'row-major', 'no-transpose', 'no-transpose', N, N, N, 1.0, A, N, B, N, 1.0, C, N ); + if ( isnanf( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnanf( 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 = 6; // 10^max + + for ( i = min; i <= max; i++ ) { + len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + f = createBenchmark( len ); + bench( pkg+':size='+(len*len), f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_row_major_nta_tb.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_row_major_nta_tb.js new file mode 100644 index 000000000000..7333e905037b --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_row_major_nta_tb.js @@ -0,0 +1,105 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2024 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var uniform = require( '@stdlib/random/array/uniform' ); +var isnanf = require( '@stdlib/math/base/assert/is-nanf' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var pkg = require( './../package.json' ).name; +var sgemm = require( './../lib/sgemm.js' ); + + +// VARIABLES // + +var options = { + 'dtype': 'float32' +}; + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} N - array dimension size +* @returns {Function} benchmark function +*/ +function createBenchmark( N ) { + var A = uniform( N*N, -10.0, 10.0, options ); + var B = uniform( N*N, -10.0, 10.0, options ); + var C = uniform( N*N, -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 = sgemm( 'row-major', 'no-transpose', 'transpose', N, N, N, 1.0, A, N, B, N, 1.0, C, N ); + if ( isnanf( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnanf( 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 = 6; // 10^max + + for ( i = min; i <= max; i++ ) { + len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + f = createBenchmark( len ); + bench( pkg+':size='+(len*len), f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_row_major_ta_ntb.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_row_major_ta_ntb.js new file mode 100644 index 000000000000..201669ff5f40 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_row_major_ta_ntb.js @@ -0,0 +1,105 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2024 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var uniform = require( '@stdlib/random/array/uniform' ); +var isnanf = require( '@stdlib/math/base/assert/is-nanf' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var pkg = require( './../package.json' ).name; +var sgemm = require( './../lib/sgemm.js' ); + + +// VARIABLES // + +var options = { + 'dtype': 'float32' +}; + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} N - array dimension size +* @returns {Function} benchmark function +*/ +function createBenchmark( N ) { + var A = uniform( N*N, -10.0, 10.0, options ); + var B = uniform( N*N, -10.0, 10.0, options ); + var C = uniform( N*N, -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 = sgemm( 'row-major', 'transpose', 'no-transpose', N, N, N, 1.0, A, N, B, N, 1.0, C, N ); + if ( isnanf( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnanf( 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 = 6; // 10^max + + for ( i = min; i <= max; i++ ) { + len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + f = createBenchmark( len ); + bench( pkg+':size='+(len*len), f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_row_major_ta_tb.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_row_major_ta_tb.js new file mode 100644 index 000000000000..a8345fb6d9a7 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_row_major_ta_tb.js @@ -0,0 +1,105 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2024 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var uniform = require( '@stdlib/random/array/uniform' ); +var isnanf = require( '@stdlib/math/base/assert/is-nanf' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var pkg = require( './../package.json' ).name; +var sgemm = require( './../lib/sgemm.js' ); + + +// VARIABLES // + +var options = { + 'dtype': 'float32' +}; + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} N - array dimension size +* @returns {Function} benchmark function +*/ +function createBenchmark( N ) { + var A = uniform( N*N, -10.0, 10.0, options ); + var B = uniform( N*N, -10.0, 10.0, options ); + var C = uniform( N*N, -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 = sgemm( 'row-major', 'transpose', 'transpose', N, N, N, 1.0, A, N, B, N, 1.0, C, N ); + if ( isnanf( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnanf( 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 = 6; // 10^max + + for ( i = min; i <= max; i++ ) { + len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + f = createBenchmark( len ); + bench( pkg+':size='+(len*len), f ); + } +} + +main(); From 0c9204b44e0a68ec94ab5a27b8c09eac314ba1d1 Mon Sep 17 00:00:00 2001 From: Athan Reines Date: Sat, 10 Aug 2024 00:21:56 -0700 Subject: [PATCH 09/26] fix: address buffer overflow bug --- lib/node_modules/@stdlib/blas/base/sgemm/lib/base.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/lib/base.js b/lib/node_modules/@stdlib/blas/base/sgemm/lib/base.js index 21c9770471de..1bf979688e5e 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/lib/base.js +++ b/lib/node_modules/@stdlib/blas/base/sgemm/lib/base.js @@ -30,7 +30,7 @@ var f32 = require( '@stdlib/number/float64/base/to-float32' ); // VARIABLES // -var bsize = blockSize( 'float32' ); +var bsize = blockSize( 'float32' ); // TODO: consider using a larger block size // FUNCTIONS // @@ -287,6 +287,7 @@ function blocked( M, N, K, alpha, A, strideA1, strideA2, offsetA, B, strideB1, s var dc1; var oa1; var ob0; + var oc0; var oc1; var S0; var S1; @@ -309,10 +310,10 @@ function blocked( M, N, K, alpha, A, strideA1, strideA2, offsetA, B, strideB1, s S0 = N; S1 = M; + // Define increments for the innermost loop: da0 = strideA2; db0 = strideB1; - dc0 = strideC2; // offset increment for innermost loop - dc1 = strideC1 - ( S0*strideC2 ); // offset increment for outermost loop + dc0 = strideC2; // Iterate over blocks... for ( j1 = S1; j1 > 0; ) { @@ -334,10 +335,8 @@ function blocked( M, N, K, alpha, A, strideA1, strideA2, offsetA, B, strideB1, s j0 -= bsize; } ob0 = offsetB + ( j0*strideB2 ); - - ic = oc1 + ( j0*strideC2 ); // index offset for `C` for the current block + oc0 = oc1 + ( j0*strideC2 ); // index offset for `C` for the current block dc1 = strideC1 - ( s0*strideC2 ); // loop offset increment for `C` - for ( k = K; k > 0; ) { if ( k < bsize ) { sk = k; @@ -348,6 +347,7 @@ function blocked( M, N, K, alpha, A, strideA1, strideA2, offsetA, B, strideB1, s } oa = oa1 + ( k*strideA2 ); ob = ob0 + ( k*strideB1 ); + ic = oc0; for ( i1 = 0; i1 < s1; i1++ ) { ia = oa + ( i1*strideA1 ); for ( i0 = 0; i0 < s0; i0++ ) { From 4318626689775032b0b3f92e32cc9eaed567273b Mon Sep 17 00:00:00 2001 From: stdlib-bot <82920195+stdlib-bot@users.noreply.github.com> Date: Sat, 10 Aug 2024 07:33:35 +0000 Subject: [PATCH 10/26] chore: update copyright years --- .../base/sgemm/benchmark/benchmark_ca_cb_cc_nta_ntb.ndarray.js | 2 +- .../base/sgemm/benchmark/benchmark_ca_cb_cc_nta_tb.ndarray.js | 2 +- .../base/sgemm/benchmark/benchmark_ca_cb_cc_ta_ntb.ndarray.js | 2 +- .../base/sgemm/benchmark/benchmark_ca_cb_cc_ta_tb.ndarray.js | 2 +- .../base/sgemm/benchmark/benchmark_ca_cb_rc_nta_ntb.ndarray.js | 2 +- .../base/sgemm/benchmark/benchmark_ca_cb_rc_nta_tb.ndarray.js | 2 +- .../base/sgemm/benchmark/benchmark_ca_cb_rc_ta_ntb.ndarray.js | 2 +- .../base/sgemm/benchmark/benchmark_ca_cb_rc_ta_tb.ndarray.js | 2 +- .../base/sgemm/benchmark/benchmark_ca_rb_cc_nta_ntb.ndarray.js | 2 +- .../base/sgemm/benchmark/benchmark_ca_rb_cc_nta_tb.ndarray.js | 2 +- .../base/sgemm/benchmark/benchmark_ca_rb_cc_ta_ntb.ndarray.js | 2 +- .../base/sgemm/benchmark/benchmark_ca_rb_cc_ta_tb.ndarray.js | 2 +- .../base/sgemm/benchmark/benchmark_ca_rb_rc_nta_ntb.ndarray.js | 2 +- .../base/sgemm/benchmark/benchmark_ca_rb_rc_nta_tb.ndarray.js | 2 +- .../base/sgemm/benchmark/benchmark_ca_rb_rc_ta_ntb.ndarray.js | 2 +- .../base/sgemm/benchmark/benchmark_ca_rb_rc_ta_tb.ndarray.js | 2 +- .../base/sgemm/benchmark/benchmark_ra_cb_cc_nta_ntb.ndarray.js | 2 +- .../base/sgemm/benchmark/benchmark_ra_cb_cc_nta_tb.ndarray.js | 2 +- .../base/sgemm/benchmark/benchmark_ra_cb_cc_ta_ntb.ndarray.js | 2 +- .../base/sgemm/benchmark/benchmark_ra_cb_cc_ta_tb.ndarray.js | 2 +- .../base/sgemm/benchmark/benchmark_ra_cb_rc_nta_ntb.ndarray.js | 2 +- .../base/sgemm/benchmark/benchmark_ra_cb_rc_nta_tb.ndarray.js | 2 +- .../base/sgemm/benchmark/benchmark_ra_cb_rc_ta_ntb.ndarray.js | 2 +- .../base/sgemm/benchmark/benchmark_ra_cb_rc_ta_tb.ndarray.js | 2 +- .../base/sgemm/benchmark/benchmark_ra_rb_cc_nta_ntb.ndarray.js | 2 +- .../base/sgemm/benchmark/benchmark_ra_rb_cc_nta_tb.ndarray.js | 2 +- .../base/sgemm/benchmark/benchmark_ra_rb_cc_ta_ntb.ndarray.js | 2 +- .../base/sgemm/benchmark/benchmark_ra_rb_cc_ta_tb.ndarray.js | 2 +- .../base/sgemm/benchmark/benchmark_ra_rb_rc_nta_ntb.ndarray.js | 2 +- .../base/sgemm/benchmark/benchmark_ra_rb_rc_nta_tb.ndarray.js | 2 +- .../base/sgemm/benchmark/benchmark_ra_rb_rc_ta_ntb.ndarray.js | 2 +- .../base/sgemm/benchmark/benchmark_ra_rb_rc_ta_tb.ndarray.js | 2 +- 32 files changed, 32 insertions(+), 32 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_cb_cc_nta_ntb.ndarray.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_cb_cc_nta_ntb.ndarray.js index 1647ba6109b7..1869ba011d97 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_cb_cc_nta_ntb.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_cb_cc_nta_ntb.ndarray.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2018 The Stdlib Authors. +* 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. diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_cb_cc_nta_tb.ndarray.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_cb_cc_nta_tb.ndarray.js index c0c368d2c73b..eb469a48690a 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_cb_cc_nta_tb.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_cb_cc_nta_tb.ndarray.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2018 The Stdlib Authors. +* 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. diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_cb_cc_ta_ntb.ndarray.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_cb_cc_ta_ntb.ndarray.js index 0f3358f6ec6f..09c3e51b1fed 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_cb_cc_ta_ntb.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_cb_cc_ta_ntb.ndarray.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2018 The Stdlib Authors. +* 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. diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_cb_cc_ta_tb.ndarray.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_cb_cc_ta_tb.ndarray.js index bcbc12778f56..14cc1cf80eaf 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_cb_cc_ta_tb.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_cb_cc_ta_tb.ndarray.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2018 The Stdlib Authors. +* 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. diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_cb_rc_nta_ntb.ndarray.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_cb_rc_nta_ntb.ndarray.js index 2ed48a2e2acc..8bc123427405 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_cb_rc_nta_ntb.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_cb_rc_nta_ntb.ndarray.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2018 The Stdlib Authors. +* 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. diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_cb_rc_nta_tb.ndarray.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_cb_rc_nta_tb.ndarray.js index 3b0916a2ed6c..13b27efebf42 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_cb_rc_nta_tb.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_cb_rc_nta_tb.ndarray.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2018 The Stdlib Authors. +* 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. diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_cb_rc_ta_ntb.ndarray.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_cb_rc_ta_ntb.ndarray.js index e317af3acea4..b000a8569451 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_cb_rc_ta_ntb.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_cb_rc_ta_ntb.ndarray.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2018 The Stdlib Authors. +* 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. diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_cb_rc_ta_tb.ndarray.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_cb_rc_ta_tb.ndarray.js index 4e4a329710eb..8f963a7c92f3 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_cb_rc_ta_tb.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_cb_rc_ta_tb.ndarray.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2018 The Stdlib Authors. +* 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. diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_rb_cc_nta_ntb.ndarray.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_rb_cc_nta_ntb.ndarray.js index 045c35e18d3f..d64a1360b279 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_rb_cc_nta_ntb.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_rb_cc_nta_ntb.ndarray.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2018 The Stdlib Authors. +* 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. diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_rb_cc_nta_tb.ndarray.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_rb_cc_nta_tb.ndarray.js index c200b407ffcb..d1fbcf1f2fcc 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_rb_cc_nta_tb.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_rb_cc_nta_tb.ndarray.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2018 The Stdlib Authors. +* 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. diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_rb_cc_ta_ntb.ndarray.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_rb_cc_ta_ntb.ndarray.js index 2fd160655189..d2404f4f8b77 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_rb_cc_ta_ntb.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_rb_cc_ta_ntb.ndarray.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2018 The Stdlib Authors. +* 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. diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_rb_cc_ta_tb.ndarray.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_rb_cc_ta_tb.ndarray.js index 3cbc1a0a5023..a6df7a379f25 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_rb_cc_ta_tb.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_rb_cc_ta_tb.ndarray.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2018 The Stdlib Authors. +* 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. diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_rb_rc_nta_ntb.ndarray.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_rb_rc_nta_ntb.ndarray.js index 45ba997539c7..5576dce6e1c3 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_rb_rc_nta_ntb.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_rb_rc_nta_ntb.ndarray.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2018 The Stdlib Authors. +* 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. diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_rb_rc_nta_tb.ndarray.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_rb_rc_nta_tb.ndarray.js index f3a1d24699fa..7c34cee56b6f 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_rb_rc_nta_tb.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_rb_rc_nta_tb.ndarray.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2018 The Stdlib Authors. +* 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. diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_rb_rc_ta_ntb.ndarray.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_rb_rc_ta_ntb.ndarray.js index 28b32b952a7e..ec37e7bc8302 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_rb_rc_ta_ntb.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_rb_rc_ta_ntb.ndarray.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2018 The Stdlib Authors. +* 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. diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_rb_rc_ta_tb.ndarray.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_rb_rc_ta_tb.ndarray.js index f2928e08cd03..14efebc298de 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_rb_rc_ta_tb.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_rb_rc_ta_tb.ndarray.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2018 The Stdlib Authors. +* 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. diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_cb_cc_nta_ntb.ndarray.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_cb_cc_nta_ntb.ndarray.js index ddbd75501bf7..9e4ce32e0cf0 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_cb_cc_nta_ntb.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_cb_cc_nta_ntb.ndarray.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2018 The Stdlib Authors. +* 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. diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_cb_cc_nta_tb.ndarray.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_cb_cc_nta_tb.ndarray.js index c0e0485bf611..50f1037521a1 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_cb_cc_nta_tb.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_cb_cc_nta_tb.ndarray.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2018 The Stdlib Authors. +* 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. diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_cb_cc_ta_ntb.ndarray.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_cb_cc_ta_ntb.ndarray.js index 5d851e4e8120..2a0d9f916175 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_cb_cc_ta_ntb.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_cb_cc_ta_ntb.ndarray.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2018 The Stdlib Authors. +* 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. diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_cb_cc_ta_tb.ndarray.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_cb_cc_ta_tb.ndarray.js index 57baf31d728c..b064b3c68c07 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_cb_cc_ta_tb.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_cb_cc_ta_tb.ndarray.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2018 The Stdlib Authors. +* 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. diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_cb_rc_nta_ntb.ndarray.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_cb_rc_nta_ntb.ndarray.js index 696bfcdc404a..97ddf6439deb 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_cb_rc_nta_ntb.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_cb_rc_nta_ntb.ndarray.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2018 The Stdlib Authors. +* 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. diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_cb_rc_nta_tb.ndarray.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_cb_rc_nta_tb.ndarray.js index a8d80058da8a..77a58c039d88 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_cb_rc_nta_tb.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_cb_rc_nta_tb.ndarray.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2018 The Stdlib Authors. +* 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. diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_cb_rc_ta_ntb.ndarray.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_cb_rc_ta_ntb.ndarray.js index 17d73ed5f066..c2761310f45c 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_cb_rc_ta_ntb.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_cb_rc_ta_ntb.ndarray.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2018 The Stdlib Authors. +* 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. diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_cb_rc_ta_tb.ndarray.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_cb_rc_ta_tb.ndarray.js index d51f51c5a83a..ad2253f37d64 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_cb_rc_ta_tb.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_cb_rc_ta_tb.ndarray.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2018 The Stdlib Authors. +* 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. diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_rb_cc_nta_ntb.ndarray.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_rb_cc_nta_ntb.ndarray.js index 51687d96259f..957995a27554 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_rb_cc_nta_ntb.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_rb_cc_nta_ntb.ndarray.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2018 The Stdlib Authors. +* 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. diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_rb_cc_nta_tb.ndarray.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_rb_cc_nta_tb.ndarray.js index 3769c53cede0..1906760ca6d5 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_rb_cc_nta_tb.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_rb_cc_nta_tb.ndarray.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2018 The Stdlib Authors. +* 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. diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_rb_cc_ta_ntb.ndarray.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_rb_cc_ta_ntb.ndarray.js index 559e55db04d7..b3c8097d6368 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_rb_cc_ta_ntb.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_rb_cc_ta_ntb.ndarray.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2018 The Stdlib Authors. +* 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. diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_rb_cc_ta_tb.ndarray.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_rb_cc_ta_tb.ndarray.js index 8cde23800805..5d4796f24dc7 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_rb_cc_ta_tb.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_rb_cc_ta_tb.ndarray.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2018 The Stdlib Authors. +* 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. diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_rb_rc_nta_ntb.ndarray.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_rb_rc_nta_ntb.ndarray.js index 286adfcd1d17..1d8efcb15200 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_rb_rc_nta_ntb.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_rb_rc_nta_ntb.ndarray.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2018 The Stdlib Authors. +* 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. diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_rb_rc_nta_tb.ndarray.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_rb_rc_nta_tb.ndarray.js index b5c0f865991f..80f6cbceecb7 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_rb_rc_nta_tb.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_rb_rc_nta_tb.ndarray.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2018 The Stdlib Authors. +* 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. diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_rb_rc_ta_ntb.ndarray.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_rb_rc_ta_ntb.ndarray.js index bb3553277368..d3555466cd39 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_rb_rc_ta_ntb.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_rb_rc_ta_ntb.ndarray.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2018 The Stdlib Authors. +* 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. diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_rb_rc_ta_tb.ndarray.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_rb_rc_ta_tb.ndarray.js index 75255d96cc56..50141057a2d1 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_rb_rc_ta_tb.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_rb_rc_ta_tb.ndarray.js @@ -1,7 +1,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2018 The Stdlib Authors. +* 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. From 470d540c9e79a7c475c1725872a358c08d4653a7 Mon Sep 17 00:00:00 2001 From: aman-095 Date: Sat, 10 Aug 2024 19:37:49 +0530 Subject: [PATCH 11/26] docs: add types and repl --- .../@stdlib/blas/base/sgemm/docs/repl.txt | 175 +++++ .../blas/base/sgemm/docs/types/index.d.ts | 141 ++++ .../blas/base/sgemm/docs/types/test.ts | 619 ++++++++++++++++++ 3 files changed, 935 insertions(+) diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/docs/repl.txt b/lib/node_modules/@stdlib/blas/base/sgemm/docs/repl.txt index e69de29bb2d1..bbc630e560e9 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/docs/repl.txt +++ b/lib/node_modules/@stdlib/blas/base/sgemm/docs/repl.txt @@ -0,0 +1,175 @@ + +{{alias}}( ord, ta, tb, M, N, K, α, A, lda, B, ldb, β, C, ldc ) + Performs the matrix-matrix operation `C = α*op(A)*op(B) + β*C` where + `op(A)` is either `op(X) = X` or `op(X) = X^T`, `α` and `β` are scalars, + `A`, `B`, and `C` are matrices, with `op(A)` an `M` by `K` matrix, `op(B)` + a `K` by `N` matrix, and `C` an `M` by `N` matrix. + + 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 `C` unchanged. + + If `α` equals `0` or `K` equals `0` and β equals `1`, the function returns + `C` unchanged. + + Parameters + ---------- + ord: string + Row-major (C-style) or column-major (Fortran-style) order. + + ta: string + Specifies whether `A` should be transposed, conjugate-transposed, or + not transposed. + + tb: string + Specifies whether `B` should be transposed, conjugate-transposed, or + not transposed. + + M: integer + Number of rows in the matrix `op(A)` and in the matrix `C`. + + N: integer + Number of columns in the matrix `op(B)` and in the matrix `C`. + + K: integer + Number of columns in the matrix `op(A)` and number of rows in the matrix + `op(B)`. + + α: number + Scalar constant. + + A: Float32Array + First matrix. + + lda: integer + Stride of the first dimension of `A` (a.k.a., leading dimension of the + matrix `A`). + + B: Float32Array + Second matrix. + + ldb: integer + Stride of the first dimension of `B` (a.k.a., leading dimension of the + matrix `B`). + + β: number + Scalar constant. + + C: Float32Array + Third matrix. + + ldc: integer + Stride of the first dimension of `C` (a.k.a., leading dimension of the + matrix `C`). + + Returns + ------- + C: Float32Array + Third matrix. + + Examples + -------- + // Standard usage: + > var A = new {{alias:@stdlib/array/float32}}( [ 1.0, 2.0, 3.0, 4.0 ] ); + > var B = new {{alias:@stdlib/array/float32}}( [ 1.0, 1.0, 0.0, 1.0 ] ); + > var C = new {{alias:@stdlib/array/float32}}( [ 1.0, 2.0, 3.0, 4.0 ] ); + > var ord = 'row-major'; + > var ta = 'no-transpose'; + > var tb = 'no-transpose'; + > {{alias}}( ord, ta, tb, 2, 2, 2, 1.0, A, 2, B, 2, 1.0, C, 2 ) + [ 2.0, 5.0, 6.0, 11.0 ] + + +{{alias}}.ndarray( ta,tb,M,N,K,α,A,sa1,sa2,oa,B,sb1,sb2,ob,β,C,sc1,sc2,oc ) + Performs the matrix-matrix operation `C = α*op(A)*op(B) + β*C`, using + alternative indexing semantics and where `op(A)` is either `op(X) = X` or + `op(X) = X^T`, `α` and `β` are scalars, `A`, `B`, and `C` are matrices, + with `op(A)` an `M` by `K` matrix, `op(B)` a `K` by `N` matrix, and `C` an + `M` by `N` matrix. + + While typed array views mandate a view offset based on the underlying + buffer, the offset parameters support indexing semantics based on starting + indices. + + Parameters + ---------- + ta: string + Specifies whether `A` should be transposed, conjugate-transposed, or not + transposed. + + tb: string + Specifies whether `B` should be transposed, conjugate-transposed, or not + transposed. + + M: integer + Number of rows in the matrix `op(A)` and in the matrix `C`. + + N: integer + Number of columns in the matrix `op(B)` and in the matrix `C`. + + K: integer + Number of columns in the matrix `op(A)` and number of rows in the matrix + `op(B)`. + + α: number + Scalar constant. + + A: Float32Array + First matrix. + + sa1: integer + Stride of the first dimension of `A`. + + sa2: integer + Stride of the second dimension of `A`. + + oa: integer + Starting index for `A`. + + B: Float32Array + Second matrix. + + sb1: integer + Stride of the first dimension of `B`. + + sb2: integer + Stride of the second dimension of `B`. + + ob: integer + Starting index for `B`. + + β: number + Scalar constant. + + C: Float32Array + Third matrix. + + sc1: integer + Stride of the first dimension of `C`. + + sc2: integer + Stride of the second dimension of `C`. + + oc: integer + Starting index for `C`. + + Returns + ------- + C: Float32Array + Third matrix. + + Examples + -------- + > var A = new {{alias:@stdlib/array/float32}}( [ 1.0, 2.0, 3.0, 4.0 ] ); + > var B = new {{alias:@stdlib/array/float32}}( [ 1.0, 1.0, 0.0, 1.0 ] ); + > var C = new {{alias:@stdlib/array/float32}}( [ 1.0, 2.0, 3.0, 4.0 ] ); + > var ta = 'no-transpose'; + > var tb = 'no-transpose'; + > var α = 1.0; + > var β = 1.0; + > {{alias}}.ndarray( ta,tb,2,2,2,α,A,2,1,0,B,2,1,0,β,C,2,1,0 ) + [ 2.0, 5.0, 6.0, 11.0 ] + + See Also + -------- diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/docs/types/index.d.ts b/lib/node_modules/@stdlib/blas/base/sgemm/docs/types/index.d.ts index e69de29bb2d1..8f781e219f6d 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/blas/base/sgemm/docs/types/index.d.ts @@ -0,0 +1,141 @@ +/* +* @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 + +/// + +import { Layout, TransposeOperation } from '@stdlib/types/blas'; + +/** +* Interface describing `sgemm`. +*/ +interface Routine { + /** + * Performs the matrix-matrix operation `C = α*op(A)*op(B) + β*C` where `op(A)` is either `op(X) = X` or `op(X) = X^T`, `α` and `β` are scalars, `A`, `B`, and `C` are matrices, with `op(A)` an `M` by `K` matrix, `op(B)` a `K` by `N` matrix, and `C` an `M` by `N` matrix. + * + * @param order - storage layout + * @param transA - specifies whether `A` should be transposed, conjugate-transposed, or not transposed + * @param transB - specifies whether `B` should be transposed, conjugate-transposed, or not transposed + * @param M - number of rows in the matrix `op(A)` and in the matrix `C` + * @param N - number of columns in the matrix `op(B)` and in the matrix `C` + * @param K - number of columns in the matrix `op(A)` and number of rows in the matrix `op(B)` + * @param alpha - scalar constant + * @param A - first matrix + * @param LDA - stride of the first dimension of `A` (a.k.a., leading dimension of the matrix `A`) + * @param B - second matrix + * @param LDB - stride of the first dimension of `B` (a.k.a., leading dimension of the matrix `B`) + * @param beta - scalar constant + * @param C - third matrix + * @param LDC - stride of the first dimension of `C` (a.k.a., leading dimension of the matrix `C`) + * @returns `C` + * + * @example + * var Float32Array = require( '@stdlib/array/float32' ); + * + * var A = new Float32Array( [ 1.0, 2.0, 3.0, 4.0 ] ); + * var B = new Float32Array( [ 1.0, 1.0, 0.0, 1.0 ] ); + * var C = new Float32Array( [ 1.0, 2.0, 3.0, 4.0 ] ); + * + * sgemm( 'row-major', 'no-transpose', 'no-transpose', 2, 2, 2, 1.0, A, 2, B, 2, 1.0, C, 2 ); + * // C => [ 2.0, 5.0, 6.0, 11.0 ] + */ + ( order: Layout, transA: TransposeOperation, transB: TransposeOperation, M: number, N: number, K: number, alpha: number, A: Float32Array, LDA: number, B: Float32Array, LDB: number, beta: number, C: Float32Array, LDC: number ): Float32Array; + + /** + * Performs the matrix-matrix operation `C = α*op(A)*op(B) + β*C`, using alternative indexing semantics and where `op(A)` is either `op(X) = X` or `op(X) = X^T`, `α` and `β` are scalars, `A`, `B`, and `C` are matrices, with `op(A)` an `M` by `K` matrix, `op(B)` a `K` by `N` matrix, and `C` an `M` by `N` matrix. + * + * @param transA - specifies whether `A` should be transposed, conjugate-transposed, or not transposed + * @param transB - specifies whether `B` should be transposed, conjugate-transposed, or not transposed + * @param M - number of rows in the matrix `op(A)` and in the matrix `C` + * @param N - number of columns in the matrix `op(B)` and in the matrix `C` + * @param K - number of columns in the matrix `op(A)` and number of rows in the matrix `op(B)` + * @param alpha - scalar constant + * @param A - first matrix + * @param strideA1 - stride of the first dimension of `A` + * @param strideA2 - stride of the second dimension of `A` + * @param offsetA - starting index for `A` + * @param B - second matrix + * @param strideB1 - stride of the first dimension of `B` + * @param strideB2 - stride of the second dimension of `B` + * @param offsetB - starting index for `B` + * @param beta - scalar constant + * @param C - third matrix + * @param strideC1 - stride of the first dimension of `C` + * @param strideC2 - stride of the second dimension of `C` + * @param offsetC - starting index for `C` + * @returns `C` + * + * @example + * var Float32Array = require( '@stdlib/array/float32' ); + * + * var A = new Float32Array( [ 1.0, 2.0, 3.0, 4.0 ] ); + * var B = new Float32Array( [ 1.0, 1.0, 0.0, 1.0 ] ); + * var C = new Float32Array( [ 1.0, 2.0, 3.0, 4.0 ] ); + * + * sgemm.ndarray( 'row-major', 'no-transpose', 'no-transpose', 2, 2, 2, 1.0, A, 2, 1, 0, B, 2, 1, 0, 1.0, C, 2, 1, 0 ); + * // C => [ 2.0, 5.0, 6.0, 11.0 ] + */ + ndarray( transA: TransposeOperation, transB: TransposeOperation, M: number, N: number, K: number, alpha: number, A: Float32Array, strideA1: number, strideA2: number, offsetA: number, B: Float32Array, strideB1: number, strideB2: number, offsetB: number, beta: number, C: Float32Array, strideC1: number, strideC2: number, offsetC: number ): Float32Array; +} + +/** +* Performs the matrix-matrix operation `C = α*op(A)*op(B) + β*C` where `op(A)` is either `op(X) = X` or `op(X) = X^T`, `α` and `β` are scalars, `A`, `B`, and `C` are matrices, with `op(A)` an `M` by `K` matrix, `op(B)` a `K` by `N` matrix, and `C` an `M` by `N` matrix. +* +* @param order - storage layout +* @param transA - specifies whether `A` should be transposed, conjugate-transposed, or not transposed +* @param transB - specifies whether `B` should be transposed, conjugate-transposed, or not transposed +* @param M - number of rows in the matrix `op(A)` and in the matrix `C` +* @param N - number of columns in the matrix `op(B)` and in the matrix `C` +* @param K - number of columns in the matrix `op(A)` and number of rows in the matrix `op(B)` +* @param alpha - scalar constant +* @param A - first matrix +* @param LDA - stride of the first dimension of `A` (a.k.a., leading dimension of the matrix `A`) +* @param B - second matrix +* @param LDB - stride of the first dimension of `B` (a.k.a., leading dimension of the matrix `B`) +* @param beta - scalar constant +* @param C - third matrix +* @param LDC - stride of the first dimension of `C` (a.k.a., leading dimension of the matrix `C`) +* @returns `C` +* +* @example +* var Float32Array = require( '@stdlib/array/float32' ); +* +* var A = new Float32Array( [ 1.0, 3.0, 2.0, 4.0 ] ); +* var B = new Float32Array( [ 1.0, 0.0, 1.0, 1.0 ] ); +* var C = new Float32Array( [ 1.0, 3.0, 2.0, 4.0 ] ); +* +* sgemm( 'column-major', 'no-transpose', 'no-transpose', 2, 2, 2, 1.0, A, 2, B, 2, 1.0, C, 2 ); +* // C => [ 2.0, 6.0, 5.0, 11.0 ] +* +* @example +* var Float32Array = require( '@stdlib/array/float32' ); +* +* var A = new Float32Array( [ 1.0, 3.0, 2.0, 4.0 ] ); +* var B = new Float32Array( [ 1.0, 0.0, 1.0, 1.0 ] ); +* var C = new Float32Array( [ 1.0, 3.0, 2.0, 4.0 ] ); +* +* sgemm.ndarray( 'column-major', 'no-transpose', 'no-transpose', 2, 2, 2, 1.0, A, 1, 2, 0, B, 1, 2, 0, 1.0, C, 1, 2, 0 ); +* // C => [ 2.0, 6.0, 5.0, 11.0 ] +*/ +declare var sgemm: Routine; + + +// EXPORTS // + +export = sgemm; diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/docs/types/test.ts b/lib/node_modules/@stdlib/blas/base/sgemm/docs/types/test.ts index e69de29bb2d1..5664754be722 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/docs/types/test.ts +++ b/lib/node_modules/@stdlib/blas/base/sgemm/docs/types/test.ts @@ -0,0 +1,619 @@ +/* +* @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 sgemm = require( './index' ); + + +// TESTS // + +// The function returns a Float32Array... +{ + const A = new Float32Array( 25 ); + const B = new Float32Array( 25 ); + const C = new Float32Array( 25 ); + + sgemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, B, 5, 1.0, C, 5 ); // $ExpectType Float32Array +} + +// The compiler throws an error if the function is provided a first argument which is not a string... +{ + const A = new Float32Array( 25 ); + const B = new Float32Array( 25 ); + const C = new Float32Array( 25 ); + + sgemm( 10, 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, B, 5, 1.0, C, 5 ); // $ExpectError + sgemm( true, 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, B, 5, 1.0, C, 5 ); // $ExpectError + sgemm( false, 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, B, 5, 1.0, C, 5 ); // $ExpectError + sgemm( null, 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, B, 5, 1.0, C, 5 ); // $ExpectError + sgemm( undefined, 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, B, 5, 1.0, C, 5 ); // $ExpectError + sgemm( [], 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, B, 5, 1.0, C, 5 ); // $ExpectError + sgemm( {}, 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, B, 5, 1.0, C, 5 ); // $ExpectError + sgemm( ( A: number ): number => A, 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, B, 5, 1.0, C, 5 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a second argument which is not a string... +{ + const A = new Float32Array( 25 ); + const B = new Float32Array( 25 ); + const C = new Float32Array( 25 ); + + sgemm( 'row-major', 10, 'no-transpose', 5, 5, 5, 1.0, A, 5, B, 5, 1.0, C, 5 ); // $ExpectError + sgemm( 'row-major', true, 'no-transpose', 5, 5, 5, 1.0, A, 5, B, 5, 1.0, C, 5 ); // $ExpectError + sgemm( 'row-major', false, 'no-transpose', 5, 5, 5, 1.0, A, 5, B, 5, 1.0, C, 5 ); // $ExpectError + sgemm( 'row-major', null, 'no-transpose', 5, 5, 5, 1.0, A, 5, B, 5, 1.0, C, 5 ); // $ExpectError + sgemm( 'row-major', undefined, 'no-transpose', 5, 5, 5, 1.0, A, 5, B, 5, 1.0, C, 5 ); // $ExpectError + sgemm( 'row-major', [ '1' ], 'no-transpose', 5, 5, 5, 1.0, A, 5, B, 5, 1.0, C, 5 ); // $ExpectError + sgemm( 'row-major', {}, 'no-transpose', 5, 5, 5, 1.0, A, 5, B, 5, 1.0, C, 5 ); // $ExpectError + sgemm( 'row-major', ( A: number ): number => A, 'no-transpose', 5, 5, 5, 1.0, A, 5, B, 5, 1.0, C, 5 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a third argument which is not a string... +{ + const A = new Float32Array( 25 ); + const B = new Float32Array( 25 ); + const C = new Float32Array( 25 ); + + sgemm( 'row-major', 'no-transpose', 10, 5, 5, 5, 1.0, A, 5, B, 5, 1.0, C, 5 ); // $ExpectError + sgemm( 'row-major', 'no-transpose', true, 5, 5, 5, 1.0, A, 5, B, 5, 1.0, C, 5 ); // $ExpectError + sgemm( 'row-major', 'no-transpose', false, 5, 5, 5, 1.0, A, 5, B, 5, 1.0, C, 5 ); // $ExpectError + sgemm( 'row-major', 'no-transpose', null, 5, 5, 5, 1.0, A, 5, B, 5, 1.0, C, 5 ); // $ExpectError + sgemm( 'row-major', 'no-transpose', undefined, 5, 5, 5, 1.0, A, 5, B, 5, 1.0, C, 5 ); // $ExpectError + sgemm( 'row-major', 'no-transpose', [ '1' ], 5, 5, 5, 1.0, A, 5, B, 5, 1.0, C, 5 ); // $ExpectError + sgemm( 'row-major', 'no-transpose', {}, 5, 5, 5, 1.0, A, 5, B, 5, 1.0, C, 5 ); // $ExpectError + sgemm( 'row-major', 'no-transpose', ( A: number ): number => A, 5, 5, 5, 1.0, A, 5, B, 5, 1.0, C, 5 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a fourth argument which is not a number... +{ + const A = new Float32Array( 25 ); + const B = new Float32Array( 25 ); + const C = new Float32Array( 25 ); + + sgemm( 'row-major', 'no-transpose', 'no-transpose', '10', 5, 5, 1.0, A, 5, B, 5, 1.0, C, 5 ); // $ExpectError + sgemm( 'row-major', 'no-transpose', 'no-transpose', true, 5, 5, 1.0, A, 5, B, 5, 1.0, C, 5 ); // $ExpectError + sgemm( 'row-major', 'no-transpose', 'no-transpose', false, 5, 5, 1.0, A, 5, B, 5, 1.0, C, 5 ); // $ExpectError + sgemm( 'row-major', 'no-transpose', 'no-transpose', null, 5, 5, 1.0, A, 5, B, 5, 1.0, C, 5 ); // $ExpectError + sgemm( 'row-major', 'no-transpose', 'no-transpose', undefined, 5, 5, 1.0, A, 5, B, 5, 1.0, C, 5 ); // $ExpectError + sgemm( 'row-major', 'no-transpose', 'no-transpose', [], 5, 5, 1.0, A, 5, B, 5, 1.0, C, 5 ); // $ExpectError + sgemm( 'row-major', 'no-transpose', 'no-transpose', {}, 5, 5, 1.0, A, 5, B, 5, 1.0, C, 5 ); // $ExpectError + sgemm( 'row-major', 'no-transpose', 'no-transpose', ( A: number ): number => A, 5, 5, 1.0, A, 5, B, 5, 1.0, C, 5 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a fifth argument which is not a number... +{ + const A = new Float32Array( 25 ); + const B = new Float32Array( 25 ); + const C = new Float32Array( 25 ); + + sgemm( 'row-major', 'no-transpose', 'no-transpose', 5, '10', 5, 1.0, A, 5, B, 5, 1.0, C, 5 ); // $ExpectError + sgemm( 'row-major', 'no-transpose', 'no-transpose', 5, true, 5, 1.0, A, 5, B, 5, 1.0, C, 5 ); // $ExpectError + sgemm( 'row-major', 'no-transpose', 'no-transpose', 5, false, 5, 1.0, A, 5, B, 5, 1.0, C, 5 ); // $ExpectError + sgemm( 'row-major', 'no-transpose', 'no-transpose', 5, null, 5, 1.0, A, 5, B, 5, 1.0, C, 5 ); // $ExpectError + sgemm( 'row-major', 'no-transpose', 'no-transpose', 5, undefined, 5, 1.0, A, 5, B, 5, 1.0, C, 5 ); // $ExpectError + sgemm( 'row-major', 'no-transpose', 'no-transpose', 5, [], 5, 1.0, A, 5, B, 5, 1.0, C, 5 ); // $ExpectError + sgemm( 'row-major', 'no-transpose', 'no-transpose', 5, {}, 5, 1.0, A, 5, B, 5, 1.0, C, 5 ); // $ExpectError + sgemm( 'row-major', 'no-transpose', 'no-transpose', 5, ( A: number ): number => A, 5, 1.0, A, 5, B, 5, 1.0, C, 5 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a sixth argument which is not a number... +{ + const A = new Float32Array( 25 ); + const B = new Float32Array( 25 ); + const C = new Float32Array( 25 ); + + sgemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, '10', 1.0, A, 5, B, 5, 1.0, C, 5 ); // $ExpectError + sgemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, true, 1.0, A, 5, B, 5, 1.0, C, 5 ); // $ExpectError + sgemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, false, 1.0, A, 5, B, 5, 1.0, C, 5 ); // $ExpectError + sgemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, null, 1.0, A, 5, B, 5, 1.0, C, 5 ); // $ExpectError + sgemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, undefined, 1.0, A, 5, B, 5, 1.0, C, 5 ); // $ExpectError + sgemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, [], 1.0, A, 5, B, 5, 1.0, C, 5 ); // $ExpectError + sgemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, {}, 1.0, A, 5, B, 5, 1.0, C, 5 ); // $ExpectError + sgemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, ( A: number ): number => A, 1.0, A, 5, B, 5, 1.0, C, 5 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a seventh argument which is not a number... +{ + const A = new Float32Array( 25 ); + const B = new Float32Array( 25 ); + const C = new Float32Array( 25 ); + + sgemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, 5, '10', A, 5, B, 5, 1.0, C, 5 ); // $ExpectError + sgemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, 5, true, A, 5, B, 5, 1.0, C, 5 ); // $ExpectError + sgemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, 5, false, A, 5, B, 5, 1.0, C, 5 ); // $ExpectError + sgemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, 5, null, A, 5, B, 5, 1.0, C, 5 ); // $ExpectError + sgemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, 5, undefined, A, 5, B, 5, 1.0, C, 5 ); // $ExpectError + sgemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, 5, [], A, 5, B, 5, 1.0, C, 5 ); // $ExpectError + sgemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, 5, {}, A, 5, B, 5, 1.0, C, 5 ); // $ExpectError + sgemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, 5, ( A: number ): number => A, A, 5, B, 5, 1.0, C, 5 ); // $ExpectError +} + +// The compiler throws an error if the function is provided an eighth argument which is not a Float32Array... +{ + const B = new Float32Array( 25 ); + const C = new Float32Array( 25 ); + + sgemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, 10, 5, B, 5, 1.0, C, 5 ); // $ExpectError + sgemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, '10', 5, B, 5, 1.0, C, 5 ); // $ExpectError + sgemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, true, 5, B, 5, 1.0, C, 5 ); // $ExpectError + sgemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, false, 5, B, 5, 1.0, C, 5 ); // $ExpectError + sgemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, null, 5, B, 5, 1.0, C, 5 ); // $ExpectError + sgemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, undefined, 5, B, 5, 1.0, C, 5 ); // $ExpectError + sgemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, [ '1' ], 5, B, 5, 1.0, C, 5 ); // $ExpectError + sgemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, {}, 5, B, 5, 1.0, C, 5 ); // $ExpectError + sgemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, ( A: number ): number => A, 5, B, 5, 1.0, C, 5 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a ninth argument which is not a number... +{ + const A = new Float32Array( 25 ); + const B = new Float32Array( 25 ); + const C = new Float32Array( 25 ); + + sgemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, '10', B, 5, 1.0, C, 5 ); // $ExpectError + sgemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, true, B, 5, 1.0, C, 5 ); // $ExpectError + sgemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, false, B, 5, 1.0, C, 5 ); // $ExpectError + sgemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, null, B, 5, 1.0, C, 5 ); // $ExpectError + sgemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, undefined, B, 5, 1.0, C, 5 ); // $ExpectError + sgemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, [], B, 5, 1.0, C, 5 ); // $ExpectError + sgemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, {}, B, 5, 1.0, C, 5 ); // $ExpectError + sgemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, ( A: number ): number => A, B, 5, 1.0, C, 5 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a tenth argument which is not a Float32Array... +{ + const A = new Float32Array( 25 ); + const C = new Float32Array( 25 ); + + sgemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, 10, 5, 1.0, C, 5 ); // $ExpectError + sgemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, '10', 5, 1.0, C, 5 ); // $ExpectError + sgemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, true, 5, 1.0, C, 5 ); // $ExpectError + sgemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, false, 5, 1.0, C, 5 ); // $ExpectError + sgemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, null, 5, 1.0, C, 5 ); // $ExpectError + sgemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, undefined, 5, 1.0, C, 5 ); // $ExpectError + sgemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, [ '1' ], 5, 1.0, C, 5 ); // $ExpectError + sgemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, {}, 5, 1.0, C, 5 ); // $ExpectError + sgemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, ( A: number ): number => A, 5, 1.0, C, 5 ); // $ExpectError +} + +// The compiler throws an error if the function is provided an eleventh argument which is not a number... +{ + const A = new Float32Array( 25 ); + const B = new Float32Array( 25 ); + const C = new Float32Array( 25 ); + + sgemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, B, '10', 1.0, C, 5 ); // $ExpectError + sgemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, B, true, 1.0, C, 5 ); // $ExpectError + sgemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, B, false, 1.0, C, 5 ); // $ExpectError + sgemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, B, null, 1.0, C, 5 ); // $ExpectError + sgemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, B, undefined, 1.0, C, 5 ); // $ExpectError + sgemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, B, [], 1.0, C, 5 ); // $ExpectError + sgemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, B, {}, 1.0, C, 5 ); // $ExpectError + sgemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, B, ( A: number ): number => A, 1.0, C, 5 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a twelfth argument which is not a number... +{ + const A = new Float32Array( 25 ); + const B = new Float32Array( 25 ); + const C = new Float32Array( 25 ); + + sgemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, B, 5, '10', C, 5 ); // $ExpectError + sgemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, B, 5, true, C, 5 ); // $ExpectError + sgemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, B, 5, false, C, 5 ); // $ExpectError + sgemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, B, 5, null, C, 5 ); // $ExpectError + sgemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, B, 5, undefined, C, 5 ); // $ExpectError + sgemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, B, 5, [], C, 5 ); // $ExpectError + sgemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, B, 5, {}, C, 5 ); // $ExpectError + sgemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, B, 5, ( A: number ): number => A, C, 5 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a thirteenth argument which is not a Float32Array... +{ + const A = new Float32Array( 25 ); + const B = new Float32Array( 25 ); + + sgemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, B, 5, 1.0, 10, 5 ); // $ExpectError + sgemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, B, 5, 1.0, '10', 5 ); // $ExpectError + sgemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, B, 5, 1.0, true, 5 ); // $ExpectError + sgemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, B, 5, 1.0, false, 5 ); // $ExpectError + sgemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, B, 5, 1.0, null, 5 ); // $ExpectError + sgemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, B, 5, 1.0, undefined, 5 ); // $ExpectError + sgemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, B, 5, 1.0, [ '1' ], 5 ); // $ExpectError + sgemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, B, 5, 1.0, {}, 5 ); // $ExpectError + sgemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, B, 5, 1.0, ( A: number ): number => A, 5 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a fourteenth argument which is not a number... +{ + const A = new Float32Array( 25 ); + const B = new Float32Array( 25 ); + const C = new Float32Array( 25 ); + + sgemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, B, 5, 1.0, C, '10' ); // $ExpectError + sgemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, B, 5, 1.0, C, true ); // $ExpectError + sgemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, B, 5, 1.0, C, false ); // $ExpectError + sgemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, B, 5, 1.0, C, null ); // $ExpectError + sgemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, B, 5, 1.0, C, undefined ); // $ExpectError + sgemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, B, 5, 1.0, C, [] ); // $ExpectError + sgemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, B, 5, 1.0, C, {} ); // $ExpectError + sgemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, B, 5, 1.0, C, ( A: number ): number => A ); // $ExpectError +} + +// The compiler throws an error if the function is provided an unsupported number of arguments... +{ + const A = new Float32Array( 25 ); + const B = new Float32Array( 25 ); + const C = new Float32Array( 25 ); + + sgemm(); // $ExpectError + sgemm( 'row-major' ); // $ExpectError + sgemm( 'row-major', 'no-transpose' ); // $ExpectError + sgemm( 'row-major', 'no-transpose', 'no-transpose' ); // $ExpectError + sgemm( 'row-major', 'no-transpose', 'no-transpose', 5 ); // $ExpectError + sgemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5 ); // $ExpectError + sgemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, 5 ); // $ExpectError + sgemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, 5, 1.0 ); // $ExpectError + sgemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A ); // $ExpectError + sgemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5 ); // $ExpectError + sgemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, B ); // $ExpectError + sgemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, B, 5 ); // $ExpectError + sgemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, B, 5, 1.0 ); // $ExpectError + sgemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, B, 5, 1.0, C ); // $ExpectError + sgemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, B, 5, 1.0, C, 5, 10 ); // $ExpectError +} + +// Attached to main export is an `ndarray` method which returns a Float32Array... +{ + const A = new Float32Array( 25 ); + const B = new Float32Array( 25 ); + const C = new Float32Array( 25 ); + + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, 1, 0, B, 5, 1, 0, 1.0, C, 5, 1, 0 ); // $ExpectType Float32Array +} + +// The compiler throws an error if the function is provided a first argument which is not a string... +{ + const A = new Float32Array( 25 ); + const B = new Float32Array( 25 ); + const C = new Float32Array( 25 ); + + sgemm.ndarray( 10, 'no-transpose', 5, 5, 5, 1.0, A, 5, 1, 0, B, 5, 1, 0, 1.0, C, 5, 1, 0 ); // $ExpectError + sgemm.ndarray( true, 'no-transpose', 5, 5, 5, 1.0, A, 5, 1, 0, B, 5, 1, 0, 1.0, C, 5, 1, 0 ); // $ExpectError + sgemm.ndarray( false, 'no-transpose', 5, 5, 5, 1.0, A, 5, 1, 0, B, 5, 1, 0, 1.0, C, 5, 1, 0 ); // $ExpectError + sgemm.ndarray( null, 'no-transpose', 5, 5, 5, 1.0, A, 5, 1, 0, B, 5, 1, 0, 1.0, C, 5, 1, 0 ); // $ExpectError + sgemm.ndarray( undefined, 'no-transpose', 5, 5, 5, 1.0, A, 5, 1, 0, B, 5, 1, 0, 1.0, C, 5, 1, 0 ); // $ExpectError + sgemm.ndarray( [ '1' ], 'no-transpose', 5, 5, 5, 1.0, A, 5, 1, 0, B, 5, 1, 0, 1.0, C, 5, 1, 0 ); // $ExpectError + sgemm.ndarray( {}, 'no-transpose', 5, 5, 5, 1.0, A, 5, 1, 0, B, 5, 1, 0, 1.0, C, 5, 1, 0 ); // $ExpectError + sgemm.ndarray( ( A: number ): number => A, 'no-transpose', 5, 5, 5, 1.0, A, 5, 1, 0, B, 5, 1, 0, 1.0, C, 5, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a second argument which is not a string... +{ + const A = new Float32Array( 25 ); + const B = new Float32Array( 25 ); + const C = new Float32Array( 25 ); + + sgemm.ndarray( 'no-transpose', 10, 5, 5, 5, 1.0, A, 5, 1, 0, B, 5, 1, 0, 1.0, C, 5, 1, 0 ); // $ExpectError + sgemm.ndarray( 'no-transpose', true, 5, 5, 5, 1.0, A, 5, 1, 0, B, 5, 1, 0, 1.0, C, 5, 1, 0 ); // $ExpectError + sgemm.ndarray( 'no-transpose', false, 5, 5, 5, 1.0, A, 5, 1, 0, B, 5, 1, 0, 1.0, C, 5, 1, 0 ); // $ExpectError + sgemm.ndarray( 'no-transpose', null, 5, 5, 5, 1.0, A, 5, 1, 0, B, 5, 1, 0, 1.0, C, 5, 1, 0 ); // $ExpectError + sgemm.ndarray( 'no-transpose', undefined, 5, 5, 5, 1.0, A, 5, 1, 0, B, 5, 1, 0, 1.0, C, 5, 1, 0 ); // $ExpectError + sgemm.ndarray( 'no-transpose', [ '1' ], 5, 5, 5, 1.0, A, 5, 1, 0, B, 5, 1, 0, 1.0, C, 5, 1, 0 ); // $ExpectError + sgemm.ndarray( 'no-transpose', {}, 5, 5, 5, 1.0, A, 5, 1, 0, B, 5, 1, 0, 1.0, C, 5, 1, 0 ); // $ExpectError + sgemm.ndarray( 'no-transpose', ( A: number ): number => A, 5, 5, 5, 1.0, A, 5, 1, 0, B, 5, 1, 0, 1.0, C, 5, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a third argument which is not a number... +{ + const A = new Float32Array( 25 ); + const B = new Float32Array( 25 ); + const C = new Float32Array( 25 ); + + sgemm.ndarray( 'no-transpose', 'no-transpose', '10', 5, 5, 1.0, A, 5, 1, 0, B, 5, 1, 0, 1.0, C, 5, 1, 0 ); // $ExpectError + sgemm.ndarray( 'no-transpose', 'no-transpose', true, 5, 5, 1.0, A, 5, 1, 0, B, 5, 1, 0, 1.0, C, 5, 1, 0 ); // $ExpectError + sgemm.ndarray( 'no-transpose', 'no-transpose', false, 5, 5, 1.0, A, 5, 1, 0, B, 5, 1, 0, 1.0, C, 5, 1, 0 ); // $ExpectError + sgemm.ndarray( 'no-transpose', 'no-transpose', null, 5, 5, 1.0, A, 5, 1, 0, B, 5, 1, 0, 1.0, C, 5, 1, 0 ); // $ExpectError + sgemm.ndarray( 'no-transpose', 'no-transpose', undefined, 5, 5, 1.0, A, 5, 1, 0, B, 5, 1, 0, 1.0, C, 5, 1, 0 ); // $ExpectError + sgemm.ndarray( 'no-transpose', 'no-transpose', [], 5, 5, 1.0, A, 5, 1, 0, B, 5, 1, 0, 1.0, C, 5, 1, 0 ); // $ExpectError + sgemm.ndarray( 'no-transpose', 'no-transpose', {}, 5, 5, 1.0, A, 5, 1, 0, B, 5, 1, 0, 1.0, C, 5, 1, 0 ); // $ExpectError + sgemm.ndarray( 'no-transpose', 'no-transpose', ( A: number ): number => A, 5, 5, 1.0, A, 5, 1, 0, B, 5, 1, 0, 1.0, C, 5, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a fourth argument which is not a number... +{ + const A = new Float32Array( 25 ); + const B = new Float32Array( 25 ); + const C = new Float32Array( 25 ); + + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, '10', 5, 1.0, A, 5, 1, 0, B, 5, 1, 0, 1.0, C, 5, 1, 0 ); // $ExpectError + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, true, 5, 1.0, A, 5, 1, 0, B, 5, 1, 0, 1.0, C, 5, 1, 0 ); // $ExpectError + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, false, 5, 1.0, A, 5, 1, 0, B, 5, 1, 0, 1.0, C, 5, 1, 0 ); // $ExpectError + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, null, 5, 1.0, A, 5, 1, 0, B, 5, 1, 0, 1.0, C, 5, 1, 0 ); // $ExpectError + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, undefined, 5, 1.0, A, 5, 1, 0, B, 5, 1, 0, 1.0, C, 5, 1, 0 ); // $ExpectError + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, [], 5, 1.0, A, 5, 1, 0, B, 5, 1, 0, 1.0, C, 5, 1, 0 ); // $ExpectError + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, {}, 5, 1.0, A, 5, 1, 0, B, 5, 1, 0, 1.0, C, 5, 1, 0 ); // $ExpectError + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, ( A: number ): number => A, 5, 1.0, A, 5, 1, 0, B, 5, 1, 0, 1.0, C, 5, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a fifth argument which is not a number... +{ + const A = new Float32Array( 25 ); + const B = new Float32Array( 25 ); + const C = new Float32Array( 25 ); + + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, '10', 1.0, A, 5, 1, 0, B, 5, 1, 0, 1.0, C, 5, 1, 0 ); // $ExpectError + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, true, 1.0, A, 5, 1, 0, B, 5, 1, 0, 1.0, C, 5, 1, 0 ); // $ExpectError + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, false, 1.0, A, 5, 1, 0, B, 5, 1, 0, 1.0, C, 5, 1, 0 ); // $ExpectError + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, null, 1.0, A, 5, 1, 0, B, 5, 1, 0, 1.0, C, 5, 1, 0 ); // $ExpectError + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, undefined, 1.0, A, 5, 1, 0, B, 5, 1, 0, 1.0, C, 5, 1, 0 ); // $ExpectError + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, [], 1.0, A, 5, 1, 0, B, 5, 1, 0, 1.0, C, 5, 1, 0 ); // $ExpectError + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, {}, 1.0, A, 5, 1, 0, B, 5, 1, 0, 1.0, C, 5, 1, 0 ); // $ExpectError + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, ( A: number ): number => A, 1.0, A, 5, 1, 0, B, 5, 1, 0, 1.0, C, 5, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a sixth argument which is not a number... +{ + const A = new Float32Array( 25 ); + const B = new Float32Array( 25 ); + const C = new Float32Array( 25 ); + + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, '10', A, 5, 1, 0, B, 5, 1, 0, 1.0, C, 5, 1, 0 ); // $ExpectError + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, true, A, 5, 1, 0, B, 5, 1, 0, 1.0, C, 5, 1, 0 ); // $ExpectError + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, false, A, 5, 1, 0, B, 5, 1, 0, 1.0, C, 5, 1, 0 ); // $ExpectError + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, null, A, 5, 1, 0, B, 5, 1, 0, 1.0, C, 5, 1, 0 ); // $ExpectError + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, undefined, A, 5, 1, 0, B, 5, 1, 0, 1.0, C, 5, 1, 0 ); // $ExpectError + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, [], A, 5, 1, 0, B, 5, 1, 0, 1.0, C, 5, 1, 0 ); // $ExpectError + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, {}, A, 5, 1, 0, B, 5, 1, 0, 1.0, C, 5, 1, 0 ); // $ExpectError + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, ( A: number ): number => A, A, 5, 1, 0, B, 5, 1, 0, 1.0, C, 5, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a seventh argument which is not a Float32Array... +{ + const B = new Float32Array( 25 ); + const C = new Float32Array( 25 ); + + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, 10, 5, 1, 0, B, 5, 1, 0, 1.0, C, 5, 1, 0 ); // $ExpectError + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, '10', 5, 1, 0, B, 5, 1, 0, 1.0, C, 5, 1, 0 ); // $ExpectError + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, true, 5, 1, 0, B, 5, 1, 0, 1.0, C, 5, 1, 0 ); // $ExpectError + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, false, 5, 1, 0, B, 5, 1, 0, 1.0, C, 5, 1, 0 ); // $ExpectError + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, null, 5, 1, 0, B, 5, 1, 0, 1.0, C, 5, 1, 0 ); // $ExpectError + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, undefined, 5, 1, 0, B, 5, 1, 0, 1.0, C, 5, 1, 0 ); // $ExpectError + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, [ '1' ], 5, 1, 0, B, 5, 1, 0, 1.0, C, 5, 1, 0 ); // $ExpectError + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, {}, 5, 1, 0, B, 5, 1, 0, 1.0, C, 5, 1, 0 ); // $ExpectError + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, ( A: number ): number => A, 5, 1, 0, B, 5, 1, 0, 1.0, C, 5, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided an eighth argument which is not a number... +{ + const A = new Float32Array( 25 ); + const B = new Float32Array( 25 ); + const C = new Float32Array( 25 ); + + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, '10', 1, 0, B, 5, 1, 0, 1.0, C, 5, 1, 0 ); // $ExpectError + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, true, 1, 0, B, 5, 1, 0, 1.0, C, 5, 1, 0 ); // $ExpectError + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, false, 1, 0, B, 5, 1, 0, 1.0, C, 5, 1, 0 ); // $ExpectError + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, null, 1, 0, B, 5, 1, 0, 1.0, C, 5, 1, 0 ); // $ExpectError + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, undefined, 1, 0, B, 5, 1, 0, 1.0, C, 5, 1, 0 ); // $ExpectError + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, [], 1, 0, B, 5, 1, 0, 1.0, C, 5, 1, 0 ); // $ExpectError + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, {}, 1, 0, B, 5, 1, 0, 1.0, C, 5, 1, 0 ); // $ExpectError + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, ( A: number ): number => A, 1, 0, B, 5, 1, 0, 1.0, C, 5, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a ninth argument which is not a number... +{ + const A = new Float32Array( 25 ); + const B = new Float32Array( 25 ); + const C = new Float32Array( 25 ); + + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, '10', 0, B, 5, 1, 0, 1.0, C, 5, 1, 0 ); // $ExpectError + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, true, 0, B, 5, 1, 0, 1.0, C, 5, 1, 0 ); // $ExpectError + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, false, 0, B, 5, 1, 0, 1.0, C, 5, 1, 0 ); // $ExpectError + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, null, 0, B, 5, 1, 0, 1.0, C, 5, 1, 0 ); // $ExpectError + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, undefined, 0, B, 5, 1, 0, 1.0, C, 5, 1, 0 ); // $ExpectError + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, [], 0, B, 5, 1, 0, 1.0, C, 5, 1, 0 ); // $ExpectError + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, {}, 0, B, 5, 1, 0, 1.0, C, 5, 1, 0 ); // $ExpectError + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, ( A: number ): number => A, 0, B, 5, 1, 0, 1.0, C, 5, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a tenth argument which is not a number... +{ + const A = new Float32Array( 25 ); + const B = new Float32Array( 25 ); + const C = new Float32Array( 25 ); + + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, 1, '10', B, 5, 1, 0, 1.0, C, 5, 1, 0 ); // $ExpectError + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, 1, true, B, 5, 1, 0, 1.0, C, 5, 1, 0 ); // $ExpectError + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, 1, false, B, 5, 1, 0, 1.0, C, 5, 1, 0 ); // $ExpectError + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, 1, null, B, 5, 1, 0, 1.0, C, 5, 1, 0 ); // $ExpectError + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, 1, undefined, B, 5, 1, 0, 1.0, C, 5, 1, 0 ); // $ExpectError + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, 1, [], B, 5, 1, 0, 1.0, C, 5, 1, 0 ); // $ExpectError + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, 1, {}, B, 5, 1, 0, 1.0, C, 5, 1, 0 ); // $ExpectError + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, 1, ( A: number ): number => A, B, 5, 1, 0, 1.0, C, 5, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided an eleventh argument which is not a Float32Array... +{ + const A = new Float32Array( 25 ); + const C = new Float32Array( 25 ); + + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, 1, 0, 10, 5, 1, 0, 1.0, C, 5, 1, 0 ); // $ExpectError + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, 1, 0, '10', 5, 1, 0, 1.0, C, 5, 1, 0 ); // $ExpectError + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, 1, 0, true, 5, 1, 0, 1.0, C, 5, 1, 0 ); // $ExpectError + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, 1, 0, false, 5, 1, 0, 1.0, C, 5, 1, 0 ); // $ExpectError + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, 1, 0, null, 5, 1, 0, 1.0, C, 5, 1, 0 ); // $ExpectError + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, 1, 0, undefined, 5, 1, 0, 1.0, C, 5, 1, 0 ); // $ExpectError + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, 1, 0, [ '1' ], 5, 1, 0, 1.0, C, 5, 1, 0 ); // $ExpectError + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, 1, 0, {}, 5, 1, 0, 1.0, C, 5, 1, 0 ); // $ExpectError + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, 1, 0, ( A: number ): number => A, 5, 1, 0, 1.0, C, 5, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a twelfth argument which is not a number... +{ + const A = new Float32Array( 25 ); + const B = new Float32Array( 25 ); + const C = new Float32Array( 25 ); + + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, 1, 0, B, '10', 1, 0, 1.0, C, 5, 1, 0 ); // $ExpectError + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, 1, 0, B, true, 1, 0, 1.0, C, 5, 1, 0 ); // $ExpectError + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, 1, 0, B, false, 1, 0, 1.0, C, 5, 1, 0 ); // $ExpectError + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, 1, 0, B, null, 1, 0, 1.0, C, 5, 1, 0 ); // $ExpectError + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, 1, 0, B, undefined, 1, 0, 1.0, C, 5, 1, 0 ); // $ExpectError + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, 1, 0, B, [], 1, 0, 1.0, C, 5, 1, 0 ); // $ExpectError + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, 1, 0, B, {}, 1, 0, 1.0, C, 5, 1, 0 ); // $ExpectError + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, 1, 0, B, ( A: number ): number => A, 1, 0, 1.0, C, 5, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a thirteenth argument which is not a number... +{ + const A = new Float32Array( 25 ); + const B = new Float32Array( 25 ); + const C = new Float32Array( 25 ); + + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, 1, 0, B, 5, '10', 0, 1.0, C, 5, 1, 0 ); // $ExpectError + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, 1, 0, B, 5, true, 0, 1.0, C, 5, 1, 0 ); // $ExpectError + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, 1, 0, B, 5, false, 0, 1.0, C, 5, 1, 0 ); // $ExpectError + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, 1, 0, B, 5, null, 0, 1.0, C, 5, 1, 0 ); // $ExpectError + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, 1, 0, B, 5, undefined, 0, 1.0, C, 5, 1, 0 ); // $ExpectError + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, 1, 0, B, 5, [], 0, 1.0, C, 5, 1, 0 ); // $ExpectError + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, 1, 0, B, 5, {}, 0, 1.0, C, 5, 1, 0 ); // $ExpectError + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, 1, 0, B, 5, ( A: number ): number => A, 0, 1.0, C, 5, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a fourteenth argument which is not a number... +{ + const A = new Float32Array( 25 ); + const B = new Float32Array( 25 ); + const C = new Float32Array( 25 ); + + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, 1, 0, B, 5, 1, '10', 1.0, C, 5, 1, 0 ); // $ExpectError + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, 1, 0, B, 5, 1, true, 1.0, C, 5, 1, 0 ); // $ExpectError + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, 1, 0, B, 5, 1, false, 1.0, C, 5, 1, 0 ); // $ExpectError + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, 1, 0, B, 5, 1, null, 1.0, C, 5, 1, 0 ); // $ExpectError + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, 1, 0, B, 5, 1, undefined, 1.0, C, 5, 1, 0 ); // $ExpectError + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, 1, 0, B, 5, 1, [], 1.0, C, 5, 1, 0 ); // $ExpectError + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, 1, 0, B, 5, 1, {}, 1.0, C, 5, 1, 0 ); // $ExpectError + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, 1, 0, B, 5, 1, ( A: number ): number => A, 1.0, C, 5, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a fifteenth argument which is not a number... +{ + const A = new Float32Array( 25 ); + const B = new Float32Array( 25 ); + const C = new Float32Array( 25 ); + + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, 1, 0, B, 5, 1, 0, '10', C, 5, 1, 0 ); // $ExpectError + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, 1, 0, B, 5, 1, 0, true, C, 5, 1, 0 ); // $ExpectError + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, 1, 0, B, 5, 1, 0, false, C, 5, 1, 0 ); // $ExpectError + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, 1, 0, B, 5, 1, 0, null, C, 5, 1, 0 ); // $ExpectError + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, 1, 0, B, 5, 1, 0, undefined, C, 5, 1, 0 ); // $ExpectError + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, 1, 0, B, 5, 1, 0, [], C, 5, 1, 0 ); // $ExpectError + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, 1, 0, B, 5, 1, 0, {}, C, 5, 1, 0 ); // $ExpectError + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, 1, 0, B, 5, 1, 0, ( A: number ): number => A, C, 5, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a sixteenth argument which is not a Float32Array... +{ + const A = new Float32Array( 25 ); + const B = new Float32Array( 25 ); + + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, 1, 0, B, 5, 1, 0, 1.0, 10, 5, 1, 0 ); // $ExpectError + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, 1, 0, B, 5, 1, 0, 1.0, '10', 5, 1, 0 ); // $ExpectError + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, 1, 0, B, 5, 1, 0, 1.0, true, 5, 1, 0 ); // $ExpectError + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, 1, 0, B, 5, 1, 0, 1.0, false, 5, 1, 0 ); // $ExpectError + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, 1, 0, B, 5, 1, 0, 1.0, null, 5, 1, 0 ); // $ExpectError + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, 1, 0, B, 5, 1, 0, 1.0, undefined, 5, 1, 0 ); // $ExpectError + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, 1, 0, B, 5, 1, 0, 1.0, [ '1' ], 5, 1, 0 ); // $ExpectError + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, 1, 0, B, 5, 1, 0, 1.0, {}, 5, 1, 0 ); // $ExpectError + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, 1, 0, B, 5, 1, 0, 1.0, ( A: number ): number => A, 5, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a seventeenth argument which is not a number... +{ + const A = new Float32Array( 25 ); + const B = new Float32Array( 25 ); + const C = new Float32Array( 25 ); + + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, 1, 0, B, 5, 1, 0, 1.0, C, '10', 1, 0 ); // $ExpectError + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, 1, 0, B, 5, 1, 0, 1.0, C, true, 1, 0 ); // $ExpectError + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, 1, 0, B, 5, 1, 0, 1.0, C, false, 1, 0 ); // $ExpectError + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, 1, 0, B, 5, 1, 0, 1.0, C, null, 1, 0 ); // $ExpectError + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, 1, 0, B, 5, 1, 0, 1.0, C, undefined, 1, 0 ); // $ExpectError + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, 1, 0, B, 5, 1, 0, 1.0, C, [], 1, 0 ); // $ExpectError + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, 1, 0, B, 5, 1, 0, 1.0, C, {}, 1, 0 ); // $ExpectError + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, 1, 0, B, 5, 1, 0, 1.0, C, ( A: number ): number => A, 1, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided an eighteenth argument which is not a number... +{ + const A = new Float32Array( 25 ); + const B = new Float32Array( 25 ); + const C = new Float32Array( 25 ); + + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, 1, 0, B, 5, 1, 0, 1.0, C, 5, '10', 0 ); // $ExpectError + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, 1, 0, B, 5, 1, 0, 1.0, C, 5, true, 0 ); // $ExpectError + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, 1, 0, B, 5, 1, 0, 1.0, C, 5, false, 0 ); // $ExpectError + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, 1, 0, B, 5, 1, 0, 1.0, C, 5, null, 0 ); // $ExpectError + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, 1, 0, B, 5, 1, 0, 1.0, C, 5, undefined, 0 ); // $ExpectError + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, 1, 0, B, 5, 1, 0, 1.0, C, 5, [], 0 ); // $ExpectError + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, 1, 0, B, 5, 1, 0, 1.0, C, 5, {}, 0 ); // $ExpectError + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, 1, 0, B, 5, 1, 0, 1.0, C, 5, ( A: number ): number => A, 0 ); // $ExpectError +} + +// The compiler throws an error if the function is provided a nineteenth argument which is not a number... +{ + const A = new Float32Array( 25 ); + const B = new Float32Array( 25 ); + const C = new Float32Array( 25 ); + + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, 1, 0, B, 5, 1, 0, 1.0, C, 5, 1, '10' ); // $ExpectError + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, 1, 0, B, 5, 1, 0, 1.0, C, 5, 1, true ); // $ExpectError + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, 1, 0, B, 5, 1, 0, 1.0, C, 5, 1, false ); // $ExpectError + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, 1, 0, B, 5, 1, 0, 1.0, C, 5, 1, null ); // $ExpectError + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, 1, 0, B, 5, 1, 0, 1.0, C, 5, 1, undefined ); // $ExpectError + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, 1, 0, B, 5, 1, 0, 1.0, C, 5, 1, [] ); // $ExpectError + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, 1, 0, B, 5, 1, 0, 1.0, C, 5, 1, {} ); // $ExpectError + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, 1, 0, B, 5, 1, 0, 1.0, C, 5, 1, ( A: number ): number => A ); // $ExpectError +} + +// The compiler throws an error if the `ndarray` method is provided an unsupported number of arguments... +{ + const A = new Float32Array( 25 ); + const B = new Float32Array( 25 ); + const C = new Float32Array( 25 ); + + sgemm.ndarray(); // $ExpectError + sgemm.ndarray( 'no-transpose' ); // $ExpectError + sgemm.ndarray( 'no-transpose', 'no-transpose' ); // $ExpectError + sgemm.ndarray( 'no-transpose', 'no-transpose', 5 ); // $ExpectError + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, 5 ); // $ExpectError + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5 ); // $ExpectError + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0 ); // $ExpectError + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A ); // $ExpectError + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5 ); // $ExpectError + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, 1 ); // $ExpectError + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, 1, 0 ); // $ExpectError + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, 1, 0, B ); // $ExpectError + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, 1, 0, B, 5 ); // $ExpectError + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, 1, 0, B, 5, 1 ); // $ExpectError + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, 1, 0, B, 5, 1, 0 ); // $ExpectError + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, 1, 0, B, 5, 1, 0, 1.0 ); // $ExpectError + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, 1, 0, B, 5, 1, 0, 1.0, C ); // $ExpectError + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, 1, 0, B, 5, 1, 0, 1.0, C, 5 ); // $ExpectError + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, 1, 0, B, 5, 1, 0, 1.0, C, 5, 1 ); // $ExpectError + sgemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, 1, 0, B, 5, 1, 0, 1.0, C, 5, 1, 0, 10 ); // $ExpectError +} From 23986e6b5fc4c7eb04243f0b3c63ce60567969ae Mon Sep 17 00:00:00 2001 From: aman-095 Date: Tue, 13 Aug 2024 11:00:00 +0530 Subject: [PATCH 12/26] test: add test cases for native and ndarray implementation --- .../@stdlib/blas/base/sgemm/examples/index.js | 3 + .../@stdlib/blas/base/sgemm/lib/sgemm.js | 20 +- .../sgemm/test/fixtures/ca_cb_cc_nta_ntb.json | 22 + .../sgemm/test/fixtures/ca_cb_cc_nta_tb.json | 22 + .../sgemm/test/fixtures/ca_cb_cc_ta_ntb.json | 22 + .../sgemm/test/fixtures/ca_cb_cc_ta_tb.json | 22 + .../sgemm/test/fixtures/ca_cb_rc_nta_ntb.json | 22 + .../sgemm/test/fixtures/ca_cb_rc_nta_tb.json | 22 + .../sgemm/test/fixtures/ca_cb_rc_ta_ntb.json | 22 + .../sgemm/test/fixtures/ca_cb_rc_ta_tb.json | 22 + .../sgemm/test/fixtures/ca_rb_cc_nta_ntb.json | 22 + .../sgemm/test/fixtures/ca_rb_cc_nta_tb.json | 22 + .../sgemm/test/fixtures/ca_rb_cc_ta_ntb.json | 22 + .../fixtures/ca_rb_cc_ta_ntb_sa1_sa2.json | 22 + .../fixtures/ca_rb_cc_ta_ntb_sa1_sa2n.json | 22 + .../fixtures/ca_rb_cc_ta_ntb_sa1n_sa2.json | 22 + .../fixtures/ca_rb_cc_ta_ntb_sa1n_sa2n.json | 22 + .../sgemm/test/fixtures/ca_rb_cc_ta_tb.json | 22 + .../sgemm/test/fixtures/ca_rb_rc_nta_ntb.json | 22 + .../sgemm/test/fixtures/ca_rb_rc_nta_tb.json | 22 + .../sgemm/test/fixtures/ca_rb_rc_ta_ntb.json | 22 + .../sgemm/test/fixtures/ca_rb_rc_ta_tb.json | 22 + .../test/fixtures/column_major_nta_ntb.json | 17 + .../test/fixtures/column_major_nta_tb.json | 17 + .../test/fixtures/column_major_ta_ntb.json | 17 + .../test/fixtures/column_major_ta_tb.json | 17 + .../sgemm/test/fixtures/ra_cb_cc_nta_ntb.json | 22 + .../sgemm/test/fixtures/ra_cb_cc_nta_tb.json | 22 + .../sgemm/test/fixtures/ra_cb_cc_ta_ntb.json | 22 + .../sgemm/test/fixtures/ra_cb_cc_ta_tb.json | 22 + .../sgemm/test/fixtures/ra_cb_rc_nta_ntb.json | 22 + .../sgemm/test/fixtures/ra_cb_rc_nta_tb.json | 22 + .../fixtures/ra_cb_rc_nta_tb_sc1_sc2.json | 22 + .../fixtures/ra_cb_rc_nta_tb_sc1_sc2n.json | 22 + .../fixtures/ra_cb_rc_nta_tb_sc1n_sc2.json | 22 + .../fixtures/ra_cb_rc_nta_tb_sc1n_sc2n.json | 22 + .../sgemm/test/fixtures/ra_cb_rc_ta_ntb.json | 22 + .../sgemm/test/fixtures/ra_cb_rc_ta_tb.json | 22 + .../sgemm/test/fixtures/ra_rb_cc_nta_ntb.json | 22 + .../sgemm/test/fixtures/ra_rb_cc_nta_tb.json | 22 + .../sgemm/test/fixtures/ra_rb_cc_ta_ntb.json | 22 + .../fixtures/ra_rb_cc_ta_ntb_sb1_sb2.json | 22 + .../fixtures/ra_rb_cc_ta_ntb_sb1_sb2n.json | 22 + .../fixtures/ra_rb_cc_ta_ntb_sb1n_sb2.json | 22 + .../fixtures/ra_rb_cc_ta_ntb_sb1n_sb2n.json | 22 + .../sgemm/test/fixtures/ra_rb_cc_ta_tb.json | 22 + .../sgemm/test/fixtures/ra_rb_rc_nta_ntb.json | 22 + ..._rb_rc_nta_ntb_complex_access_pattern.json | 22 + .../test/fixtures/ra_rb_rc_nta_ntb_oa.json | 22 + .../test/fixtures/ra_rb_rc_nta_ntb_ob.json | 22 + .../test/fixtures/ra_rb_rc_nta_ntb_oc.json | 22 + .../sgemm/test/fixtures/ra_rb_rc_nta_tb.json | 22 + .../sgemm/test/fixtures/ra_rb_rc_ta_ntb.json | 22 + .../sgemm/test/fixtures/ra_rb_rc_ta_tb.json | 22 + .../test/fixtures/row_major_nta_ntb.json | 17 + .../sgemm/test/fixtures/row_major_nta_tb.json | 17 + .../sgemm/test/fixtures/row_major_ta_ntb.json | 17 + .../sgemm/test/fixtures/row_major_ta_tb.json | 17 + .../blas/base/sgemm/test/test.ndarray.js | 1381 +++++++++++++++++ .../blas/base/sgemm/test/test.sgemm.js | 644 ++++++++ 60 files changed, 3236 insertions(+), 4 deletions(-) create mode 100644 lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ca_cb_cc_nta_ntb.json create mode 100644 lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ca_cb_cc_nta_tb.json create mode 100644 lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ca_cb_cc_ta_ntb.json create mode 100644 lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ca_cb_cc_ta_tb.json create mode 100644 lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ca_cb_rc_nta_ntb.json create mode 100644 lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ca_cb_rc_nta_tb.json create mode 100644 lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ca_cb_rc_ta_ntb.json create mode 100644 lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ca_cb_rc_ta_tb.json create mode 100644 lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ca_rb_cc_nta_ntb.json create mode 100644 lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ca_rb_cc_nta_tb.json create mode 100644 lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ca_rb_cc_ta_ntb.json create mode 100644 lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ca_rb_cc_ta_ntb_sa1_sa2.json create mode 100644 lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ca_rb_cc_ta_ntb_sa1_sa2n.json create mode 100644 lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ca_rb_cc_ta_ntb_sa1n_sa2.json create mode 100644 lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ca_rb_cc_ta_ntb_sa1n_sa2n.json create mode 100644 lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ca_rb_cc_ta_tb.json create mode 100644 lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ca_rb_rc_nta_ntb.json create mode 100644 lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ca_rb_rc_nta_tb.json create mode 100644 lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ca_rb_rc_ta_ntb.json create mode 100644 lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ca_rb_rc_ta_tb.json create mode 100644 lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/column_major_nta_ntb.json create mode 100644 lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/column_major_nta_tb.json create mode 100644 lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/column_major_ta_ntb.json create mode 100644 lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/column_major_ta_tb.json create mode 100644 lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ra_cb_cc_nta_ntb.json create mode 100644 lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ra_cb_cc_nta_tb.json create mode 100644 lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ra_cb_cc_ta_ntb.json create mode 100644 lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ra_cb_cc_ta_tb.json create mode 100644 lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ra_cb_rc_nta_ntb.json create mode 100644 lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ra_cb_rc_nta_tb.json create mode 100644 lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ra_cb_rc_nta_tb_sc1_sc2.json create mode 100644 lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ra_cb_rc_nta_tb_sc1_sc2n.json create mode 100644 lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ra_cb_rc_nta_tb_sc1n_sc2.json create mode 100644 lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ra_cb_rc_nta_tb_sc1n_sc2n.json create mode 100644 lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ra_cb_rc_ta_ntb.json create mode 100644 lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ra_cb_rc_ta_tb.json create mode 100644 lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ra_rb_cc_nta_ntb.json create mode 100644 lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ra_rb_cc_nta_tb.json create mode 100644 lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ra_rb_cc_ta_ntb.json create mode 100644 lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ra_rb_cc_ta_ntb_sb1_sb2.json create mode 100644 lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ra_rb_cc_ta_ntb_sb1_sb2n.json create mode 100644 lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ra_rb_cc_ta_ntb_sb1n_sb2.json create mode 100644 lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ra_rb_cc_ta_ntb_sb1n_sb2n.json create mode 100644 lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ra_rb_cc_ta_tb.json create mode 100644 lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ra_rb_rc_nta_ntb.json create mode 100644 lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ra_rb_rc_nta_ntb_complex_access_pattern.json create mode 100644 lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ra_rb_rc_nta_ntb_oa.json create mode 100644 lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ra_rb_rc_nta_ntb_ob.json create mode 100644 lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ra_rb_rc_nta_ntb_oc.json create mode 100644 lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ra_rb_rc_nta_tb.json create mode 100644 lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ra_rb_rc_ta_ntb.json create mode 100644 lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ra_rb_rc_ta_tb.json create mode 100644 lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/row_major_nta_ntb.json create mode 100644 lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/row_major_nta_tb.json create mode 100644 lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/row_major_ta_ntb.json create mode 100644 lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/row_major_ta_tb.json diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/examples/index.js b/lib/node_modules/@stdlib/blas/base/sgemm/examples/index.js index 0acb03081a7f..0a060ea909d8 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/examples/index.js +++ b/lib/node_modules/@stdlib/blas/base/sgemm/examples/index.js @@ -35,3 +35,6 @@ var C = discreteUniform( M*N, 0, 10, opts ); // 3x4 sgemm( 'row-major', 'no-transpose', 'no-transpose', M, N, K, 1.0, A, K, B, N, 1.0, C, N ); console.log( C ); + +sgemm.ndarray( 'no-transpose', 'no-transpose', M, N, K, 1.0, A, K, 1, 0, B, N, 1, 0, 1.0, C, N, 1, 0 ); +console.log( C ); diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/lib/sgemm.js b/lib/node_modules/@stdlib/blas/base/sgemm/lib/sgemm.js index 6d66aa94e403..36a1ee7d252c 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/lib/sgemm.js +++ b/lib/node_modules/@stdlib/blas/base/sgemm/lib/sgemm.js @@ -70,6 +70,7 @@ var base = require( './base.js' ); function sgemm( order, transA, transB, M, N, K, alpha, A, LDA, B, LDB, beta, C, LDC ) { // eslint-disable-line max-params, max-len var nrowsa; var nrowsb; + var valc; var sa1; var sa2; var sb1; @@ -95,12 +96,18 @@ function sgemm( order, transA, transB, M, N, K, alpha, A, LDA, B, LDB, beta, C, if ( K < 0 ) { throw new RangeError( format( 'invalid argument. Sixth argument must be a nonnegative integer. Value: `%d`.', K ) ); } - if ( transA === 'no-transpose' ) { + if ( + ( order === 'row-major' && transA === 'no-transpose' ) || + ( order === 'column-major' && transA === 'transpose' ) + ) { nrowsa = K; } else { nrowsa = M; } - if ( transB === 'no-transpose' ) { + if ( + ( order === 'row-major' && transB === 'no-transpose' ) || + ( order === 'column-major' && transB === 'transpose' ) + ) { nrowsb = N; } else { nrowsb = K; @@ -111,8 +118,13 @@ function sgemm( order, transA, transB, M, N, K, alpha, A, LDA, B, LDB, beta, C, if ( LDB < max( 1, nrowsb ) ) { throw new RangeError( format( 'invalid argument. Eleventh argument must be greater than or equal to max(1,%d). Value: `%d`.', nrowsb, LDB ) ); } - if ( LDC < max( 1, M ) ) { - throw new RangeError( format( 'invalid argument. Fourteenth argument must be greater than or equal to max(1,%d). Value: `%d`.', M, LDC ) ); + if ( order === 'row-major' ) { + valc = N; + } else { + valc = M; + } + if ( LDC < max( 1, valc ) ) { + throw new RangeError( format( 'invalid argument. Fourteenth argument must be greater than or equal to max(1,%d). Value: `%d`.', valc, LDC ) ); } if ( M === 0 || diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ca_cb_cc_nta_ntb.json b/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ca_cb_cc_nta_ntb.json new file mode 100644 index 000000000000..b7ef54eb5060 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ca_cb_cc_nta_ntb.json @@ -0,0 +1,22 @@ +{ + "transA": "no-transpose", + "transB": "no-transpose", + "M": 2, + "N": 4, + "K": 3, + "alpha": 1.0, + "A": [ 1.0, 4.0, 2.0, 5.0, 3.0, 6.0 ], + "strideA1": 1, + "strideA2": 2, + "offsetA": 0, + "B": [ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 ], + "strideB1": 1, + "strideB2": 3, + "offsetB": 0, + "beta": 1.0, + "C": [ 1.0, 5.0, 2.0, 6.0, 3.0, 7.0, 4.0, 8.0 ], + "strideC1": 1, + "strideC2": 2, + "offsetC": 0, + "C_out": [ 7.0, 20.0, 8.0, 21.0, 9.0, 22.0, 10.0, 23.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ca_cb_cc_nta_tb.json b/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ca_cb_cc_nta_tb.json new file mode 100644 index 000000000000..06f6163a146a --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ca_cb_cc_nta_tb.json @@ -0,0 +1,22 @@ +{ + "transA": "no-transpose", + "transB": "transpose", + "M": 2, + "N": 4, + "K": 3, + "alpha": 1.0, + "A": [ 1.0, 4.0, 2.0, 5.0, 3.0, 6.0 ], + "strideA1": 1, + "strideA2": 2, + "offsetA": 0, + "B": [ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 ], + "strideB1": 1, + "strideB2": 4, + "offsetB": 0, + "beta": 1.0, + "C": [ 1.0, 5.0, 2.0, 6.0, 3.0, 7.0, 4.0, 8.0 ], + "strideC1": 1, + "strideC2": 2, + "offsetC": 0, + "C_out": [ 7.0, 20.0, 8.0, 21.0, 9.0, 22.0, 10.0, 23.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ca_cb_cc_ta_ntb.json b/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ca_cb_cc_ta_ntb.json new file mode 100644 index 000000000000..f28ede1d3128 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ca_cb_cc_ta_ntb.json @@ -0,0 +1,22 @@ +{ + "transA": "transpose", + "transB": "no-transpose", + "M": 2, + "N": 4, + "K": 3, + "alpha": 1.0, + "A": [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ], + "strideA1": 1, + "strideA2": 3, + "offsetA": 0, + "B": [ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 ], + "strideB1": 1, + "strideB2": 3, + "offsetB": 0, + "beta": 1.0, + "C": [ 1.0, 5.0, 2.0, 6.0, 3.0, 7.0, 4.0, 8.0 ], + "strideC1": 1, + "strideC2": 2, + "offsetC": 0, + "C_out": [ 7.0, 20.0, 8.0, 21.0, 9.0, 22.0, 10.0, 23.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ca_cb_cc_ta_tb.json b/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ca_cb_cc_ta_tb.json new file mode 100644 index 000000000000..01af6224ec9c --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ca_cb_cc_ta_tb.json @@ -0,0 +1,22 @@ +{ + "transA": "transpose", + "transB": "transpose", + "M": 2, + "N": 4, + "K": 3, + "alpha": 1.0, + "A": [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ], + "strideA1": 1, + "strideA2": 3, + "offsetA": 0, + "B": [ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 ], + "strideB1": 1, + "strideB2": 4, + "offsetB": 0, + "beta": 1.0, + "C": [ 1.0, 5.0, 2.0, 6.0, 3.0, 7.0, 4.0, 8.0 ], + "strideC1": 1, + "strideC2": 2, + "offsetC": 0, + "C_out": [ 7.0, 20.0, 8.0, 21.0, 9.0, 22.0, 10.0, 23.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ca_cb_rc_nta_ntb.json b/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ca_cb_rc_nta_ntb.json new file mode 100644 index 000000000000..06b1fed4c156 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ca_cb_rc_nta_ntb.json @@ -0,0 +1,22 @@ +{ + "transA": "no-transpose", + "transB": "no-transpose", + "M": 2, + "N": 4, + "K": 3, + "alpha": 1.0, + "A": [ 1.0, 4.0, 2.0, 5.0, 3.0, 6.0 ], + "strideA1": 1, + "strideA2": 2, + "offsetA": 0, + "B": [ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 ], + "strideB1": 1, + "strideB2": 3, + "offsetB": 0, + "beta": 1.0, + "C": [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ], + "strideC1": 4, + "strideC2": 1, + "offsetC": 0, + "C_out": [ 7.0, 8.0, 9.0, 10.0, 20.0, 21.0, 22.0, 23.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ca_cb_rc_nta_tb.json b/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ca_cb_rc_nta_tb.json new file mode 100644 index 000000000000..5840e5504d0f --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ca_cb_rc_nta_tb.json @@ -0,0 +1,22 @@ +{ + "transA": "no-transpose", + "transB": "transpose", + "M": 2, + "N": 4, + "K": 3, + "alpha": 1.0, + "A": [ 1.0, 4.0, 2.0, 5.0, 3.0, 6.0 ], + "strideA1": 1, + "strideA2": 2, + "offsetA": 0, + "B": [ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 ], + "strideB1": 1, + "strideB2": 4, + "offsetB": 0, + "beta": 1.0, + "C": [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ], + "strideC1": 4, + "strideC2": 1, + "offsetC": 0, + "C_out": [ 7.0, 8.0, 9.0, 10.0, 20.0, 21.0, 22.0, 23.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ca_cb_rc_ta_ntb.json b/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ca_cb_rc_ta_ntb.json new file mode 100644 index 000000000000..ed84e9e527eb --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ca_cb_rc_ta_ntb.json @@ -0,0 +1,22 @@ +{ + "transA": "transpose", + "transB": "no-transpose", + "M": 2, + "N": 4, + "K": 3, + "alpha": 1.0, + "A": [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ], + "strideA1": 1, + "strideA2": 3, + "offsetA": 0, + "B": [ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 ], + "strideB1": 1, + "strideB2": 3, + "offsetB": 0, + "beta": 1.0, + "C": [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ], + "strideC1": 4, + "strideC2": 1, + "offsetC": 0, + "C_out": [ 7.0, 8.0, 9.0, 10.0, 20.0, 21.0, 22.0, 23.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ca_cb_rc_ta_tb.json b/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ca_cb_rc_ta_tb.json new file mode 100644 index 000000000000..93b6f7686ee9 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ca_cb_rc_ta_tb.json @@ -0,0 +1,22 @@ +{ + "transA": "transpose", + "transB": "transpose", + "M": 2, + "N": 4, + "K": 3, + "alpha": 1.0, + "A": [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ], + "strideA1": 1, + "strideA2": 3, + "offsetA": 0, + "B": [ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 ], + "strideB1": 1, + "strideB2": 4, + "offsetB": 0, + "beta": 1.0, + "C": [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ], + "strideC1": 4, + "strideC2": 1, + "offsetC": 0, + "C_out": [ 7.0, 8.0, 9.0, 10.0, 20.0, 21.0, 22.0, 23.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ca_rb_cc_nta_ntb.json b/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ca_rb_cc_nta_ntb.json new file mode 100644 index 000000000000..bdc813561728 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ca_rb_cc_nta_ntb.json @@ -0,0 +1,22 @@ +{ + "transA": "no-transpose", + "transB": "no-transpose", + "M": 2, + "N": 4, + "K": 3, + "alpha": 1.0, + "A": [ 1.0, 4.0, 2.0, 5.0, 3.0, 6.0 ], + "strideA1": 1, + "strideA2": 2, + "offsetA": 0, + "B": [ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 ], + "strideB1": 4, + "strideB2": 1, + "offsetB": 0, + "beta": 1.0, + "C": [ 1.0, 5.0, 2.0, 6.0, 3.0, 7.0, 4.0, 8.0 ], + "strideC1": 1, + "strideC2": 2, + "offsetC": 0, + "C_out": [ 7.0, 20.0, 8.0, 21.0, 9.0, 22.0, 10.0, 23.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ca_rb_cc_nta_tb.json b/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ca_rb_cc_nta_tb.json new file mode 100644 index 000000000000..8c8547ee35a6 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ca_rb_cc_nta_tb.json @@ -0,0 +1,22 @@ +{ + "transA": "no-transpose", + "transB": "transpose", + "M": 2, + "N": 4, + "K": 3, + "alpha": 1.0, + "A": [ 1.0, 4.0, 2.0, 5.0, 3.0, 6.0 ], + "strideA1": 1, + "strideA2": 2, + "offsetA": 0, + "B": [ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 ], + "strideB1": 3, + "strideB2": 1, + "offsetB": 0, + "beta": 1.0, + "C": [ 1.0, 5.0, 2.0, 6.0, 3.0, 7.0, 4.0, 8.0 ], + "strideC1": 1, + "strideC2": 2, + "offsetC": 0, + "C_out": [ 7.0, 20.0, 8.0, 21.0, 9.0, 22.0, 10.0, 23.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ca_rb_cc_ta_ntb.json b/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ca_rb_cc_ta_ntb.json new file mode 100644 index 000000000000..3e51469cbcc5 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ca_rb_cc_ta_ntb.json @@ -0,0 +1,22 @@ +{ + "transA": "transpose", + "transB": "no-transpose", + "M": 2, + "N": 4, + "K": 3, + "alpha": 1.0, + "A": [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ], + "strideA1": 1, + "strideA2": 3, + "offsetA": 0, + "B": [ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 ], + "strideB1": 4, + "strideB2": 1, + "offsetB": 0, + "beta": 1.0, + "C": [ 1.0, 5.0, 2.0, 6.0, 3.0, 7.0, 4.0, 8.0 ], + "strideC1": 1, + "strideC2": 2, + "offsetC": 0, + "C_out": [ 7.0, 20.0, 8.0, 21.0, 9.0, 22.0, 10.0, 23.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ca_rb_cc_ta_ntb_sa1_sa2.json b/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ca_rb_cc_ta_ntb_sa1_sa2.json new file mode 100644 index 000000000000..b7f343a0168c --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ca_rb_cc_ta_ntb_sa1_sa2.json @@ -0,0 +1,22 @@ +{ + "transA": "transpose", + "transB": "no-transpose", + "M": 2, + "N": 4, + "K": 3, + "alpha": 1.0, + "A": [ 0.0, 1.0, 0.0, 2.0, 0.0, 3.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 4.0, 0.0, 5.0, 0.0, 6.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], + "strideA1": 2, + "strideA2": 14, + "offsetA": 1, + "B": [ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 ], + "strideB1": 4, + "strideB2": 1, + "offsetB": 0, + "beta": 1.0, + "C": [ 1.0, 5.0, 2.0, 6.0, 3.0, 7.0, 4.0, 8.0 ], + "strideC1": 1, + "strideC2": 2, + "offsetC": 0, + "C_out": [ 7.0, 20.0, 8.0, 21.0, 9.0, 22.0, 10.0, 23.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ca_rb_cc_ta_ntb_sa1_sa2n.json b/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ca_rb_cc_ta_ntb_sa1_sa2n.json new file mode 100644 index 000000000000..2699776ad4bd --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ca_rb_cc_ta_ntb_sa1_sa2n.json @@ -0,0 +1,22 @@ +{ + "transA": "transpose", + "transB": "no-transpose", + "M": 2, + "N": 4, + "K": 3, + "alpha": 1.0, + "A": [ 0.0, 4.0, 0.0, 5.0, 0.0, 6.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 2.0, 0.0, 3.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], + "strideA1": 2, + "strideA2": -14, + "offsetA": 15, + "B": [ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 ], + "strideB1": 4, + "strideB2": 1, + "offsetB": 0, + "beta": 1.0, + "C": [ 1.0, 5.0, 2.0, 6.0, 3.0, 7.0, 4.0, 8.0 ], + "strideC1": 1, + "strideC2": 2, + "offsetC": 0, + "C_out": [ 7.0, 20.0, 8.0, 21.0, 9.0, 22.0, 10.0, 23.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ca_rb_cc_ta_ntb_sa1n_sa2.json b/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ca_rb_cc_ta_ntb_sa1n_sa2.json new file mode 100644 index 000000000000..cc45c0b27699 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ca_rb_cc_ta_ntb_sa1n_sa2.json @@ -0,0 +1,22 @@ +{ + "transA": "transpose", + "transB": "no-transpose", + "M": 2, + "N": 4, + "K": 3, + "alpha": 1.0, + "A": [ 0.0, 3.0, 0.0, 2.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 6.0, 0.0, 5.0, 0.0, 4.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], + "strideA1": -2, + "strideA2": 14, + "offsetA": 5, + "B": [ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 ], + "strideB1": 4, + "strideB2": 1, + "offsetB": 0, + "beta": 1.0, + "C": [ 1.0, 5.0, 2.0, 6.0, 3.0, 7.0, 4.0, 8.0 ], + "strideC1": 1, + "strideC2": 2, + "offsetC": 0, + "C_out": [ 7.0, 20.0, 8.0, 21.0, 9.0, 22.0, 10.0, 23.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ca_rb_cc_ta_ntb_sa1n_sa2n.json b/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ca_rb_cc_ta_ntb_sa1n_sa2n.json new file mode 100644 index 000000000000..23a85185aac3 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ca_rb_cc_ta_ntb_sa1n_sa2n.json @@ -0,0 +1,22 @@ +{ + "transA": "transpose", + "transB": "no-transpose", + "M": 2, + "N": 4, + "K": 3, + "alpha": 1.0, + "A": [ 0.0, 6.0, 0.0, 5.0, 0.0, 4.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 3.0, 0.0, 2.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ], + "strideA1": -2, + "strideA2": -14, + "offsetA": 19, + "B": [ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 ], + "strideB1": 4, + "strideB2": 1, + "offsetB": 0, + "beta": 1.0, + "C": [ 1.0, 5.0, 2.0, 6.0, 3.0, 7.0, 4.0, 8.0 ], + "strideC1": 1, + "strideC2": 2, + "offsetC": 0, + "C_out": [ 7.0, 20.0, 8.0, 21.0, 9.0, 22.0, 10.0, 23.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ca_rb_cc_ta_tb.json b/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ca_rb_cc_ta_tb.json new file mode 100644 index 000000000000..814cef1e25c1 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ca_rb_cc_ta_tb.json @@ -0,0 +1,22 @@ +{ + "transA": "transpose", + "transB": "transpose", + "M": 2, + "N": 4, + "K": 3, + "alpha": 1.0, + "A": [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ], + "strideA1": 1, + "strideA2": 3, + "offsetA": 0, + "B": [ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 ], + "strideB1": 3, + "strideB2": 1, + "offsetB": 0, + "beta": 1.0, + "C": [ 1.0, 5.0, 2.0, 6.0, 3.0, 7.0, 4.0, 8.0 ], + "strideC1": 1, + "strideC2": 2, + "offsetC": 0, + "C_out": [ 7.0, 20.0, 8.0, 21.0, 9.0, 22.0, 10.0, 23.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ca_rb_rc_nta_ntb.json b/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ca_rb_rc_nta_ntb.json new file mode 100644 index 000000000000..d268d6e57a90 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ca_rb_rc_nta_ntb.json @@ -0,0 +1,22 @@ +{ + "transA": "no-transpose", + "transB": "no-transpose", + "M": 2, + "N": 4, + "K": 3, + "alpha": 1.0, + "A": [ 1.0, 4.0, 2.0, 5.0, 3.0, 6.0 ], + "strideA1": 1, + "strideA2": 2, + "offsetA": 0, + "B": [ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 ], + "strideB1": 4, + "strideB2": 1, + "offsetB": 0, + "beta": 1.0, + "C": [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ], + "strideC1": 4, + "strideC2": 1, + "offsetC": 0, + "C_out": [ 7.0, 8.0, 9.0, 10.0, 20.0, 21.0, 22.0, 23.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ca_rb_rc_nta_tb.json b/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ca_rb_rc_nta_tb.json new file mode 100644 index 000000000000..adfe2eb7d60b --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ca_rb_rc_nta_tb.json @@ -0,0 +1,22 @@ +{ + "transA": "no-transpose", + "transB": "transpose", + "M": 2, + "N": 4, + "K": 3, + "alpha": 1.0, + "A": [ 1.0, 4.0, 2.0, 5.0, 3.0, 6.0 ], + "strideA1": 1, + "strideA2": 2, + "offsetA": 0, + "B": [ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 ], + "strideB1": 3, + "strideB2": 1, + "offsetB": 0, + "beta": 1.0, + "C": [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ], + "strideC1": 4, + "strideC2": 1, + "offsetC": 0, + "C_out": [ 7.0, 8.0, 9.0, 10.0, 20.0, 21.0, 22.0, 23.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ca_rb_rc_ta_ntb.json b/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ca_rb_rc_ta_ntb.json new file mode 100644 index 000000000000..ad75aa77c200 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ca_rb_rc_ta_ntb.json @@ -0,0 +1,22 @@ +{ + "transA": "transpose", + "transB": "no-transpose", + "M": 2, + "N": 4, + "K": 3, + "alpha": 1.0, + "A": [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ], + "strideA1": 1, + "strideA2": 3, + "offsetA": 0, + "B": [ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 ], + "strideB1": 4, + "strideB2": 1, + "offsetB": 0, + "beta": 1.0, + "C": [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ], + "strideC1": 4, + "strideC2": 1, + "offsetC": 0, + "C_out": [ 7.0, 8.0, 9.0, 10.0, 20.0, 21.0, 22.0, 23.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ca_rb_rc_ta_tb.json b/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ca_rb_rc_ta_tb.json new file mode 100644 index 000000000000..c6a1ac66162b --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ca_rb_rc_ta_tb.json @@ -0,0 +1,22 @@ +{ + "transA": "transpose", + "transB": "transpose", + "M": 2, + "N": 4, + "K": 3, + "alpha": 1.0, + "A": [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ], + "strideA1": 1, + "strideA2": 3, + "offsetA": 0, + "B": [ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 ], + "strideB1": 3, + "strideB2": 1, + "offsetB": 0, + "beta": 1.0, + "C": [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ], + "strideC1": 4, + "strideC2": 1, + "offsetC": 0, + "C_out": [ 7.0, 8.0, 9.0, 10.0, 20.0, 21.0, 22.0, 23.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/column_major_nta_ntb.json b/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/column_major_nta_ntb.json new file mode 100644 index 000000000000..9cb5d7f995b8 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/column_major_nta_ntb.json @@ -0,0 +1,17 @@ +{ + "order": "column-major", + "transA": "no-transpose", + "transB": "no-transpose", + "M": 2, + "N": 4, + "K": 3, + "alpha": 1.0, + "A": [ 1.0, 4.0, 2.0, 5.0, 3.0, 6.0 ], + "lda": 2, + "B": [ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 ], + "ldb": 3, + "beta": 1.0, + "C": [ 1.0, 5.0, 2.0, 6.0, 3.0, 7.0, 4.0, 8.0 ], + "ldc": 2, + "C_out": [ 7.0, 20.0, 8.0, 21.0, 9.0, 22.0, 10.0, 23.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/column_major_nta_tb.json b/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/column_major_nta_tb.json new file mode 100644 index 000000000000..cbd943ac393d --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/column_major_nta_tb.json @@ -0,0 +1,17 @@ +{ + "order": "column-major", + "transA": "no-transpose", + "transB": "transpose", + "M": 2, + "N": 4, + "K": 3, + "alpha": 1.0, + "A": [ 1.0, 4.0, 2.0, 5.0, 3.0, 6.0 ], + "lda": 2, + "B": [ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 ], + "ldb": 4, + "beta": 1.0, + "C": [ 1.0, 5.0, 2.0, 6.0, 3.0, 7.0, 4.0, 8.0 ], + "ldc": 2, + "C_out": [ 7.0, 20.0, 8.0, 21.0, 9.0, 22.0, 10.0, 23.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/column_major_ta_ntb.json b/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/column_major_ta_ntb.json new file mode 100644 index 000000000000..e64d4f9613d0 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/column_major_ta_ntb.json @@ -0,0 +1,17 @@ +{ + "order": "column-major", + "transA": "transpose", + "transB": "no-transpose", + "M": 2, + "N": 4, + "K": 3, + "alpha": 1.0, + "A": [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ], + "lda": 3, + "B": [ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 ], + "ldb": 3, + "beta": 1.0, + "C": [ 1.0, 5.0, 2.0, 6.0, 3.0, 7.0, 4.0, 8.0 ], + "ldc": 2, + "C_out": [ 7.0, 20.0, 8.0, 21.0, 9.0, 22.0, 10.0, 23.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/column_major_ta_tb.json b/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/column_major_ta_tb.json new file mode 100644 index 000000000000..e2b1e8a5e01b --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/column_major_ta_tb.json @@ -0,0 +1,17 @@ +{ + "order": "column-major", + "transA": "transpose", + "transB": "transpose", + "M": 2, + "N": 4, + "K": 3, + "alpha": 1.0, + "A": [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ], + "lda": 3, + "B": [ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 ], + "ldb": 4, + "beta": 1.0, + "C": [ 1.0, 5.0, 2.0, 6.0, 3.0, 7.0, 4.0, 8.0 ], + "ldc": 2, + "C_out": [ 7.0, 20.0, 8.0, 21.0, 9.0, 22.0, 10.0, 23.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ra_cb_cc_nta_ntb.json b/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ra_cb_cc_nta_ntb.json new file mode 100644 index 000000000000..94ac28bf7b79 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ra_cb_cc_nta_ntb.json @@ -0,0 +1,22 @@ +{ + "transA": "no-transpose", + "transB": "no-transpose", + "M": 2, + "N": 4, + "K": 3, + "alpha": 1.0, + "A": [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ], + "strideA1": 3, + "strideA2": 1, + "offsetA": 0, + "B": [ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 ], + "strideB1": 1, + "strideB2": 3, + "offsetB": 0, + "beta": 1.0, + "C": [ 1.0, 5.0, 2.0, 6.0, 3.0, 7.0, 4.0, 8.0 ], + "strideC1": 1, + "strideC2": 2, + "offsetC": 0, + "C_out": [ 7.0, 20.0, 8.0, 21.0, 9.0, 22.0, 10.0, 23.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ra_cb_cc_nta_tb.json b/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ra_cb_cc_nta_tb.json new file mode 100644 index 000000000000..11a465cae389 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ra_cb_cc_nta_tb.json @@ -0,0 +1,22 @@ +{ + "transA": "no-transpose", + "transB": "transpose", + "M": 2, + "N": 4, + "K": 3, + "alpha": 1.0, + "A": [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ], + "strideA1": 3, + "strideA2": 1, + "offsetA": 0, + "B": [ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 ], + "strideB1": 1, + "strideB2": 4, + "offsetB": 0, + "beta": 1.0, + "C": [ 1.0, 5.0, 2.0, 6.0, 3.0, 7.0, 4.0, 8.0 ], + "strideC1": 1, + "strideC2": 2, + "offsetC": 0, + "C_out": [ 7.0, 20.0, 8.0, 21.0, 9.0, 22.0, 10.0, 23.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ra_cb_cc_ta_ntb.json b/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ra_cb_cc_ta_ntb.json new file mode 100644 index 000000000000..3ebc3152a8cd --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ra_cb_cc_ta_ntb.json @@ -0,0 +1,22 @@ +{ + "transA": "transpose", + "transB": "no-transpose", + "M": 2, + "N": 4, + "K": 3, + "alpha": 1.0, + "A": [ 1.0, 4.0, 2.0, 5.0, 3.0, 6.0 ], + "strideA1": 2, + "strideA2": 1, + "offsetA": 0, + "B": [ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 ], + "strideB1": 1, + "strideB2": 3, + "offsetB": 0, + "beta": 1.0, + "C": [ 1.0, 5.0, 2.0, 6.0, 3.0, 7.0, 4.0, 8.0 ], + "strideC1": 1, + "strideC2": 2, + "offsetC": 0, + "C_out": [ 7.0, 20.0, 8.0, 21.0, 9.0, 22.0, 10.0, 23.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ra_cb_cc_ta_tb.json b/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ra_cb_cc_ta_tb.json new file mode 100644 index 000000000000..69175c817f03 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ra_cb_cc_ta_tb.json @@ -0,0 +1,22 @@ +{ + "transA": "transpose", + "transB": "transpose", + "M": 2, + "N": 4, + "K": 3, + "alpha": 1.0, + "A": [ 1.0, 4.0, 2.0, 5.0, 3.0, 6.0 ], + "strideA1": 2, + "strideA2": 1, + "offsetA": 0, + "B": [ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 ], + "strideB1": 1, + "strideB2": 4, + "offsetB": 0, + "beta": 1.0, + "C": [ 1.0, 5.0, 2.0, 6.0, 3.0, 7.0, 4.0, 8.0 ], + "strideC1": 1, + "strideC2": 2, + "offsetC": 0, + "C_out": [ 7.0, 20.0, 8.0, 21.0, 9.0, 22.0, 10.0, 23.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ra_cb_rc_nta_ntb.json b/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ra_cb_rc_nta_ntb.json new file mode 100644 index 000000000000..843efb0fde59 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ra_cb_rc_nta_ntb.json @@ -0,0 +1,22 @@ +{ + "transA": "no-transpose", + "transB": "no-transpose", + "M": 2, + "N": 4, + "K": 3, + "alpha": 1.0, + "A": [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ], + "strideA1": 3, + "strideA2": 1, + "offsetA": 0, + "B": [ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 ], + "strideB1": 1, + "strideB2": 3, + "offsetB": 0, + "beta": 1.0, + "C": [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ], + "strideC1": 4, + "strideC2": 1, + "offsetC": 0, + "C_out": [ 7.0, 8.0, 9.0, 10.0, 20.0, 21.0, 22.0, 23.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ra_cb_rc_nta_tb.json b/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ra_cb_rc_nta_tb.json new file mode 100644 index 000000000000..c253d04e93a2 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ra_cb_rc_nta_tb.json @@ -0,0 +1,22 @@ +{ + "transA": "no-transpose", + "transB": "transpose", + "M": 2, + "N": 4, + "K": 3, + "alpha": 1.0, + "A": [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ], + "strideA1": 3, + "strideA2": 1, + "offsetA": 0, + "B": [ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 ], + "strideB1": 1, + "strideB2": 4, + "offsetB": 0, + "beta": 1.0, + "C": [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ], + "strideC1": 4, + "strideC2": 1, + "offsetC": 0, + "C_out": [ 7.0, 8.0, 9.0, 10.0, 20.0, 21.0, 22.0, 23.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ra_cb_rc_nta_tb_sc1_sc2.json b/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ra_cb_rc_nta_tb_sc1_sc2.json new file mode 100644 index 000000000000..4576d9337d25 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ra_cb_rc_nta_tb_sc1_sc2.json @@ -0,0 +1,22 @@ +{ + "transA": "no-transpose", + "transB": "transpose", + "M": 2, + "N": 4, + "K": 3, + "alpha": 1.0, + "A": [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ], + "strideA1": 3, + "strideA2": 1, + "offsetA": 0, + "B": [ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 ], + "strideB1": 1, + "strideB2": 4, + "offsetB": 0, + "beta": 1.0, + "C": [ 0.0, 1.0, 0.0, 2.0, 0.0, 3.0, 0.0, 4.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 5.0, 0.0, 6.0, 0.0, 7.0, 0.0, 8.0 ], + "strideC1": 16, + "strideC2": 2, + "offsetC": 1, + "C_out": [ 0.0, 7.0, 0.0, 8.0, 0.0, 9.0, 0.0, 10.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 20.0, 0.0, 21.0, 0.0, 22.0, 0.0, 23.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ra_cb_rc_nta_tb_sc1_sc2n.json b/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ra_cb_rc_nta_tb_sc1_sc2n.json new file mode 100644 index 000000000000..486005dc8e39 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ra_cb_rc_nta_tb_sc1_sc2n.json @@ -0,0 +1,22 @@ +{ + "transA": "no-transpose", + "transB": "transpose", + "M": 2, + "N": 4, + "K": 3, + "alpha": 1.0, + "A": [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ], + "strideA1": 3, + "strideA2": 1, + "offsetA": 0, + "B": [ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 ], + "strideB1": 1, + "strideB2": 4, + "offsetB": 0, + "beta": 1.0, + "C": [ 0.0, 4.0, 0.0, 3.0, 0.0, 2.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 8.0, 0.0, 7.0, 0.0, 6.0, 0.0, 5.0, 0.0 ], + "strideC1": 18, + "strideC2": -2, + "offsetC": 7, + "C_out": [ 0.0, 10.0, 0.0, 9.0, 0.0, 8.0, 0.0, 7.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 23.0, 0.0, 22.0, 0.0, 21.0, 0.0, 20.0, 0.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ra_cb_rc_nta_tb_sc1n_sc2.json b/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ra_cb_rc_nta_tb_sc1n_sc2.json new file mode 100644 index 000000000000..1371a2df6748 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ra_cb_rc_nta_tb_sc1n_sc2.json @@ -0,0 +1,22 @@ +{ + "transA": "no-transpose", + "transB": "transpose", + "M": 2, + "N": 4, + "K": 3, + "alpha": 1.0, + "A": [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ], + "strideA1": 3, + "strideA2": 1, + "offsetA": 0, + "B": [ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 ], + "strideB1": 1, + "strideB2": 4, + "offsetB": 0, + "beta": 1.0, + "C": [ 0.0, 5.0, 0.0, 6.0, 0.0, 7.0, 0.0, 8.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 2.0, 0.0, 3.0, 0.0, 4.0, 0.0 ], + "strideC1": -18, + "strideC2": 2, + "offsetC": 19, + "C_out": [ 0.0, 20.0, 0.0, 21.0, 0.0, 22.0, 0.0, 23.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 7.0, 0.0, 8.0, 0.0, 9.0, 0.0, 10.0, 0.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ra_cb_rc_nta_tb_sc1n_sc2n.json b/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ra_cb_rc_nta_tb_sc1n_sc2n.json new file mode 100644 index 000000000000..cf41d0a7287b --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ra_cb_rc_nta_tb_sc1n_sc2n.json @@ -0,0 +1,22 @@ +{ + "transA": "no-transpose", + "transB": "transpose", + "M": 2, + "N": 4, + "K": 3, + "alpha": 1.0, + "A": [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ], + "strideA1": 3, + "strideA2": 1, + "offsetA": 0, + "B": [ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 ], + "strideB1": 1, + "strideB2": 4, + "offsetB": 0, + "beta": 1.0, + "C": [ 0.0, 8.0, 0.0, 7.0, 0.0, 6.0, 0.0, 5.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 4.0, 0.0, 3.0, 0.0, 2.0, 0.0, 1.0, 0.0 ], + "strideC1": -18, + "strideC2": -2, + "offsetC": 25, + "C_out": [ 0.0, 23.0, 0.0, 22.0, 0.0, 21.0, 0.0, 20.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 10.0, 0.0, 9.0, 0.0, 8.0, 0.0, 7.0, 0.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ra_cb_rc_ta_ntb.json b/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ra_cb_rc_ta_ntb.json new file mode 100644 index 000000000000..66b54c80c2e0 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ra_cb_rc_ta_ntb.json @@ -0,0 +1,22 @@ +{ + "transA": "transpose", + "transB": "no-transpose", + "M": 2, + "N": 4, + "K": 3, + "alpha": 1.0, + "A": [ 1.0, 4.0, 2.0, 5.0, 3.0, 6.0 ], + "strideA1": 2, + "strideA2": 1, + "offsetA": 0, + "B": [ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 ], + "strideB1": 1, + "strideB2": 3, + "offsetB": 0, + "beta": 1.0, + "C": [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ], + "strideC1": 4, + "strideC2": 1, + "offsetC": 0, + "C_out": [ 7.0, 8.0, 9.0, 10.0, 20.0, 21.0, 22.0, 23.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ra_cb_rc_ta_tb.json b/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ra_cb_rc_ta_tb.json new file mode 100644 index 000000000000..d4758e2e86db --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ra_cb_rc_ta_tb.json @@ -0,0 +1,22 @@ +{ + "transA": "transpose", + "transB": "transpose", + "M": 2, + "N": 4, + "K": 3, + "alpha": 1.0, + "A": [ 1.0, 4.0, 2.0, 5.0, 3.0, 6.0 ], + "strideA1": 2, + "strideA2": 1, + "offsetA": 0, + "B": [ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 ], + "strideB1": 1, + "strideB2": 4, + "offsetB": 0, + "beta": 1.0, + "C": [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ], + "strideC1": 4, + "strideC2": 1, + "offsetC": 0, + "C_out": [ 7.0, 8.0, 9.0, 10.0, 20.0, 21.0, 22.0, 23.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ra_rb_cc_nta_ntb.json b/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ra_rb_cc_nta_ntb.json new file mode 100644 index 000000000000..a25a765bfecd --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ra_rb_cc_nta_ntb.json @@ -0,0 +1,22 @@ +{ + "transA": "no-transpose", + "transB": "no-transpose", + "M": 2, + "N": 4, + "K": 3, + "alpha": 1.0, + "A": [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ], + "strideA1": 3, + "strideA2": 1, + "offsetA": 0, + "B": [ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 ], + "strideB1": 4, + "strideB2": 1, + "offsetB": 0, + "beta": 1.0, + "C": [ 1.0, 5.0, 2.0, 6.0, 3.0, 7.0, 4.0, 8.0 ], + "strideC1": 1, + "strideC2": 2, + "offsetC": 0, + "C_out": [ 7.0, 20.0, 8.0, 21.0, 9.0, 22.0, 10.0, 23.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ra_rb_cc_nta_tb.json b/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ra_rb_cc_nta_tb.json new file mode 100644 index 000000000000..4da7483239ac --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ra_rb_cc_nta_tb.json @@ -0,0 +1,22 @@ +{ + "transA": "no-transpose", + "transB": "transpose", + "M": 2, + "N": 4, + "K": 3, + "alpha": 1.0, + "A": [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ], + "strideA1": 3, + "strideA2": 1, + "offsetA": 0, + "B": [ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 ], + "strideB1": 3, + "strideB2": 1, + "offsetB": 0, + "beta": 1.0, + "C": [ 1.0, 5.0, 2.0, 6.0, 3.0, 7.0, 4.0, 8.0 ], + "strideC1": 1, + "strideC2": 2, + "offsetC": 0, + "C_out": [ 7.0, 20.0, 8.0, 21.0, 9.0, 22.0, 10.0, 23.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ra_rb_cc_ta_ntb.json b/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ra_rb_cc_ta_ntb.json new file mode 100644 index 000000000000..f8de280832de --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ra_rb_cc_ta_ntb.json @@ -0,0 +1,22 @@ +{ + "transA": "transpose", + "transB": "no-transpose", + "M": 2, + "N": 4, + "K": 3, + "alpha": 1.0, + "A": [ 1.0, 4.0, 2.0, 5.0, 3.0, 6.0 ], + "strideA1": 2, + "strideA2": 1, + "offsetA": 0, + "B": [ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 ], + "strideB1": 4, + "strideB2": 1, + "offsetB": 0, + "beta": 1.0, + "C": [ 1.0, 5.0, 2.0, 6.0, 3.0, 7.0, 4.0, 8.0 ], + "strideC1": 1, + "strideC2": 2, + "offsetC": 0, + "C_out": [ 7.0, 20.0, 8.0, 21.0, 9.0, 22.0, 10.0, 23.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ra_rb_cc_ta_ntb_sb1_sb2.json b/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ra_rb_cc_ta_ntb_sb1_sb2.json new file mode 100644 index 000000000000..a1926aa72076 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ra_rb_cc_ta_ntb_sb1_sb2.json @@ -0,0 +1,22 @@ +{ + "transA": "transpose", + "transB": "no-transpose", + "M": 2, + "N": 4, + "K": 3, + "alpha": 1.0, + "A": [ 1.0, 4.0, 2.0, 5.0, 3.0, 6.0 ], + "strideA1": 2, + "strideA2": 1, + "offsetA": 0, + "B": [ 0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0 ], + "strideB1": 16, + "strideB2": 2, + "offsetB": 1, + "beta": 1.0, + "C": [ 1.0, 5.0, 2.0, 6.0, 3.0, 7.0, 4.0, 8.0 ], + "strideC1": 1, + "strideC2": 2, + "offsetC": 0, + "C_out": [ 7.0, 20.0, 8.0, 21.0, 9.0, 22.0, 10.0, 23.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ra_rb_cc_ta_ntb_sb1_sb2n.json b/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ra_rb_cc_ta_ntb_sb1_sb2n.json new file mode 100644 index 000000000000..7e80c244fea0 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ra_rb_cc_ta_ntb_sb1_sb2n.json @@ -0,0 +1,22 @@ +{ + "transA": "transpose", + "transB": "no-transpose", + "M": 2, + "N": 4, + "K": 3, + "alpha": 1.0, + "A": [ 1.0, 4.0, 2.0, 5.0, 3.0, 6.0 ], + "strideA1": 2, + "strideA2": 1, + "offsetA": 0, + "B": [ 0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0 ], + "strideB1": 18, + "strideB2": -2, + "offsetB": 7, + "beta": 1.0, + "C": [ 1.0, 5.0, 2.0, 6.0, 3.0, 7.0, 4.0, 8.0 ], + "strideC1": 1, + "strideC2": 2, + "offsetC": 0, + "C_out": [ 7.0, 20.0, 8.0, 21.0, 9.0, 22.0, 10.0, 23.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ra_rb_cc_ta_ntb_sb1n_sb2.json b/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ra_rb_cc_ta_ntb_sb1n_sb2.json new file mode 100644 index 000000000000..3e3e85dc8a7a --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ra_rb_cc_ta_ntb_sb1n_sb2.json @@ -0,0 +1,22 @@ +{ + "transA": "transpose", + "transB": "no-transpose", + "M": 2, + "N": 4, + "K": 3, + "alpha": 1.0, + "A": [ 1.0, 4.0, 2.0, 5.0, 3.0, 6.0 ], + "strideA1": 2, + "strideA2": 1, + "offsetA": 0, + "B": [ 0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0 ], + "strideB1": -18, + "strideB2": 2, + "offsetB": 37, + "beta": 1.0, + "C": [ 1.0, 5.0, 2.0, 6.0, 3.0, 7.0, 4.0, 8.0 ], + "strideC1": 1, + "strideC2": 2, + "offsetC": 0, + "C_out": [ 7.0, 20.0, 8.0, 21.0, 9.0, 22.0, 10.0, 23.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ra_rb_cc_ta_ntb_sb1n_sb2n.json b/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ra_rb_cc_ta_ntb_sb1n_sb2n.json new file mode 100644 index 000000000000..b0271c841aa3 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ra_rb_cc_ta_ntb_sb1n_sb2n.json @@ -0,0 +1,22 @@ +{ + "transA": "transpose", + "transB": "no-transpose", + "M": 2, + "N": 4, + "K": 3, + "alpha": 1.0, + "A": [ 1.0, 4.0, 2.0, 5.0, 3.0, 6.0 ], + "strideA1": 2, + "strideA2": 1, + "offsetA": 0, + "B": [ 0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0 ], + "strideB1": -18, + "strideB2": -2, + "offsetB": 43, + "beta": 1.0, + "C": [ 1.0, 5.0, 2.0, 6.0, 3.0, 7.0, 4.0, 8.0 ], + "strideC1": 1, + "strideC2": 2, + "offsetC": 0, + "C_out": [ 7.0, 20.0, 8.0, 21.0, 9.0, 22.0, 10.0, 23.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ra_rb_cc_ta_tb.json b/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ra_rb_cc_ta_tb.json new file mode 100644 index 000000000000..56391a8942dd --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ra_rb_cc_ta_tb.json @@ -0,0 +1,22 @@ +{ + "transA": "transpose", + "transB": "transpose", + "M": 2, + "N": 4, + "K": 3, + "alpha": 1.0, + "A": [ 1.0, 4.0, 2.0, 5.0, 3.0, 6.0 ], + "strideA1": 2, + "strideA2": 1, + "offsetA": 0, + "B": [ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 ], + "strideB1": 3, + "strideB2": 1, + "offsetB": 0, + "beta": 1.0, + "C": [ 1.0, 5.0, 2.0, 6.0, 3.0, 7.0, 4.0, 8.0 ], + "strideC1": 1, + "strideC2": 2, + "offsetC": 0, + "C_out": [ 7.0, 20.0, 8.0, 21.0, 9.0, 22.0, 10.0, 23.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ra_rb_rc_nta_ntb.json b/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ra_rb_rc_nta_ntb.json new file mode 100644 index 000000000000..674eefc84927 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ra_rb_rc_nta_ntb.json @@ -0,0 +1,22 @@ +{ + "transA": "no-transpose", + "transB": "no-transpose", + "M": 2, + "N": 4, + "K": 3, + "alpha": 1.0, + "A": [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ], + "strideA1": 3, + "strideA2": 1, + "offsetA": 0, + "B": [ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 ], + "strideB1": 4, + "strideB2": 1, + "offsetB": 0, + "beta": 1.0, + "C": [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ], + "strideC1": 4, + "strideC2": 1, + "offsetC": 0, + "C_out": [ 7.0, 8.0, 9.0, 10.0, 20.0, 21.0, 22.0, 23.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ra_rb_rc_nta_ntb_complex_access_pattern.json b/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ra_rb_rc_nta_ntb_complex_access_pattern.json new file mode 100644 index 000000000000..3cf4cde90a1a --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ra_rb_rc_nta_ntb_complex_access_pattern.json @@ -0,0 +1,22 @@ +{ + "transA": "no-transpose", + "transB": "no-transpose", + "M": 2, + "N": 4, + "K": 3, + "alpha": 1.0, + "A": [ 0.0, 1.0, 0.0, 2.0, 0.0, 3.0, 0.0, 4.0, 0.0, 5.0, 0.0, 6.0 ], + "strideA1": 6, + "strideA2": 2, + "offsetA": 1, + "B": [ 0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0 ], + "strideB1": 16, + "strideB2": 2, + "offsetB": 1, + "beta": 1.0, + "C": [ 0.0, 1.0, 0.0, 2.0, 0.0, 3.0, 0.0, 4.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 5.0, 0.0, 6.0, 0.0, 7.0, 0.0, 8.0 ], + "strideC1": 16, + "strideC2": 2, + "offsetC": 1, + "C_out": [ 0.0, 7.0, 0.0, 8.0, 0.0, 9.0, 0.0, 10.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 20.0, 0.0, 21.0, 0.0, 22.0, 0.0, 23.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ra_rb_rc_nta_ntb_oa.json b/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ra_rb_rc_nta_ntb_oa.json new file mode 100644 index 000000000000..7f43c16f1c4b --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ra_rb_rc_nta_ntb_oa.json @@ -0,0 +1,22 @@ +{ + "transA": "no-transpose", + "transB": "no-transpose", + "M": 2, + "N": 4, + "K": 3, + "alpha": 1.0, + "A": [ 0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ], + "strideA1": 3, + "strideA2": 1, + "offsetA": 1, + "B": [ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 ], + "strideB1": 4, + "strideB2": 1, + "offsetB": 0, + "beta": 1.0, + "C": [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ], + "strideC1": 4, + "strideC2": 1, + "offsetC": 0, + "C_out": [ 7.0, 8.0, 9.0, 10.0, 20.0, 21.0, 22.0, 23.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ra_rb_rc_nta_ntb_ob.json b/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ra_rb_rc_nta_ntb_ob.json new file mode 100644 index 000000000000..93c1fb3ea686 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ra_rb_rc_nta_ntb_ob.json @@ -0,0 +1,22 @@ +{ + "transA": "no-transpose", + "transB": "no-transpose", + "M": 2, + "N": 4, + "K": 3, + "alpha": 1.0, + "A": [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ], + "strideA1": 3, + "strideA2": 1, + "offsetA": 0, + "B": [ 0.0, 0.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 ], + "strideB1": 4, + "strideB2": 1, + "offsetB": 2, + "beta": 1.0, + "C": [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ], + "strideC1": 4, + "strideC2": 1, + "offsetC": 0, + "C_out": [ 7.0, 8.0, 9.0, 10.0, 20.0, 21.0, 22.0, 23.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ra_rb_rc_nta_ntb_oc.json b/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ra_rb_rc_nta_ntb_oc.json new file mode 100644 index 000000000000..91d238d32451 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ra_rb_rc_nta_ntb_oc.json @@ -0,0 +1,22 @@ +{ + "transA": "no-transpose", + "transB": "no-transpose", + "M": 2, + "N": 4, + "K": 3, + "alpha": 1.0, + "A": [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ], + "strideA1": 3, + "strideA2": 1, + "offsetA": 0, + "B": [ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 ], + "strideB1": 4, + "strideB2": 1, + "offsetB": 0, + "beta": 1.0, + "C": [ 0.0, 0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ], + "strideC1": 4, + "strideC2": 1, + "offsetC": 2, + "C_out": [ 0.0, 0.0, 7.0, 8.0, 9.0, 10.0, 20.0, 21.0, 22.0, 23.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ra_rb_rc_nta_tb.json b/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ra_rb_rc_nta_tb.json new file mode 100644 index 000000000000..998d9ea9f73d --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ra_rb_rc_nta_tb.json @@ -0,0 +1,22 @@ +{ + "transA": "no-transpose", + "transB": "transpose", + "M": 2, + "N": 4, + "K": 3, + "alpha": 1.0, + "A": [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ], + "strideA1": 3, + "strideA2": 1, + "offsetA": 0, + "B": [ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 ], + "strideB1": 3, + "strideB2": 1, + "offsetB": 0, + "beta": 1.0, + "C": [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ], + "strideC1": 4, + "strideC2": 1, + "offsetC": 0, + "C_out": [ 7.0, 8.0, 9.0, 10.0, 20.0, 21.0, 22.0, 23.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ra_rb_rc_ta_ntb.json b/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ra_rb_rc_ta_ntb.json new file mode 100644 index 000000000000..72efaabac257 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ra_rb_rc_ta_ntb.json @@ -0,0 +1,22 @@ +{ + "transA": "transpose", + "transB": "no-transpose", + "M": 2, + "N": 4, + "K": 3, + "alpha": 1.0, + "A": [ 1.0, 4.0, 2.0, 5.0, 3.0, 6.0 ], + "strideA1": 2, + "strideA2": 1, + "offsetA": 0, + "B": [ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 ], + "strideB1": 4, + "strideB2": 1, + "offsetB": 0, + "beta": 1.0, + "C": [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ], + "strideC1": 4, + "strideC2": 1, + "offsetC": 0, + "C_out": [ 7.0, 8.0, 9.0, 10.0, 20.0, 21.0, 22.0, 23.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ra_rb_rc_ta_tb.json b/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ra_rb_rc_ta_tb.json new file mode 100644 index 000000000000..caebbbf3e593 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/ra_rb_rc_ta_tb.json @@ -0,0 +1,22 @@ +{ + "transA": "transpose", + "transB": "transpose", + "M": 2, + "N": 4, + "K": 3, + "alpha": 1.0, + "A": [ 1.0, 4.0, 2.0, 5.0, 3.0, 6.0 ], + "strideA1": 2, + "strideA2": 1, + "offsetA": 0, + "B": [ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 ], + "strideB1": 3, + "strideB2": 1, + "offsetB": 0, + "beta": 1.0, + "C": [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ], + "strideC1": 4, + "strideC2": 1, + "offsetC": 0, + "C_out": [ 7.0, 8.0, 9.0, 10.0, 20.0, 21.0, 22.0, 23.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/row_major_nta_ntb.json b/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/row_major_nta_ntb.json new file mode 100644 index 000000000000..ee43d9592312 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/row_major_nta_ntb.json @@ -0,0 +1,17 @@ +{ + "order": "row-major", + "transA": "no-transpose", + "transB": "no-transpose", + "M": 2, + "N": 4, + "K": 3, + "alpha": 1.0, + "A": [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ], + "lda": 3, + "B": [ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 ], + "ldb": 4, + "beta": 1.0, + "C": [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ], + "ldc": 4, + "C_out": [ 7.0, 8.0, 9.0, 10.0, 20.0, 21.0, 22.0, 23.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/row_major_nta_tb.json b/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/row_major_nta_tb.json new file mode 100644 index 000000000000..2284617949e6 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/row_major_nta_tb.json @@ -0,0 +1,17 @@ +{ + "order": "row-major", + "transA": "no-transpose", + "transB": "transpose", + "M": 2, + "N": 4, + "K": 3, + "alpha": 1.0, + "A": [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ], + "lda": 3, + "B": [ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 ], + "ldb": 3, + "beta": 1.0, + "C": [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ], + "ldc": 4, + "C_out": [ 7.0, 8.0, 9.0, 10.0, 20.0, 21.0, 22.0, 23.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/row_major_ta_ntb.json b/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/row_major_ta_ntb.json new file mode 100644 index 000000000000..9ec478b03b58 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/row_major_ta_ntb.json @@ -0,0 +1,17 @@ +{ + "order": "row-major", + "transA": "transpose", + "transB": "no-transpose", + "M": 2, + "N": 4, + "K": 3, + "alpha": 1.0, + "A": [ 1.0, 4.0, 2.0, 5.0, 3.0, 6.0 ], + "lda": 2, + "B": [ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 ], + "ldb": 4, + "beta": 1.0, + "C": [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ], + "ldc": 4, + "C_out": [ 7.0, 8.0, 9.0, 10.0, 20.0, 21.0, 22.0, 23.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/row_major_ta_tb.json b/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/row_major_ta_tb.json new file mode 100644 index 000000000000..e0c27df458ba --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/sgemm/test/fixtures/row_major_ta_tb.json @@ -0,0 +1,17 @@ +{ + "order": "row-major", + "transA": "transpose", + "transB": "transpose", + "M": 2, + "N": 4, + "K": 3, + "alpha": 1.0, + "A": [ 1.0, 4.0, 2.0, 5.0, 3.0, 6.0 ], + "lda": 2, + "B": [ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 ], + "ldb": 3, + "beta": 1.0, + "C": [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ], + "ldc": 4, + "C_out": [ 7.0, 8.0, 9.0, 10.0, 20.0, 21.0, 22.0, 23.0 ] +} diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/test/test.ndarray.js b/lib/node_modules/@stdlib/blas/base/sgemm/test/test.ndarray.js index e69de29bb2d1..9588638c1049 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/test/test.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/sgemm/test/test.ndarray.js @@ -0,0 +1,1381 @@ +/** +* @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 max-len */ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var Float32Array = require( '@stdlib/array/float32' ); +var EPS = require( '@stdlib/constants/float32/eps' ); +var abs = require( '@stdlib/math/base/special/abs' ); +var sgemm = require( './../lib/ndarray.js' ); + + +// FIXTURES // + +var cacbccntantb = require( './fixtures/ca_cb_cc_nta_ntb.json' ); +var cacbccntatb = require( './fixtures/ca_cb_cc_nta_tb.json' ); +var cacbcctantb = require( './fixtures/ca_cb_cc_ta_ntb.json' ); +var cacbcctatb = require( './fixtures/ca_cb_cc_ta_tb.json' ); +var cacbrcntantb = require( './fixtures/ca_cb_rc_nta_ntb.json' ); +var cacbrcntatb = require( './fixtures/ca_cb_rc_nta_tb.json' ); +var cacbrctantb = require( './fixtures/ca_cb_rc_ta_ntb.json' ); +var cacbrctatb = require( './fixtures/ca_cb_rc_ta_tb.json' ); +var carbccntantb = require( './fixtures/ca_rb_cc_nta_ntb.json' ); +var carbccntatb = require( './fixtures/ca_rb_cc_nta_tb.json' ); +var carbcctantb = require( './fixtures/ca_rb_cc_ta_ntb.json' ); +var carbcctatb = require( './fixtures/ca_rb_cc_ta_tb.json' ); +var carbrcntantb = require( './fixtures/ca_rb_rc_nta_ntb.json' ); +var carbrcntatb = require( './fixtures/ca_rb_rc_nta_tb.json' ); +var carbrctantb = require( './fixtures/ca_rb_rc_ta_ntb.json' ); +var carbrctatb = require( './fixtures/ca_rb_rc_ta_tb.json' ); + +var racbccntantb = require( './fixtures/ra_cb_cc_nta_ntb.json' ); +var racbccntatb = require( './fixtures/ra_cb_cc_nta_tb.json' ); +var racbcctantb = require( './fixtures/ra_cb_cc_ta_ntb.json' ); +var racbcctatb = require( './fixtures/ra_cb_cc_ta_tb.json' ); +var racbrcntantb = require( './fixtures/ra_cb_rc_nta_ntb.json' ); +var racbrcntatb = require( './fixtures/ra_cb_rc_nta_tb.json' ); +var racbrctantb = require( './fixtures/ra_cb_rc_ta_ntb.json' ); +var racbrctatb = require( './fixtures/ra_cb_rc_ta_tb.json' ); +var rarbccntantb = require( './fixtures/ra_rb_cc_nta_ntb.json' ); +var rarbccntatb = require( './fixtures/ra_rb_cc_nta_tb.json' ); +var rarbcctantb = require( './fixtures/ra_rb_cc_ta_ntb.json' ); +var rarbcctatb = require( './fixtures/ra_rb_cc_ta_tb.json' ); +var rarbrcntantb = require( './fixtures/ra_rb_rc_nta_ntb.json' ); +var rarbrcntatb = require( './fixtures/ra_rb_rc_nta_tb.json' ); +var rarbrctantb = require( './fixtures/ra_rb_rc_ta_ntb.json' ); +var rarbrctatb = require( './fixtures/ra_rb_rc_ta_tb.json' ); + +var carbcctantbsa1sa2 = require( './fixtures/ca_rb_cc_ta_ntb_sa1_sa2.json' ); +var carbcctantbsa1nsa2 = require( './fixtures/ca_rb_cc_ta_ntb_sa1n_sa2.json' ); +var carbcctantbsa1sa2n = require( './fixtures/ca_rb_cc_ta_ntb_sa1_sa2n.json' ); +var carbcctantbsa1nsa2n = require( './fixtures/ca_rb_cc_ta_ntb_sa1n_sa2n.json' ); +var rarbcctantbsb1sb2 = require( './fixtures/ra_rb_cc_ta_ntb_sb1_sb2.json' ); +var rarbcctantbsb1nsb2 = require( './fixtures/ra_rb_cc_ta_ntb_sb1n_sb2.json' ); +var rarbcctantbsb1sb2n = require( './fixtures/ra_rb_cc_ta_ntb_sb1_sb2n.json' ); +var rarbcctantbsb1nsb2n = require( './fixtures/ra_rb_cc_ta_ntb_sb1n_sb2n.json' ); +var racbrcntatbsc1sc2 = require( './fixtures/ra_cb_rc_nta_tb_sc1_sc2.json' ); +var racbrcntatbsc1nsc2 = require( './fixtures/ra_cb_rc_nta_tb_sc1n_sc2.json' ); +var racbrcntatbsc1sc2n = require( './fixtures/ra_cb_rc_nta_tb_sc1_sc2n.json' ); +var racbrcntatbsc1nsc2n = require( './fixtures/ra_cb_rc_nta_tb_sc1n_sc2n.json' ); +var rarbrcntantboa = require( './fixtures/ra_rb_rc_nta_ntb_oa.json' ); +var rarbrcntantbob = require( './fixtures/ra_rb_rc_nta_ntb_ob.json' ); +var rarbrcntantboc = require( './fixtures/ra_rb_rc_nta_ntb_oc.json' ); +var cap = require( './fixtures/ra_rb_rc_nta_ntb_complex_access_pattern.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 sgemm, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function has an arity of 19', function test( t ) { + t.strictEqual( sgemm.length, 19, 'returns expected value' ); + t.end(); +}); + +tape( 'the function throws an error if provided an invalid first argument', function test( t ) { + var values; + var data; + var i; + + data = rarbrcntantb; + + values = [ + 'foo', + 'bar', + 'beep', + 'boop' + ]; + + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + sgemm( value, data.transB, data.M, data.N, data.K, data.alpha, new Float32Array( data.A ), data.strideA1, data.strideA2, data.offsetA, new Float32Array( data.B ), data.strideB1, data.strideB2, data.offsetB, data.beta, new Float32Array( data.C ), data.strideC1, data.strideC2, data.offsetC ); + }; + } +}); + +tape( 'the function throws an error if provided an invalid second argument', function test( t ) { + var values; + var data; + var i; + + data = rarbrcntantb; + + values = [ + 'foo', + 'bar', + 'beep', + 'boop' + ]; + + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + sgemm( data.transA, value, data.M, data.N, data.K, data.alpha, new Float32Array( data.A ), data.strideA1, data.strideA2, data.offsetA, new Float32Array( data.B ), data.strideB1, data.strideB2, data.offsetB, data.beta, new Float32Array( data.C ), data.strideC1, data.strideC2, data.offsetC ); + }; + } +}); + +tape( 'the function throws an error if provided an invalid third argument', function test( t ) { + var values; + var data; + var i; + + data = rarbrcntantb; + + values = [ + -1, + -2, + -3 + ]; + + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + sgemm( data.transA, data.transB, value, data.N, data.K, data.alpha, new Float32Array( data.A ), data.strideA1, data.strideA2, data.offsetA, new Float32Array( data.B ), data.strideB1, data.strideB2, data.offsetB, data.beta, new Float32Array( data.C ), data.strideC1, data.strideC2, data.offsetC ); + }; + } +}); + +tape( 'the function throws an error if provided an invalid fourth argument', function test( t ) { + var values; + var data; + var i; + + data = rarbrcntantb; + + values = [ + -1, + -2, + -3 + ]; + + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + sgemm( data.transA, data.transB, data.M, value, data.K, data.alpha, new Float32Array( data.A ), data.strideA1, data.strideA2, data.offsetA, new Float32Array( data.B ), data.strideB1, data.strideB2, data.offsetB, data.beta, new Float32Array( data.C ), data.strideC1, data.strideC2, data.offsetC ); + }; + } +}); + +tape( 'the function throws an error if provided an invalid fifth argument', function test( t ) { + var values; + var data; + var i; + + data = rarbrcntantb; + + values = [ + -1, + -2, + -3 + ]; + + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + sgemm( data.transA, data.transB, data.M, data.N, value, data.alpha, new Float32Array( data.A ), data.strideA1, data.strideA2, data.offsetA, new Float32Array( data.B ), data.strideB1, data.strideB2, data.offsetB, data.beta, new Float32Array( data.C ), data.strideC1, data.strideC2, data.offsetC ); + }; + } +}); + +tape( 'the function performs one of the matrix-matrix operation `C = α*op(A)*op(B) + β*C` where `op(A)` is one of the `op(A) = A`, or `op(A) = A^T (column_major, column_major, column_major, no-transpose, no-transpose)', function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = cacbccntantb; + + a = new Float32Array( data.A ); + b = new Float32Array( data.B ); + c = new Float32Array( data.C ); + + expected = new Float32Array( data.C_out ); + + out = sgemm( data.transA, data.transB, data.M, data.N, data.K, data.alpha, a, data.strideA1, data.strideA2, data.offsetA, b, data.strideB1, data.strideB2, data.offsetB, data.beta, c, data.strideC1, data.strideC2, data.offsetC ); + isApprox( t, c, expected, 2.0 ); + t.strictEqual( out, c, 'returns expected value' ); + t.end(); +}); + +tape( 'the function performs one of the matrix-matrix operation `C = α*op(A)*op(B) + β*C` where `op(A)` is one of the `op(A) = A`, or `op(A) = A^T (column_major, column_major, column_major, transpose, no-transpose)', function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = cacbcctantb; + + a = new Float32Array( data.A ); + b = new Float32Array( data.B ); + c = new Float32Array( data.C ); + + expected = new Float32Array( data.C_out ); + + out = sgemm( data.transA, data.transB, data.M, data.N, data.K, data.alpha, a, data.strideA1, data.strideA2, data.offsetA, b, data.strideB1, data.strideB2, data.offsetB, data.beta, c, data.strideC1, data.strideC2, data.offsetC ); + isApprox( t, c, expected, 2.0 ); + t.strictEqual( out, c, 'returns expected value' ); + t.end(); +}); + +tape( 'the function performs one of the matrix-matrix operation `C = α*op(A)*op(B) + β*C` where `op(A)` is one of the `op(A) = A`, or `op(A) = A^T (column_major, column_major, column_major, no-transpose, transpose)', function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = cacbccntatb; + + a = new Float32Array( data.A ); + b = new Float32Array( data.B ); + c = new Float32Array( data.C ); + + expected = new Float32Array( data.C_out ); + + out = sgemm( data.transA, data.transB, data.M, data.N, data.K, data.alpha, a, data.strideA1, data.strideA2, data.offsetA, b, data.strideB1, data.strideB2, data.offsetB, data.beta, c, data.strideC1, data.strideC2, data.offsetC ); + isApprox( t, c, expected, 2.0 ); + t.strictEqual( out, c, 'returns expected value' ); + t.end(); +}); + +tape( 'the function performs one of the matrix-matrix operation `C = α*op(A)*op(B) + β*C` where `op(A)` is one of the `op(A) = A`, or `op(A) = A^T (column_major, column_major, column_major, transpose, transpose)', function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = cacbcctatb; + + a = new Float32Array( data.A ); + b = new Float32Array( data.B ); + c = new Float32Array( data.C ); + + expected = new Float32Array( data.C_out ); + + out = sgemm( data.transA, data.transB, data.M, data.N, data.K, data.alpha, a, data.strideA1, data.strideA2, data.offsetA, b, data.strideB1, data.strideB2, data.offsetB, data.beta, c, data.strideC1, data.strideC2, data.offsetC ); + isApprox( t, c, expected, 2.0 ); + t.strictEqual( out, c, 'returns expected value' ); + t.end(); +}); + +tape( 'the function performs one of the matrix-matrix operation `C = α*op(A)*op(B) + β*C` where `op(A)` is one of the `op(A) = A`, or `op(A) = A^T (column_major, column_major, row_major, no-transpose, no-transpose)', function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = cacbrcntantb; + + a = new Float32Array( data.A ); + b = new Float32Array( data.B ); + c = new Float32Array( data.C ); + + expected = new Float32Array( data.C_out ); + + out = sgemm( data.transA, data.transB, data.M, data.N, data.K, data.alpha, a, data.strideA1, data.strideA2, data.offsetA, b, data.strideB1, data.strideB2, data.offsetB, data.beta, c, data.strideC1, data.strideC2, data.offsetC ); + isApprox( t, c, expected, 2.0 ); + t.strictEqual( out, c, 'returns expected value' ); + t.end(); +}); + +tape( 'the function performs one of the matrix-matrix operation `C = α*op(A)*op(B) + β*C` where `op(A)` is one of the `op(A) = A`, or `op(A) = A^T (column_major, column_major, row_major, transpose, no-transpose)', function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = cacbrctantb; + + a = new Float32Array( data.A ); + b = new Float32Array( data.B ); + c = new Float32Array( data.C ); + + expected = new Float32Array( data.C_out ); + + out = sgemm( data.transA, data.transB, data.M, data.N, data.K, data.alpha, a, data.strideA1, data.strideA2, data.offsetA, b, data.strideB1, data.strideB2, data.offsetB, data.beta, c, data.strideC1, data.strideC2, data.offsetC ); + isApprox( t, c, expected, 2.0 ); + t.strictEqual( out, c, 'returns expected value' ); + t.end(); +}); + +tape( 'the function performs one of the matrix-matrix operation `C = α*op(A)*op(B) + β*C` where `op(A)` is one of the `op(A) = A`, or `op(A) = A^T (column_major, column_major, row_major, no-transpose, transpose)', function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = cacbrcntatb; + + a = new Float32Array( data.A ); + b = new Float32Array( data.B ); + c = new Float32Array( data.C ); + + expected = new Float32Array( data.C_out ); + + out = sgemm( data.transA, data.transB, data.M, data.N, data.K, data.alpha, a, data.strideA1, data.strideA2, data.offsetA, b, data.strideB1, data.strideB2, data.offsetB, data.beta, c, data.strideC1, data.strideC2, data.offsetC ); + isApprox( t, c, expected, 2.0 ); + t.strictEqual( out, c, 'returns expected value' ); + t.end(); +}); + +tape( 'the function performs one of the matrix-matrix operation `C = α*op(A)*op(B) + β*C` where `op(A)` is one of the `op(A) = A`, or `op(A) = A^T (column_major, column_major, row_major, transpose, transpose)', function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = cacbrctatb; + + a = new Float32Array( data.A ); + b = new Float32Array( data.B ); + c = new Float32Array( data.C ); + + expected = new Float32Array( data.C_out ); + + out = sgemm( data.transA, data.transB, data.M, data.N, data.K, data.alpha, a, data.strideA1, data.strideA2, data.offsetA, b, data.strideB1, data.strideB2, data.offsetB, data.beta, c, data.strideC1, data.strideC2, data.offsetC ); + isApprox( t, c, expected, 2.0 ); + t.strictEqual( out, c, 'returns expected value' ); + t.end(); +}); + +tape( 'the function performs one of the matrix-matrix operation `C = α*op(A)*op(B) + β*C` where `op(A)` is one of the `op(A) = A`, or `op(A) = A^T (column_major, row_major, column_major, no-transpose, no-transpose)', function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = carbccntantb; + + a = new Float32Array( data.A ); + b = new Float32Array( data.B ); + c = new Float32Array( data.C ); + + expected = new Float32Array( data.C_out ); + + out = sgemm( data.transA, data.transB, data.M, data.N, data.K, data.alpha, a, data.strideA1, data.strideA2, data.offsetA, b, data.strideB1, data.strideB2, data.offsetB, data.beta, c, data.strideC1, data.strideC2, data.offsetC ); + isApprox( t, c, expected, 2.0 ); + t.strictEqual( out, c, 'returns expected value' ); + t.end(); +}); + +tape( 'the function performs one of the matrix-matrix operation `C = α*op(A)*op(B) + β*C` where `op(A)` is one of the `op(A) = A`, or `op(A) = A^T (column_major, row_major, column_major, transpose, no-transpose)', function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = carbcctantb; + + a = new Float32Array( data.A ); + b = new Float32Array( data.B ); + c = new Float32Array( data.C ); + + expected = new Float32Array( data.C_out ); + + out = sgemm( data.transA, data.transB, data.M, data.N, data.K, data.alpha, a, data.strideA1, data.strideA2, data.offsetA, b, data.strideB1, data.strideB2, data.offsetB, data.beta, c, data.strideC1, data.strideC2, data.offsetC ); + isApprox( t, c, expected, 2.0 ); + t.strictEqual( out, c, 'returns expected value' ); + t.end(); +}); + +tape( 'the function performs one of the matrix-matrix operation `C = α*op(A)*op(B) + β*C` where `op(A)` is one of the `op(A) = A`, or `op(A) = A^T (column_major, row_major, column_major, no-transpose, transpose)', function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = carbccntatb; + + a = new Float32Array( data.A ); + b = new Float32Array( data.B ); + c = new Float32Array( data.C ); + + expected = new Float32Array( data.C_out ); + + out = sgemm( data.transA, data.transB, data.M, data.N, data.K, data.alpha, a, data.strideA1, data.strideA2, data.offsetA, b, data.strideB1, data.strideB2, data.offsetB, data.beta, c, data.strideC1, data.strideC2, data.offsetC ); + isApprox( t, c, expected, 2.0 ); + t.strictEqual( out, c, 'returns expected value' ); + t.end(); +}); + +tape( 'the function performs one of the matrix-matrix operation `C = α*op(A)*op(B) + β*C` where `op(A)` is one of the `op(A) = A`, or `op(A) = A^T (column_major, row_major, column_major, transpose, transpose)', function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = carbcctatb; + + a = new Float32Array( data.A ); + b = new Float32Array( data.B ); + c = new Float32Array( data.C ); + + expected = new Float32Array( data.C_out ); + + out = sgemm( data.transA, data.transB, data.M, data.N, data.K, data.alpha, a, data.strideA1, data.strideA2, data.offsetA, b, data.strideB1, data.strideB2, data.offsetB, data.beta, c, data.strideC1, data.strideC2, data.offsetC ); + isApprox( t, c, expected, 2.0 ); + t.strictEqual( out, c, 'returns expected value' ); + t.end(); +}); + +tape( 'the function performs one of the matrix-matrix operation `C = α*op(A)*op(B) + β*C` where `op(A)` is one of the `op(A) = A`, or `op(A) = A^T (column_major, row_major, row_major, no-transpose, no-transpose)', function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = carbrcntantb; + + a = new Float32Array( data.A ); + b = new Float32Array( data.B ); + c = new Float32Array( data.C ); + + expected = new Float32Array( data.C_out ); + + out = sgemm( data.transA, data.transB, data.M, data.N, data.K, data.alpha, a, data.strideA1, data.strideA2, data.offsetA, b, data.strideB1, data.strideB2, data.offsetB, data.beta, c, data.strideC1, data.strideC2, data.offsetC ); + isApprox( t, c, expected, 2.0 ); + t.strictEqual( out, c, 'returns expected value' ); + t.end(); +}); + +tape( 'the function performs one of the matrix-matrix operation `C = α*op(A)*op(B) + β*C` where `op(A)` is one of the `op(A) = A`, or `op(A) = A^T (column_major, row_major, row_major, transpose, no-transpose)', function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = carbrctantb; + + a = new Float32Array( data.A ); + b = new Float32Array( data.B ); + c = new Float32Array( data.C ); + + expected = new Float32Array( data.C_out ); + + out = sgemm( data.transA, data.transB, data.M, data.N, data.K, data.alpha, a, data.strideA1, data.strideA2, data.offsetA, b, data.strideB1, data.strideB2, data.offsetB, data.beta, c, data.strideC1, data.strideC2, data.offsetC ); + isApprox( t, c, expected, 2.0 ); + t.strictEqual( out, c, 'returns expected value' ); + t.end(); +}); + +tape( 'the function performs one of the matrix-matrix operation `C = α*op(A)*op(B) + β*C` where `op(A)` is one of the `op(A) = A`, or `op(A) = A^T (column_major, row_major, row_major, no-transpose, transpose)', function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = carbrcntatb; + + a = new Float32Array( data.A ); + b = new Float32Array( data.B ); + c = new Float32Array( data.C ); + + expected = new Float32Array( data.C_out ); + + out = sgemm( data.transA, data.transB, data.M, data.N, data.K, data.alpha, a, data.strideA1, data.strideA2, data.offsetA, b, data.strideB1, data.strideB2, data.offsetB, data.beta, c, data.strideC1, data.strideC2, data.offsetC ); + isApprox( t, c, expected, 2.0 ); + t.strictEqual( out, c, 'returns expected value' ); + t.end(); +}); + +tape( 'the function performs one of the matrix-matrix operation `C = α*op(A)*op(B) + β*C` where `op(A)` is one of the `op(A) = A`, or `op(A) = A^T (column_major, row_major, row_major, transpose, transpose)', function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = carbrctatb; + + a = new Float32Array( data.A ); + b = new Float32Array( data.B ); + c = new Float32Array( data.C ); + + expected = new Float32Array( data.C_out ); + + out = sgemm( data.transA, data.transB, data.M, data.N, data.K, data.alpha, a, data.strideA1, data.strideA2, data.offsetA, b, data.strideB1, data.strideB2, data.offsetB, data.beta, c, data.strideC1, data.strideC2, data.offsetC ); + isApprox( t, c, expected, 2.0 ); + t.strictEqual( out, c, 'returns expected value' ); + t.end(); +}); + +tape( 'the function performs one of the matrix-matrix operation `C = α*op(A)*op(B) + β*C` where `op(A)` is one of the `op(A) = A`, or `op(A) = A^T (row_major, column_major, column_major, no-transpose, no-transpose)', function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = racbccntantb; + + a = new Float32Array( data.A ); + b = new Float32Array( data.B ); + c = new Float32Array( data.C ); + + expected = new Float32Array( data.C_out ); + + out = sgemm( data.transA, data.transB, data.M, data.N, data.K, data.alpha, a, data.strideA1, data.strideA2, data.offsetA, b, data.strideB1, data.strideB2, data.offsetB, data.beta, c, data.strideC1, data.strideC2, data.offsetC ); + isApprox( t, c, expected, 2.0 ); + t.strictEqual( out, c, 'returns expected value' ); + t.end(); +}); + +tape( 'the function performs one of the matrix-matrix operation `C = α*op(A)*op(B) + β*C` where `op(A)` is one of the `op(A) = A`, or `op(A) = A^T (row_major, column_major, column_major, transpose, no-transpose)', function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = racbcctantb; + + a = new Float32Array( data.A ); + b = new Float32Array( data.B ); + c = new Float32Array( data.C ); + + expected = new Float32Array( data.C_out ); + + out = sgemm( data.transA, data.transB, data.M, data.N, data.K, data.alpha, a, data.strideA1, data.strideA2, data.offsetA, b, data.strideB1, data.strideB2, data.offsetB, data.beta, c, data.strideC1, data.strideC2, data.offsetC ); + isApprox( t, c, expected, 2.0 ); + t.strictEqual( out, c, 'returns expected value' ); + t.end(); +}); + +tape( 'the function performs one of the matrix-matrix operation `C = α*op(A)*op(B) + β*C` where `op(A)` is one of the `op(A) = A`, or `op(A) = A^T (row_major, column_major, column_major, no-transpose, transpose)', function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = racbccntatb; + + a = new Float32Array( data.A ); + b = new Float32Array( data.B ); + c = new Float32Array( data.C ); + + expected = new Float32Array( data.C_out ); + + out = sgemm( data.transA, data.transB, data.M, data.N, data.K, data.alpha, a, data.strideA1, data.strideA2, data.offsetA, b, data.strideB1, data.strideB2, data.offsetB, data.beta, c, data.strideC1, data.strideC2, data.offsetC ); + isApprox( t, c, expected, 2.0 ); + t.strictEqual( out, c, 'returns expected value' ); + t.end(); +}); + +tape( 'the function performs one of the matrix-matrix operation `C = α*op(A)*op(B) + β*C` where `op(A)` is one of the `op(A) = A`, or `op(A) = A^T (row_major, column_major, column_major, transpose, transpose)', function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = racbcctatb; + + a = new Float32Array( data.A ); + b = new Float32Array( data.B ); + c = new Float32Array( data.C ); + + expected = new Float32Array( data.C_out ); + + out = sgemm( data.transA, data.transB, data.M, data.N, data.K, data.alpha, a, data.strideA1, data.strideA2, data.offsetA, b, data.strideB1, data.strideB2, data.offsetB, data.beta, c, data.strideC1, data.strideC2, data.offsetC ); + isApprox( t, c, expected, 2.0 ); + t.strictEqual( out, c, 'returns expected value' ); + t.end(); +}); + +tape( 'the function performs one of the matrix-matrix operation `C = α*op(A)*op(B) + β*C` where `op(A)` is one of the `op(A) = A`, or `op(A) = A^T (row_major, column_major, row_major, no-transpose, no-transpose)', function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = racbrcntantb; + + a = new Float32Array( data.A ); + b = new Float32Array( data.B ); + c = new Float32Array( data.C ); + + expected = new Float32Array( data.C_out ); + + out = sgemm( data.transA, data.transB, data.M, data.N, data.K, data.alpha, a, data.strideA1, data.strideA2, data.offsetA, b, data.strideB1, data.strideB2, data.offsetB, data.beta, c, data.strideC1, data.strideC2, data.offsetC ); + isApprox( t, c, expected, 2.0 ); + t.strictEqual( out, c, 'returns expected value' ); + t.end(); +}); + +tape( 'the function performs one of the matrix-matrix operation `C = α*op(A)*op(B) + β*C` where `op(A)` is one of the `op(A) = A`, or `op(A) = A^T (row_major, column_major, row_major, transpose, no-transpose)', function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = racbrctantb; + + a = new Float32Array( data.A ); + b = new Float32Array( data.B ); + c = new Float32Array( data.C ); + + expected = new Float32Array( data.C_out ); + + out = sgemm( data.transA, data.transB, data.M, data.N, data.K, data.alpha, a, data.strideA1, data.strideA2, data.offsetA, b, data.strideB1, data.strideB2, data.offsetB, data.beta, c, data.strideC1, data.strideC2, data.offsetC ); + isApprox( t, c, expected, 2.0 ); + t.strictEqual( out, c, 'returns expected value' ); + t.end(); +}); + +tape( 'the function performs one of the matrix-matrix operation `C = α*op(A)*op(B) + β*C` where `op(A)` is one of the `op(A) = A`, or `op(A) = A^T (row_major, column_major, row_major, no-transpose, transpose)', function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = racbrcntatb; + + a = new Float32Array( data.A ); + b = new Float32Array( data.B ); + c = new Float32Array( data.C ); + + expected = new Float32Array( data.C_out ); + + out = sgemm( data.transA, data.transB, data.M, data.N, data.K, data.alpha, a, data.strideA1, data.strideA2, data.offsetA, b, data.strideB1, data.strideB2, data.offsetB, data.beta, c, data.strideC1, data.strideC2, data.offsetC ); + isApprox( t, c, expected, 2.0 ); + t.strictEqual( out, c, 'returns expected value' ); + t.end(); +}); + +tape( 'the function performs one of the matrix-matrix operation `C = α*op(A)*op(B) + β*C` where `op(A)` is one of the `op(A) = A`, or `op(A) = A^T (row_major, column_major, row_major, transpose, transpose)', function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = racbrctatb; + + a = new Float32Array( data.A ); + b = new Float32Array( data.B ); + c = new Float32Array( data.C ); + + expected = new Float32Array( data.C_out ); + + out = sgemm( data.transA, data.transB, data.M, data.N, data.K, data.alpha, a, data.strideA1, data.strideA2, data.offsetA, b, data.strideB1, data.strideB2, data.offsetB, data.beta, c, data.strideC1, data.strideC2, data.offsetC ); + isApprox( t, c, expected, 2.0 ); + t.strictEqual( out, c, 'returns expected value' ); + t.end(); +}); + +tape( 'the function performs one of the matrix-matrix operation `C = α*op(A)*op(B) + β*C` where `op(A)` is one of the `op(A) = A`, or `op(A) = A^T (row_major, row_major, column_major, no-transpose, no-transpose)', function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = rarbccntantb; + + a = new Float32Array( data.A ); + b = new Float32Array( data.B ); + c = new Float32Array( data.C ); + + expected = new Float32Array( data.C_out ); + + out = sgemm( data.transA, data.transB, data.M, data.N, data.K, data.alpha, a, data.strideA1, data.strideA2, data.offsetA, b, data.strideB1, data.strideB2, data.offsetB, data.beta, c, data.strideC1, data.strideC2, data.offsetC ); + isApprox( t, c, expected, 2.0 ); + t.strictEqual( out, c, 'returns expected value' ); + t.end(); +}); + +tape( 'the function performs one of the matrix-matrix operation `C = α*op(A)*op(B) + β*C` where `op(A)` is one of the `op(A) = A`, or `op(A) = A^T (row_major, row_major, column_major, transpose, no-transpose)', function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = rarbcctantb; + + a = new Float32Array( data.A ); + b = new Float32Array( data.B ); + c = new Float32Array( data.C ); + + expected = new Float32Array( data.C_out ); + + out = sgemm( data.transA, data.transB, data.M, data.N, data.K, data.alpha, a, data.strideA1, data.strideA2, data.offsetA, b, data.strideB1, data.strideB2, data.offsetB, data.beta, c, data.strideC1, data.strideC2, data.offsetC ); + isApprox( t, c, expected, 2.0 ); + t.strictEqual( out, c, 'returns expected value' ); + t.end(); +}); + +tape( 'the function performs one of the matrix-matrix operation `C = α*op(A)*op(B) + β*C` where `op(A)` is one of the `op(A) = A`, or `op(A) = A^T (row_major, row_major, column_major, no-transpose, transpose)', function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = rarbccntatb; + + a = new Float32Array( data.A ); + b = new Float32Array( data.B ); + c = new Float32Array( data.C ); + + expected = new Float32Array( data.C_out ); + + out = sgemm( data.transA, data.transB, data.M, data.N, data.K, data.alpha, a, data.strideA1, data.strideA2, data.offsetA, b, data.strideB1, data.strideB2, data.offsetB, data.beta, c, data.strideC1, data.strideC2, data.offsetC ); + isApprox( t, c, expected, 2.0 ); + t.strictEqual( out, c, 'returns expected value' ); + t.end(); +}); + +tape( 'the function performs one of the matrix-matrix operation `C = α*op(A)*op(B) + β*C` where `op(A)` is one of the `op(A) = A`, or `op(A) = A^T (row_major, row_major, column_major, transpose, transpose)', function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = rarbcctatb; + + a = new Float32Array( data.A ); + b = new Float32Array( data.B ); + c = new Float32Array( data.C ); + + expected = new Float32Array( data.C_out ); + + out = sgemm( data.transA, data.transB, data.M, data.N, data.K, data.alpha, a, data.strideA1, data.strideA2, data.offsetA, b, data.strideB1, data.strideB2, data.offsetB, data.beta, c, data.strideC1, data.strideC2, data.offsetC ); + isApprox( t, c, expected, 2.0 ); + t.strictEqual( out, c, 'returns expected value' ); + t.end(); +}); + +tape( 'the function performs one of the matrix-matrix operation `C = α*op(A)*op(B) + β*C` where `op(A)` is one of the `op(A) = A`, or `op(A) = A^T (row_major, row_major, row_major, no-transpose, no-transpose)', function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = rarbrcntantb; + + a = new Float32Array( data.A ); + b = new Float32Array( data.B ); + c = new Float32Array( data.C ); + + expected = new Float32Array( data.C_out ); + + out = sgemm( data.transA, data.transB, data.M, data.N, data.K, data.alpha, a, data.strideA1, data.strideA2, data.offsetA, b, data.strideB1, data.strideB2, data.offsetB, data.beta, c, data.strideC1, data.strideC2, data.offsetC ); + isApprox( t, c, expected, 2.0 ); + t.strictEqual( out, c, 'returns expected value' ); + t.end(); +}); + +tape( 'the function performs one of the matrix-matrix operation `C = α*op(A)*op(B) + β*C` where `op(A)` is one of the `op(A) = A`, or `op(A) = A^T (row_major, row_major, row_major, transpose, no-transpose)', function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = rarbrctantb; + + a = new Float32Array( data.A ); + b = new Float32Array( data.B ); + c = new Float32Array( data.C ); + + expected = new Float32Array( data.C_out ); + + out = sgemm( data.transA, data.transB, data.M, data.N, data.K, data.alpha, a, data.strideA1, data.strideA2, data.offsetA, b, data.strideB1, data.strideB2, data.offsetB, data.beta, c, data.strideC1, data.strideC2, data.offsetC ); + isApprox( t, c, expected, 2.0 ); + t.strictEqual( out, c, 'returns expected value' ); + t.end(); +}); + +tape( 'the function performs one of the matrix-matrix operation `C = α*op(A)*op(B) + β*C` where `op(A)` is one of the `op(A) = A`, or `op(A) = A^T (row_major, row_major, row_major, no-transpose, transpose)', function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = rarbrcntatb; + + a = new Float32Array( data.A ); + b = new Float32Array( data.B ); + c = new Float32Array( data.C ); + + expected = new Float32Array( data.C_out ); + + out = sgemm( data.transA, data.transB, data.M, data.N, data.K, data.alpha, a, data.strideA1, data.strideA2, data.offsetA, b, data.strideB1, data.strideB2, data.offsetB, data.beta, c, data.strideC1, data.strideC2, data.offsetC ); + isApprox( t, c, expected, 2.0 ); + t.strictEqual( out, c, 'returns expected value' ); + t.end(); +}); + +tape( 'the function performs one of the matrix-matrix operation `C = α*op(A)*op(B) + β*C` where `op(A)` is one of the `op(A) = A`, or `op(A) = A^T (row_major, row_major, row_major, transpose, transpose)', function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = rarbrctatb; + + a = new Float32Array( data.A ); + b = new Float32Array( data.B ); + c = new Float32Array( data.C ); + + expected = new Float32Array( data.C_out ); + + out = sgemm( data.transA, data.transB, data.M, data.N, data.K, data.alpha, a, data.strideA1, data.strideA2, data.offsetA, b, data.strideB1, data.strideB2, data.offsetB, data.beta, c, data.strideC1, data.strideC2, data.offsetC ); + isApprox( t, c, expected, 2.0 ); + t.strictEqual( out, c, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns a reference to the third input matrix', function test( t ) { + var data; + var out; + var a; + var b; + var c; + + data = rarbrcntantb; + + a = new Float32Array( data.A ); + b = new Float32Array( data.B ); + c = new Float32Array( data.C ); + + out = sgemm( data.transA, data.transB, data.M, data.N, data.K, data.alpha, a, data.strideA1, data.strideA2, data.offsetA, b, data.strideB1, data.strideB2, data.offsetB, data.beta, c, data.strideC1, data.strideC2, data.offsetC ); + t.strictEqual( out, c, 'returns expected value' ); + t.end(); +}); + +tape( 'if either `M` or `N` is `0`, the function returns the third input matrix unchanged', function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = rarbrctatb; + + a = new Float32Array( data.A ); + b = new Float32Array( data.B ); + c = new Float32Array( data.C ); + + expected = new Float32Array( data.C ); + + out = sgemm( data.transA, data.transB, 0, data.N, data.K, data.alpha, a, data.strideA1, data.strideA2, data.offsetA, b, data.strideB1, data.strideB2, data.offsetB, data.beta, c, data.strideC1, data.strideC2, data.offsetC ); + t.strictEqual( out, c, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + out = sgemm( data.transA, data.transB, data.M, 0, data.K, data.alpha, a, data.strideA1, data.strideA2, data.offsetA, b, data.strideB1, data.strideB2, data.offsetB, data.beta, c, data.strideC1, data.strideC2, data.offsetC ); + t.strictEqual( out, c, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'if `α` is `0` or `K` is `0` and `β` is `1`, the function returns the third input matrix unchanged', function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = rarbrctatb; + + a = new Float32Array( data.A ); + b = new Float32Array( data.B ); + c = new Float32Array( data.C ); + + expected = new Float32Array( data.C ); + + out = sgemm( data.transA, data.transB, data.M, data.N, data.K, 0.0, a, data.strideA1, data.strideA2, data.offsetA, b, data.strideB1, data.strideB2, data.offsetB, 1.0, c, data.strideC1, data.strideC2, data.offsetC ); + t.strictEqual( out, c, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + out = sgemm( data.transA, data.transB, data.M, data.N, 0, data.alpha, a, data.strideA1, data.strideA2, data.offsetA, b, data.strideB1, data.strideB2, data.offsetB, 1.0, c, data.strideC1, data.strideC2, data.offsetC ); + t.strictEqual( out, c, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function supports specifying the strides of the first and second dimensions of `A` (column-major, row-major, column-major, transpose, no-transpose)', function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = carbcctantbsa1sa2; + + a = new Float32Array( data.A ); + b = new Float32Array( data.B ); + c = new Float32Array( data.C ); + + expected = new Float32Array( data.C_out ); + + out = sgemm( data.transA, data.transB, data.M, data.N, data.K, data.alpha, a, data.strideA1, data.strideA2, data.offsetA, b, data.strideB1, data.strideB2, data.offsetB, data.beta, c, data.strideC1, data.strideC2, data.offsetC ); + isApprox( t, c, expected, 2.0 ); + t.strictEqual( out, c, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports a negative stride for the first dimension of `A` (column-major, row-major, column-major, transpose, no-transpose)', function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = carbcctantbsa1nsa2; + + a = new Float32Array( data.A ); + b = new Float32Array( data.B ); + c = new Float32Array( data.C ); + + expected = new Float32Array( data.C_out ); + + out = sgemm( data.transA, data.transB, data.M, data.N, data.K, data.alpha, a, data.strideA1, data.strideA2, data.offsetA, b, data.strideB1, data.strideB2, data.offsetB, data.beta, c, data.strideC1, data.strideC2, data.offsetC ); + isApprox( t, c, expected, 2.0 ); + t.strictEqual( out, c, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports a negative stride for the second dimension of `A` (column-major, row-major, column-major, transpose, no-transpose)', function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = carbcctantbsa1sa2n; + + a = new Float32Array( data.A ); + b = new Float32Array( data.B ); + c = new Float32Array( data.C ); + + expected = new Float32Array( data.C_out ); + + out = sgemm( data.transA, data.transB, data.M, data.N, data.K, data.alpha, a, data.strideA1, data.strideA2, data.offsetA, b, data.strideB1, data.strideB2, data.offsetB, data.beta, c, data.strideC1, data.strideC2, data.offsetC ); + isApprox( t, c, expected, 2.0 ); + t.strictEqual( out, c, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports negative strides for `A` (column-major, row-major, column-major, transpose, no-transpose)', function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = carbcctantbsa1nsa2n; + + a = new Float32Array( data.A ); + b = new Float32Array( data.B ); + c = new Float32Array( data.C ); + + expected = new Float32Array( data.C_out ); + + out = sgemm( data.transA, data.transB, data.M, data.N, data.K, data.alpha, a, data.strideA1, data.strideA2, data.offsetA, b, data.strideB1, data.strideB2, data.offsetB, data.beta, c, data.strideC1, data.strideC2, data.offsetC ); + isApprox( t, c, expected, 2.0 ); + t.strictEqual( out, c, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports specifying an offset parameter for `A` (row-major, row-major, row-major, no-transpose, no-transpose)', function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = rarbrcntantboa; + + a = new Float32Array( data.A ); + b = new Float32Array( data.B ); + c = new Float32Array( data.C ); + + expected = new Float32Array( data.C_out ); + + out = sgemm( data.transA, data.transB, data.M, data.N, data.K, data.alpha, a, data.strideA1, data.strideA2, data.offsetA, b, data.strideB1, data.strideB2, data.offsetB, data.beta, c, data.strideC1, data.strideC2, data.offsetC ); + isApprox( t, c, expected, 2.0 ); + t.strictEqual( out, c, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports specifying the strides of the first and second dimensions of `B` (row-major, row-major, column-major, transpose, no-transpose)', function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = rarbcctantbsb1sb2; + + a = new Float32Array( data.A ); + b = new Float32Array( data.B ); + c = new Float32Array( data.C ); + + expected = new Float32Array( data.C_out ); + + out = sgemm( data.transA, data.transB, data.M, data.N, data.K, data.alpha, a, data.strideA1, data.strideA2, data.offsetA, b, data.strideB1, data.strideB2, data.offsetB, data.beta, c, data.strideC1, data.strideC2, data.offsetC ); + isApprox( t, c, expected, 2.0 ); + t.strictEqual( out, c, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports a negative stride for the first dimension of `B` (row-major, row-major, column-major, transpose, no-transpose)', function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = rarbcctantbsb1nsb2; + + a = new Float32Array( data.A ); + b = new Float32Array( data.B ); + c = new Float32Array( data.C ); + + expected = new Float32Array( data.C_out ); + + out = sgemm( data.transA, data.transB, data.M, data.N, data.K, data.alpha, a, data.strideA1, data.strideA2, data.offsetA, b, data.strideB1, data.strideB2, data.offsetB, data.beta, c, data.strideC1, data.strideC2, data.offsetC ); + isApprox( t, c, expected, 2.0 ); + t.strictEqual( out, c, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports a negative stride for the second dimension of `B` (row-major, row-major, column-major, transpose, no-transpose)', function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = rarbcctantbsb1sb2n; + + a = new Float32Array( data.A ); + b = new Float32Array( data.B ); + c = new Float32Array( data.C ); + + expected = new Float32Array( data.C_out ); + + out = sgemm( data.transA, data.transB, data.M, data.N, data.K, data.alpha, a, data.strideA1, data.strideA2, data.offsetA, b, data.strideB1, data.strideB2, data.offsetB, data.beta, c, data.strideC1, data.strideC2, data.offsetC ); + isApprox( t, c, expected, 2.0 ); + t.strictEqual( out, c, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports negative strides for `B` (row-major, row-major, column-major, transpose, no-transpose)', function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = rarbcctantbsb1nsb2n; + + a = new Float32Array( data.A ); + b = new Float32Array( data.B ); + c = new Float32Array( data.C ); + + expected = new Float32Array( data.C_out ); + + out = sgemm( data.transA, data.transB, data.M, data.N, data.K, data.alpha, a, data.strideA1, data.strideA2, data.offsetA, b, data.strideB1, data.strideB2, data.offsetB, data.beta, c, data.strideC1, data.strideC2, data.offsetC ); + isApprox( t, c, expected, 2.0 ); + t.strictEqual( out, c, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports specifying an offset parameter for `B` (row-major, row-major, row-major, no-transpose, no-transpose)', function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = rarbrcntantbob; + + a = new Float32Array( data.A ); + b = new Float32Array( data.B ); + c = new Float32Array( data.C ); + + expected = new Float32Array( data.C_out ); + + out = sgemm( data.transA, data.transB, data.M, data.N, data.K, data.alpha, a, data.strideA1, data.strideA2, data.offsetA, b, data.strideB1, data.strideB2, data.offsetB, data.beta, c, data.strideC1, data.strideC2, data.offsetC ); + isApprox( t, c, expected, 2.0 ); + t.strictEqual( out, c, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports specifying the strides of the first and second dimensions of `C` (row-major, column-major, column-major, no-transpose, transpose)', function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = racbrcntatbsc1sc2; + + a = new Float32Array( data.A ); + b = new Float32Array( data.B ); + c = new Float32Array( data.C ); + + expected = new Float32Array( data.C_out ); + + out = sgemm( data.transA, data.transB, data.M, data.N, data.K, data.alpha, a, data.strideA1, data.strideA2, data.offsetA, b, data.strideB1, data.strideB2, data.offsetB, data.beta, c, data.strideC1, data.strideC2, data.offsetC ); + isApprox( t, c, expected, 2.0 ); + t.strictEqual( out, c, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports a negative stride for the first dimension of `C` (row-major, row-major, column-major, transpose, no-transpose)', function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = racbrcntatbsc1nsc2; + + a = new Float32Array( data.A ); + b = new Float32Array( data.B ); + c = new Float32Array( data.C ); + + expected = new Float32Array( data.C_out ); + + out = sgemm( data.transA, data.transB, data.M, data.N, data.K, data.alpha, a, data.strideA1, data.strideA2, data.offsetA, b, data.strideB1, data.strideB2, data.offsetB, data.beta, c, data.strideC1, data.strideC2, data.offsetC ); + isApprox( t, c, expected, 2.0 ); + t.strictEqual( out, c, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports a negative stride for the second dimension of `C` (row-major, row-major, column-major, transpose, no-transpose)', function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = racbrcntatbsc1sc2n; + + a = new Float32Array( data.A ); + b = new Float32Array( data.B ); + c = new Float32Array( data.C ); + + expected = new Float32Array( data.C_out ); + + out = sgemm( data.transA, data.transB, data.M, data.N, data.K, data.alpha, a, data.strideA1, data.strideA2, data.offsetA, b, data.strideB1, data.strideB2, data.offsetB, data.beta, c, data.strideC1, data.strideC2, data.offsetC ); + isApprox( t, c, expected, 2.0 ); + t.strictEqual( out, c, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports negative strides for `C` (row-major, row-major, column-major, transpose, no-transpose)', function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = racbrcntatbsc1nsc2n; + + a = new Float32Array( data.A ); + b = new Float32Array( data.B ); + c = new Float32Array( data.C ); + + expected = new Float32Array( data.C_out ); + + out = sgemm( data.transA, data.transB, data.M, data.N, data.K, data.alpha, a, data.strideA1, data.strideA2, data.offsetA, b, data.strideB1, data.strideB2, data.offsetB, data.beta, c, data.strideC1, data.strideC2, data.offsetC ); + isApprox( t, c, expected, 2.0 ); + t.strictEqual( out, c, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports specifying an offset parameter for `C` (row-major, row-major, row-major, no-transpose, no-transpose)', function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = rarbrcntantboc; + + a = new Float32Array( data.A ); + b = new Float32Array( data.B ); + c = new Float32Array( data.C ); + + expected = new Float32Array( data.C_out ); + + out = sgemm( data.transA, data.transB, data.M, data.N, data.K, data.alpha, a, data.strideA1, data.strideA2, data.offsetA, b, data.strideB1, data.strideB2, data.offsetB, data.beta, c, data.strideC1, data.strideC2, data.offsetC ); + isApprox( t, c, expected, 2.0 ); + t.strictEqual( out, c, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports complex access patterns (row-major, row-major, row-major, no-transpose, no-transpose)', function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = cap; + + a = new Float32Array( data.A ); + b = new Float32Array( data.B ); + c = new Float32Array( data.C ); + + expected = new Float32Array( data.C_out ); + + out = sgemm( data.transA, data.transB, data.M, data.N, data.K, data.alpha, a, data.strideA1, data.strideA2, data.offsetA, b, data.strideB1, data.strideB2, data.offsetB, data.beta, c, data.strideC1, data.strideC2, data.offsetC ); + isApprox( t, c, expected, 2.0 ); + t.strictEqual( out, c, 'returns expected value' ); + t.end(); +}); diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/test/test.sgemm.js b/lib/node_modules/@stdlib/blas/base/sgemm/test/test.sgemm.js index e69de29bb2d1..edfda2ac18ae 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/test/test.sgemm.js +++ b/lib/node_modules/@stdlib/blas/base/sgemm/test/test.sgemm.js @@ -0,0 +1,644 @@ +/** +* @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 max-len */ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var Float32Array = require( '@stdlib/array/float32' ); +var EPS = require( '@stdlib/constants/float32/eps' ); +var abs = require( '@stdlib/math/base/special/abs' ); +var sgemm = require( './../lib/sgemm.js' ); + + +// FIXTURES // + +var cntantb = require( './fixtures/column_major_nta_ntb.json' ); +var ctantb = require( './fixtures/column_major_ta_ntb.json' ); +var cntatb = require( './fixtures/column_major_nta_tb.json' ); +var ctatb = require( './fixtures/column_major_ta_tb.json' ); + +var rntantb = require( './fixtures/row_major_nta_ntb.json' ); +var rtantb = require( './fixtures/row_major_ta_ntb.json' ); +var rntatb = require( './fixtures/row_major_nta_tb.json' ); +var rtatb = require( './fixtures/row_major_ta_tb.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 sgemm, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function has an arity of 14', function test( t ) { + t.strictEqual( sgemm.length, 14, 'returns expected value' ); + t.end(); +}); + +tape( 'the function throws an error if provided an invalid first argument', function test( t ) { + var values; + var data; + var i; + + data = rntantb; + + values = [ + 'foo', + 'bar', + 'beep', + 'boop' + ]; + + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + sgemm( value, data.transA, data.transB, data.M, data.N, data.K, data.alpha, new Float32Array( data.A ), data.lda, new Float32Array( data.B ), data.ldb, data.beta, new Float32Array( data.C ), data.ldc ); + }; + } +}); + +tape( 'the function throws an error if provided an invalid second argument', function test( t ) { + var values; + var data; + var i; + + data = rntantb; + + values = [ + 'foo', + 'bar', + 'beep', + 'boop' + ]; + + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + sgemm( data.order, value, data.transB, data.M, data.N, data.K, data.alpha, new Float32Array( data.A ), data.lda, new Float32Array( data.B ), data.ldb, data.beta, new Float32Array( data.C ), data.ldc ); + }; + } +}); + +tape( 'the function throws an error if provided an invalid third argument', function test( t ) { + var values; + var data; + var i; + + data = rntantb; + + values = [ + 'foo', + 'bar', + 'beep', + 'boop' + ]; + + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + sgemm( data.order, data.transA, value, data.M, data.N, data.K, data.alpha, new Float32Array( data.A ), data.lda, new Float32Array( data.B ), data.ldb, data.beta, new Float32Array( data.C ), data.ldc ); + }; + } +}); + +tape( 'the function throws an error if provided an invalid fourth argument', function test( t ) { + var values; + var data; + var i; + + data = rntantb; + + values = [ + -1, + -2, + -3 + ]; + + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + sgemm( data.order, data.transA, data.transB, value, data.N, data.K, data.alpha, new Float32Array( data.A ), data.lda, new Float32Array( data.B ), data.ldb, data.beta, new Float32Array( data.C ), data.ldc ); + }; + } +}); + +tape( 'the function throws an error if provided an invalid fifth argument', function test( t ) { + var values; + var data; + var i; + + data = rntantb; + + values = [ + -1, + -2, + -3 + ]; + + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + sgemm( data.order, data.transA, data.transB, data.M, value, data.K, data.alpha, new Float32Array( data.A ), data.lda, new Float32Array( data.B ), data.ldb, data.beta, new Float32Array( data.C ), data.ldc ); + }; + } +}); + +tape( 'the function throws an error if provided an invalid sixth argument', function test( t ) { + var values; + var data; + var i; + + data = rntantb; + + values = [ + -1, + -2, + -3 + ]; + + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + sgemm( data.order, data.transA, data.transB, data.M, data.N, value, data.alpha, new Float32Array( data.A ), data.lda, new Float32Array( data.B ), data.ldb, data.beta, new Float32Array( data.C ), data.ldc ); + }; + } +}); + +tape( 'the function throws an error if provided an invalid ninth argument', function test( t ) { + var values; + var data; + var i; + + data = rntantb; + + values = [ + 2, + 1, + 0, + -1, + -2, + -3 + ]; + + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + sgemm( data.order, data.transA, data.transB, data.M, data.N, data.K, data.alpha, new Float32Array( data.A ), value, new Float32Array( data.B ), data.ldb, data.beta, new Float32Array( data.C ), data.ldc ); + }; + } +}); + +tape( 'the function throws an error if provided an invalid eleventh argument', function test( t ) { + var values; + var data; + var i; + + data = rntantb; + + values = [ + 3, + 2, + 1, + 0, + -1, + -2, + -3 + ]; + + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + sgemm( data.order, data.transA, data.transB, data.M, data.N, data.K, data.alpha, new Float32Array( data.A ), data.lda, new Float32Array( data.B ), value, data.beta, new Float32Array( data.C ), data.ldc ); + }; + } +}); + +tape( 'the function throws an error if provided an invalid fourteenth argument', function test( t ) { + var values; + var data; + var i; + + data = rntantb; + + values = [ + 3, + 2, + 1, + 0, + -1, + -2, + -3 + ]; + + for ( i = 0; i < values.length; i++ ) { + t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] ); + } + t.end(); + + function badValue( value ) { + return function badValue() { + sgemm( data.order, data.transA, data.transB, data.M, data.N, data.K, data.alpha, new Float32Array( data.A ), data.lda, new Float32Array( data.B ), data.ldb, data.beta, new Float32Array( data.C ), value ); + }; + } +}); + +tape( 'the function performs one of the matrix-matrix operation `C = α*op(A)*op(B) + β*C` where `op(A)` is one of the `op(A) = A`, or `op(A) = A^T (row-major, no-transpose, no-transpose)', function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = rntantb; + + a = new Float32Array( data.A ); + b = new Float32Array( data.B ); + c = new Float32Array( data.C ); + + expected = new Float32Array( data.C_out ); + + out = sgemm( data.order, data.transA, data.transB, data.M, data.N, data.K, data.alpha, a, data.lda, b, data.ldb, data.beta, c, data.ldc ); + isApprox( t, c, expected, 2.0 ); + t.strictEqual( out, c, 'returns expected value' ); + t.end(); +}); + +tape( 'the function performs one of the matrix-matrix operation `C = α*op(A)*op(B) + β*C` where `op(A)` is one of the `op(A) = A`, or `op(A) = A^T (column-major, no-transpose, no-transpose)', function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = cntantb; + + a = new Float32Array( data.A ); + b = new Float32Array( data.B ); + c = new Float32Array( data.C ); + + expected = new Float32Array( data.C_out ); + + out = sgemm( data.order, data.transA, data.transB, data.M, data.N, data.K, data.alpha, a, data.lda, b, data.ldb, data.beta, c, data.ldc ); + isApprox( t, c, expected, 2.0 ); + t.strictEqual( out, c, 'returns expected value' ); + t.end(); +}); + +tape( 'the function performs one of the matrix-matrix operation `C = α*op(A)*op(B) + β*C` where `op(A)` is one of the `op(A) = A`, or `op(A) = A^T (row-major, transpose, no-transpose)', function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = rtantb; + + a = new Float32Array( data.A ); + b = new Float32Array( data.B ); + c = new Float32Array( data.C ); + + expected = new Float32Array( data.C_out ); + + out = sgemm( data.order, data.transA, data.transB, data.M, data.N, data.K, data.alpha, a, data.lda, b, data.ldb, data.beta, c, data.ldc ); + isApprox( t, c, expected, 2.0 ); + t.strictEqual( out, c, 'returns expected value' ); + t.end(); +}); + +tape( 'the function performs one of the matrix-matrix operation `C = α*op(A)*op(B) + β*C` where `op(A)` is one of the `op(A) = A`, or `op(A) = A^T (column-major, transpose, no-transpose)', function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = ctantb; + + a = new Float32Array( data.A ); + b = new Float32Array( data.B ); + c = new Float32Array( data.C ); + + expected = new Float32Array( data.C_out ); + + out = sgemm( data.order, data.transA, data.transB, data.M, data.N, data.K, data.alpha, a, data.lda, b, data.ldb, data.beta, c, data.ldc ); + isApprox( t, c, expected, 2.0 ); + t.strictEqual( out, c, 'returns expected value' ); + t.end(); +}); + +tape( 'the function performs one of the matrix-matrix operation `C = α*op(A)*op(B) + β*C` where `op(A)` is one of the `op(A) = A`, or `op(A) = A^T (row-major, no-transpose, transpose)', function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = rntatb; + + a = new Float32Array( data.A ); + b = new Float32Array( data.B ); + c = new Float32Array( data.C ); + + expected = new Float32Array( data.C_out ); + + out = sgemm( data.order, data.transA, data.transB, data.M, data.N, data.K, data.alpha, a, data.lda, b, data.ldb, data.beta, c, data.ldc ); + isApprox( t, c, expected, 2.0 ); + t.strictEqual( out, c, 'returns expected value' ); + t.end(); +}); + +tape( 'the function performs one of the matrix-matrix operation `C = α*op(A)*op(B) + β*C` where `op(A)` is one of the `op(A) = A`, or `op(A) = A^T (column-major, no-transpose, transpose)', function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = cntatb; + + a = new Float32Array( data.A ); + b = new Float32Array( data.B ); + c = new Float32Array( data.C ); + + expected = new Float32Array( data.C_out ); + + out = sgemm( data.order, data.transA, data.transB, data.M, data.N, data.K, data.alpha, a, data.lda, b, data.ldb, data.beta, c, data.ldc ); + isApprox( t, c, expected, 2.0 ); + t.strictEqual( out, c, 'returns expected value' ); + t.end(); +}); + +tape( 'the function performs one of the matrix-matrix operation `C = α*op(A)*op(B) + β*C` where `op(A)` is one of the `op(A) = A`, or `op(A) = A^T (row-major, transpose, transpose)', function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = rtatb; + + a = new Float32Array( data.A ); + b = new Float32Array( data.B ); + c = new Float32Array( data.C ); + + expected = new Float32Array( data.C_out ); + + out = sgemm( data.order, data.transA, data.transB, data.M, data.N, data.K, data.alpha, a, data.lda, b, data.ldb, data.beta, c, data.ldc ); + isApprox( t, c, expected, 2.0 ); + t.strictEqual( out, c, 'returns expected value' ); + t.end(); +}); + +tape( 'the function performs one of the matrix-matrix operation `C = α*op(A)*op(B) + β*C` where `op(A)` is one of the `op(A) = A`, or `op(A) = A^T (column-major, transpose, transpose)', function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = ctatb; + + a = new Float32Array( data.A ); + b = new Float32Array( data.B ); + c = new Float32Array( data.C ); + + expected = new Float32Array( data.C_out ); + + out = sgemm( data.order, data.transA, data.transB, data.M, data.N, data.K, data.alpha, a, data.lda, b, data.ldb, data.beta, c, data.ldc ); + isApprox( t, c, expected, 2.0 ); + t.strictEqual( out, c, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns a reference to the third input matrix (row-major)', function test( t ) { + var data; + var out; + var a; + var b; + var c; + + data = rtatb; + + a = new Float32Array( data.A ); + b = new Float32Array( data.B ); + c = new Float32Array( data.C ); + + out = sgemm( data.order, data.transA, data.transB, data.M, data.N, data.K, data.alpha, a, data.lda, b, data.ldb, data.beta, c, data.ldc ); + t.strictEqual( out, c, 'returns expected value' ); + t.end(); +}); + +tape( 'the function returns a reference to the third input matrix (column-major)', function test( t ) { + var data; + var out; + var a; + var b; + var c; + + data = ctatb; + + a = new Float32Array( data.A ); + b = new Float32Array( data.B ); + c = new Float32Array( data.C ); + + out = sgemm( data.order, data.transA, data.transB, data.M, data.N, data.K, data.alpha, a, data.lda, b, data.ldb, data.beta, c, data.ldc ); + t.strictEqual( out, c, 'returns expected value' ); + t.end(); +}); + +tape( 'if either `M` or `N` is `0`, the function returns the third input matrix unchanged (row-major)', function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = rtatb; + + a = new Float32Array( data.A ); + b = new Float32Array( data.B ); + c = new Float32Array( data.C ); + + expected = new Float32Array( data.C ); + + out = sgemm( data.order, data.transA, data.transB, 0, data.N, data.K, data.alpha, a, data.lda, b, data.ldb, data.beta, c, data.ldc ); + t.strictEqual( out, c, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + out = sgemm( data.order, data.transA, data.transB, data.M, 0, data.K, data.alpha, a, data.lda, b, data.ldb, data.beta, c, data.ldc ); + t.strictEqual( out, c, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'if either `M` or `N` is `0`, the function returns the third input matrix unchanged (column-major)', function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = ctatb; + + a = new Float32Array( data.A ); + b = new Float32Array( data.B ); + c = new Float32Array( data.C ); + + expected = new Float32Array( data.C ); + + out = sgemm( data.order, data.transA, data.transB, 0, data.N, data.K, data.alpha, a, data.lda, b, data.ldb, data.beta, c, data.ldc ); + t.strictEqual( out, c, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + out = sgemm( data.order, data.transA, data.transB, data.M, 0, data.K, data.alpha, a, data.lda, b, data.ldb, data.beta, c, data.ldc ); + t.strictEqual( out, c, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'if `α` is `0` or `K` is `0` and `β` is `1`, the function returns the third input matrix unchanged (row-major)', function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = rtatb; + + a = new Float32Array( data.A ); + b = new Float32Array( data.B ); + c = new Float32Array( data.C ); + + expected = new Float32Array( data.C ); + + out = sgemm( data.order, data.transA, data.transB, data.M, data.N, data.K, 0.0, a, data.lda, b, data.ldb, 1.0, c, data.ldc ); + t.strictEqual( out, c, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + out = sgemm( data.order, data.transA, data.transB, data.M, data.N, 0, data.alpha, a, data.lda, b, data.ldb, 1.0, c, data.ldc ); + t.strictEqual( out, c, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'if `α` is `0` or `K` is `0` and `β` is `1`, the function returns the third input matrix unchanged (column-major)', function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = ctatb; + + a = new Float32Array( data.A ); + b = new Float32Array( data.B ); + c = new Float32Array( data.C ); + + expected = new Float32Array( data.C ); + + out = sgemm( data.order, data.transA, data.transB, data.M, data.N, data.K, 0.0, a, data.lda, b, data.ldb, 1.0, c, data.ldc ); + t.strictEqual( out, c, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + out = sgemm( data.order, data.transA, data.transB, data.M, data.N, 0, data.alpha, a, data.lda, b, data.ldb, 1.0, c, data.ldc ); + t.strictEqual( out, c, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); From 44afbdcf4db562175fdedce2b6776913745b49eb Mon Sep 17 00:00:00 2001 From: aman-095 Date: Tue, 13 Aug 2024 11:52:45 +0530 Subject: [PATCH 13/26] bench: reduce max power to 5 --- .../base/sgemm/benchmark/benchmark_ca_cb_cc_nta_ntb.ndarray.js | 2 +- .../base/sgemm/benchmark/benchmark_ca_cb_cc_nta_tb.ndarray.js | 2 +- .../base/sgemm/benchmark/benchmark_ca_cb_cc_ta_ntb.ndarray.js | 2 +- .../base/sgemm/benchmark/benchmark_ca_cb_cc_ta_tb.ndarray.js | 2 +- .../base/sgemm/benchmark/benchmark_ca_cb_rc_nta_ntb.ndarray.js | 2 +- .../base/sgemm/benchmark/benchmark_ca_cb_rc_nta_tb.ndarray.js | 2 +- .../base/sgemm/benchmark/benchmark_ca_cb_rc_ta_ntb.ndarray.js | 2 +- .../base/sgemm/benchmark/benchmark_ca_cb_rc_ta_tb.ndarray.js | 2 +- .../base/sgemm/benchmark/benchmark_ca_rb_cc_nta_ntb.ndarray.js | 2 +- .../base/sgemm/benchmark/benchmark_ca_rb_cc_nta_tb.ndarray.js | 2 +- .../base/sgemm/benchmark/benchmark_ca_rb_cc_ta_ntb.ndarray.js | 2 +- .../base/sgemm/benchmark/benchmark_ca_rb_cc_ta_tb.ndarray.js | 2 +- .../base/sgemm/benchmark/benchmark_ca_rb_rc_nta_ntb.ndarray.js | 2 +- .../base/sgemm/benchmark/benchmark_ca_rb_rc_nta_tb.ndarray.js | 2 +- .../base/sgemm/benchmark/benchmark_ca_rb_rc_ta_ntb.ndarray.js | 2 +- .../base/sgemm/benchmark/benchmark_ca_rb_rc_ta_tb.ndarray.js | 2 +- .../blas/base/sgemm/benchmark/benchmark_column_major_nta_ntb.js | 2 +- .../blas/base/sgemm/benchmark/benchmark_column_major_nta_tb.js | 2 +- .../blas/base/sgemm/benchmark/benchmark_column_major_ta_ntb.js | 2 +- .../blas/base/sgemm/benchmark/benchmark_column_major_ta_tb.js | 2 +- .../base/sgemm/benchmark/benchmark_ra_cb_cc_nta_ntb.ndarray.js | 2 +- .../base/sgemm/benchmark/benchmark_ra_cb_cc_nta_tb.ndarray.js | 2 +- .../base/sgemm/benchmark/benchmark_ra_cb_cc_ta_ntb.ndarray.js | 2 +- .../base/sgemm/benchmark/benchmark_ra_cb_cc_ta_tb.ndarray.js | 2 +- .../base/sgemm/benchmark/benchmark_ra_cb_rc_nta_ntb.ndarray.js | 2 +- .../base/sgemm/benchmark/benchmark_ra_cb_rc_nta_tb.ndarray.js | 2 +- .../base/sgemm/benchmark/benchmark_ra_cb_rc_ta_ntb.ndarray.js | 2 +- .../base/sgemm/benchmark/benchmark_ra_cb_rc_ta_tb.ndarray.js | 2 +- .../base/sgemm/benchmark/benchmark_ra_rb_cc_nta_ntb.ndarray.js | 2 +- .../base/sgemm/benchmark/benchmark_ra_rb_cc_nta_tb.ndarray.js | 2 +- .../base/sgemm/benchmark/benchmark_ra_rb_cc_ta_ntb.ndarray.js | 2 +- .../base/sgemm/benchmark/benchmark_ra_rb_cc_ta_tb.ndarray.js | 2 +- .../base/sgemm/benchmark/benchmark_ra_rb_rc_nta_ntb.ndarray.js | 2 +- .../base/sgemm/benchmark/benchmark_ra_rb_rc_nta_tb.ndarray.js | 2 +- .../base/sgemm/benchmark/benchmark_ra_rb_rc_ta_ntb.ndarray.js | 2 +- .../base/sgemm/benchmark/benchmark_ra_rb_rc_ta_tb.ndarray.js | 2 +- .../blas/base/sgemm/benchmark/benchmark_row_major_nta_ntb.js | 2 +- .../blas/base/sgemm/benchmark/benchmark_row_major_nta_tb.js | 2 +- .../blas/base/sgemm/benchmark/benchmark_row_major_ta_ntb.js | 2 +- .../blas/base/sgemm/benchmark/benchmark_row_major_ta_tb.js | 2 +- 40 files changed, 40 insertions(+), 40 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_cb_cc_nta_ntb.ndarray.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_cb_cc_nta_ntb.ndarray.js index 1869ba011d97..1413b82600d2 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_cb_cc_nta_ntb.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_cb_cc_nta_ntb.ndarray.js @@ -93,7 +93,7 @@ function main() { var i; min = 1; // 10^min - max = 6; // 10^max + max = 5; // 10^max for ( i = min; i <= max; i++ ) { len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_cb_cc_nta_tb.ndarray.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_cb_cc_nta_tb.ndarray.js index eb469a48690a..c6134178c061 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_cb_cc_nta_tb.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_cb_cc_nta_tb.ndarray.js @@ -93,7 +93,7 @@ function main() { var i; min = 1; // 10^min - max = 6; // 10^max + max = 5; // 10^max for ( i = min; i <= max; i++ ) { len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_cb_cc_ta_ntb.ndarray.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_cb_cc_ta_ntb.ndarray.js index 09c3e51b1fed..d195ced66881 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_cb_cc_ta_ntb.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_cb_cc_ta_ntb.ndarray.js @@ -93,7 +93,7 @@ function main() { var i; min = 1; // 10^min - max = 6; // 10^max + max = 5; // 10^max for ( i = min; i <= max; i++ ) { len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_cb_cc_ta_tb.ndarray.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_cb_cc_ta_tb.ndarray.js index 14cc1cf80eaf..35af9ee2a0f2 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_cb_cc_ta_tb.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_cb_cc_ta_tb.ndarray.js @@ -93,7 +93,7 @@ function main() { var i; min = 1; // 10^min - max = 6; // 10^max + max = 5; // 10^max for ( i = min; i <= max; i++ ) { len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_cb_rc_nta_ntb.ndarray.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_cb_rc_nta_ntb.ndarray.js index 8bc123427405..e7658c76c181 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_cb_rc_nta_ntb.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_cb_rc_nta_ntb.ndarray.js @@ -93,7 +93,7 @@ function main() { var i; min = 1; // 10^min - max = 6; // 10^max + max = 5; // 10^max for ( i = min; i <= max; i++ ) { len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_cb_rc_nta_tb.ndarray.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_cb_rc_nta_tb.ndarray.js index 13b27efebf42..ceb6ff45af2d 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_cb_rc_nta_tb.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_cb_rc_nta_tb.ndarray.js @@ -93,7 +93,7 @@ function main() { var i; min = 1; // 10^min - max = 6; // 10^max + max = 5; // 10^max for ( i = min; i <= max; i++ ) { len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_cb_rc_ta_ntb.ndarray.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_cb_rc_ta_ntb.ndarray.js index b000a8569451..9f7ff7d992ea 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_cb_rc_ta_ntb.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_cb_rc_ta_ntb.ndarray.js @@ -93,7 +93,7 @@ function main() { var i; min = 1; // 10^min - max = 6; // 10^max + max = 5; // 10^max for ( i = min; i <= max; i++ ) { len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_cb_rc_ta_tb.ndarray.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_cb_rc_ta_tb.ndarray.js index 8f963a7c92f3..dc46bc47ba16 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_cb_rc_ta_tb.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_cb_rc_ta_tb.ndarray.js @@ -93,7 +93,7 @@ function main() { var i; min = 1; // 10^min - max = 6; // 10^max + max = 5; // 10^max for ( i = min; i <= max; i++ ) { len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_rb_cc_nta_ntb.ndarray.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_rb_cc_nta_ntb.ndarray.js index d64a1360b279..8d13f7160dab 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_rb_cc_nta_ntb.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_rb_cc_nta_ntb.ndarray.js @@ -93,7 +93,7 @@ function main() { var i; min = 1; // 10^min - max = 6; // 10^max + max = 5; // 10^max for ( i = min; i <= max; i++ ) { len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_rb_cc_nta_tb.ndarray.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_rb_cc_nta_tb.ndarray.js index d1fbcf1f2fcc..d691671d7f18 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_rb_cc_nta_tb.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_rb_cc_nta_tb.ndarray.js @@ -93,7 +93,7 @@ function main() { var i; min = 1; // 10^min - max = 6; // 10^max + max = 5; // 10^max for ( i = min; i <= max; i++ ) { len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_rb_cc_ta_ntb.ndarray.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_rb_cc_ta_ntb.ndarray.js index d2404f4f8b77..a4a47a17e4ca 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_rb_cc_ta_ntb.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_rb_cc_ta_ntb.ndarray.js @@ -93,7 +93,7 @@ function main() { var i; min = 1; // 10^min - max = 6; // 10^max + max = 5; // 10^max for ( i = min; i <= max; i++ ) { len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_rb_cc_ta_tb.ndarray.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_rb_cc_ta_tb.ndarray.js index a6df7a379f25..d98803dfe73d 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_rb_cc_ta_tb.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_rb_cc_ta_tb.ndarray.js @@ -93,7 +93,7 @@ function main() { var i; min = 1; // 10^min - max = 6; // 10^max + max = 5; // 10^max for ( i = min; i <= max; i++ ) { len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_rb_rc_nta_ntb.ndarray.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_rb_rc_nta_ntb.ndarray.js index 5576dce6e1c3..01a9d3674875 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_rb_rc_nta_ntb.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_rb_rc_nta_ntb.ndarray.js @@ -93,7 +93,7 @@ function main() { var i; min = 1; // 10^min - max = 6; // 10^max + max = 5; // 10^max for ( i = min; i <= max; i++ ) { len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_rb_rc_nta_tb.ndarray.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_rb_rc_nta_tb.ndarray.js index 7c34cee56b6f..c81af812dc0d 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_rb_rc_nta_tb.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_rb_rc_nta_tb.ndarray.js @@ -93,7 +93,7 @@ function main() { var i; min = 1; // 10^min - max = 6; // 10^max + max = 5; // 10^max for ( i = min; i <= max; i++ ) { len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_rb_rc_ta_ntb.ndarray.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_rb_rc_ta_ntb.ndarray.js index ec37e7bc8302..b93f1f0663b7 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_rb_rc_ta_ntb.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_rb_rc_ta_ntb.ndarray.js @@ -93,7 +93,7 @@ function main() { var i; min = 1; // 10^min - max = 6; // 10^max + max = 5; // 10^max for ( i = min; i <= max; i++ ) { len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_rb_rc_ta_tb.ndarray.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_rb_rc_ta_tb.ndarray.js index 14efebc298de..74fd3deef4c6 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_rb_rc_ta_tb.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_rb_rc_ta_tb.ndarray.js @@ -93,7 +93,7 @@ function main() { var i; min = 1; // 10^min - max = 6; // 10^max + max = 5; // 10^max for ( i = min; i <= max; i++ ) { len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_column_major_nta_ntb.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_column_major_nta_ntb.js index 36c38ee6d044..ebf1f5fb919a 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_column_major_nta_ntb.js +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_column_major_nta_ntb.js @@ -93,7 +93,7 @@ function main() { var i; min = 1; // 10^min - max = 6; // 10^max + max = 5; // 10^max for ( i = min; i <= max; i++ ) { len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_column_major_nta_tb.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_column_major_nta_tb.js index 7b26c84d4b42..cbabe59537ce 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_column_major_nta_tb.js +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_column_major_nta_tb.js @@ -93,7 +93,7 @@ function main() { var i; min = 1; // 10^min - max = 6; // 10^max + max = 5; // 10^max for ( i = min; i <= max; i++ ) { len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_column_major_ta_ntb.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_column_major_ta_ntb.js index caacdf0d4452..bafb0948685a 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_column_major_ta_ntb.js +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_column_major_ta_ntb.js @@ -93,7 +93,7 @@ function main() { var i; min = 1; // 10^min - max = 6; // 10^max + max = 5; // 10^max for ( i = min; i <= max; i++ ) { len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_column_major_ta_tb.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_column_major_ta_tb.js index 6f627eb4174d..15476b942b16 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_column_major_ta_tb.js +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_column_major_ta_tb.js @@ -93,7 +93,7 @@ function main() { var i; min = 1; // 10^min - max = 6; // 10^max + max = 5; // 10^max for ( i = min; i <= max; i++ ) { len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_cb_cc_nta_ntb.ndarray.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_cb_cc_nta_ntb.ndarray.js index 9e4ce32e0cf0..10577a26a334 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_cb_cc_nta_ntb.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_cb_cc_nta_ntb.ndarray.js @@ -93,7 +93,7 @@ function main() { var i; min = 1; // 10^min - max = 6; // 10^max + max = 5; // 10^max for ( i = min; i <= max; i++ ) { len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_cb_cc_nta_tb.ndarray.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_cb_cc_nta_tb.ndarray.js index 50f1037521a1..29313b0b448e 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_cb_cc_nta_tb.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_cb_cc_nta_tb.ndarray.js @@ -93,7 +93,7 @@ function main() { var i; min = 1; // 10^min - max = 6; // 10^max + max = 5; // 10^max for ( i = min; i <= max; i++ ) { len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_cb_cc_ta_ntb.ndarray.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_cb_cc_ta_ntb.ndarray.js index 2a0d9f916175..5a0385998177 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_cb_cc_ta_ntb.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_cb_cc_ta_ntb.ndarray.js @@ -93,7 +93,7 @@ function main() { var i; min = 1; // 10^min - max = 6; // 10^max + max = 5; // 10^max for ( i = min; i <= max; i++ ) { len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_cb_cc_ta_tb.ndarray.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_cb_cc_ta_tb.ndarray.js index b064b3c68c07..08ab80972cc2 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_cb_cc_ta_tb.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_cb_cc_ta_tb.ndarray.js @@ -93,7 +93,7 @@ function main() { var i; min = 1; // 10^min - max = 6; // 10^max + max = 5; // 10^max for ( i = min; i <= max; i++ ) { len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_cb_rc_nta_ntb.ndarray.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_cb_rc_nta_ntb.ndarray.js index 97ddf6439deb..f3b5f928e444 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_cb_rc_nta_ntb.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_cb_rc_nta_ntb.ndarray.js @@ -93,7 +93,7 @@ function main() { var i; min = 1; // 10^min - max = 6; // 10^max + max = 5; // 10^max for ( i = min; i <= max; i++ ) { len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_cb_rc_nta_tb.ndarray.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_cb_rc_nta_tb.ndarray.js index 77a58c039d88..ff9021c70683 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_cb_rc_nta_tb.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_cb_rc_nta_tb.ndarray.js @@ -93,7 +93,7 @@ function main() { var i; min = 1; // 10^min - max = 6; // 10^max + max = 5; // 10^max for ( i = min; i <= max; i++ ) { len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_cb_rc_ta_ntb.ndarray.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_cb_rc_ta_ntb.ndarray.js index c2761310f45c..3210563a9b0b 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_cb_rc_ta_ntb.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_cb_rc_ta_ntb.ndarray.js @@ -93,7 +93,7 @@ function main() { var i; min = 1; // 10^min - max = 6; // 10^max + max = 5; // 10^max for ( i = min; i <= max; i++ ) { len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_cb_rc_ta_tb.ndarray.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_cb_rc_ta_tb.ndarray.js index ad2253f37d64..89b2ae03a852 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_cb_rc_ta_tb.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_cb_rc_ta_tb.ndarray.js @@ -93,7 +93,7 @@ function main() { var i; min = 1; // 10^min - max = 6; // 10^max + max = 5; // 10^max for ( i = min; i <= max; i++ ) { len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_rb_cc_nta_ntb.ndarray.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_rb_cc_nta_ntb.ndarray.js index 957995a27554..1ed84e301438 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_rb_cc_nta_ntb.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_rb_cc_nta_ntb.ndarray.js @@ -93,7 +93,7 @@ function main() { var i; min = 1; // 10^min - max = 6; // 10^max + max = 5; // 10^max for ( i = min; i <= max; i++ ) { len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_rb_cc_nta_tb.ndarray.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_rb_cc_nta_tb.ndarray.js index 1906760ca6d5..e187efdec713 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_rb_cc_nta_tb.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_rb_cc_nta_tb.ndarray.js @@ -93,7 +93,7 @@ function main() { var i; min = 1; // 10^min - max = 6; // 10^max + max = 5; // 10^max for ( i = min; i <= max; i++ ) { len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_rb_cc_ta_ntb.ndarray.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_rb_cc_ta_ntb.ndarray.js index b3c8097d6368..fd3c341c3c9a 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_rb_cc_ta_ntb.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_rb_cc_ta_ntb.ndarray.js @@ -93,7 +93,7 @@ function main() { var i; min = 1; // 10^min - max = 6; // 10^max + max = 5; // 10^max for ( i = min; i <= max; i++ ) { len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_rb_cc_ta_tb.ndarray.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_rb_cc_ta_tb.ndarray.js index 5d4796f24dc7..24dc2e804ebe 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_rb_cc_ta_tb.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_rb_cc_ta_tb.ndarray.js @@ -93,7 +93,7 @@ function main() { var i; min = 1; // 10^min - max = 6; // 10^max + max = 5; // 10^max for ( i = min; i <= max; i++ ) { len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_rb_rc_nta_ntb.ndarray.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_rb_rc_nta_ntb.ndarray.js index 1d8efcb15200..fd35dc846173 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_rb_rc_nta_ntb.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_rb_rc_nta_ntb.ndarray.js @@ -93,7 +93,7 @@ function main() { var i; min = 1; // 10^min - max = 6; // 10^max + max = 5; // 10^max for ( i = min; i <= max; i++ ) { len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_rb_rc_nta_tb.ndarray.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_rb_rc_nta_tb.ndarray.js index 80f6cbceecb7..ae21a7403f52 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_rb_rc_nta_tb.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_rb_rc_nta_tb.ndarray.js @@ -93,7 +93,7 @@ function main() { var i; min = 1; // 10^min - max = 6; // 10^max + max = 5; // 10^max for ( i = min; i <= max; i++ ) { len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_rb_rc_ta_ntb.ndarray.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_rb_rc_ta_ntb.ndarray.js index d3555466cd39..ee2883ab4dce 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_rb_rc_ta_ntb.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_rb_rc_ta_ntb.ndarray.js @@ -93,7 +93,7 @@ function main() { var i; min = 1; // 10^min - max = 6; // 10^max + max = 5; // 10^max for ( i = min; i <= max; i++ ) { len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_rb_rc_ta_tb.ndarray.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_rb_rc_ta_tb.ndarray.js index 50141057a2d1..77e9c83d7937 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_rb_rc_ta_tb.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_rb_rc_ta_tb.ndarray.js @@ -93,7 +93,7 @@ function main() { var i; min = 1; // 10^min - max = 6; // 10^max + max = 5; // 10^max for ( i = min; i <= max; i++ ) { len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_row_major_nta_ntb.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_row_major_nta_ntb.js index 1da17a4617ee..9feec19fa807 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_row_major_nta_ntb.js +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_row_major_nta_ntb.js @@ -93,7 +93,7 @@ function main() { var i; min = 1; // 10^min - max = 6; // 10^max + max = 5; // 10^max for ( i = min; i <= max; i++ ) { len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_row_major_nta_tb.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_row_major_nta_tb.js index 7333e905037b..1b75580c1900 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_row_major_nta_tb.js +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_row_major_nta_tb.js @@ -93,7 +93,7 @@ function main() { var i; min = 1; // 10^min - max = 6; // 10^max + max = 5; // 10^max for ( i = min; i <= max; i++ ) { len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_row_major_ta_ntb.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_row_major_ta_ntb.js index 201669ff5f40..03d215d615fb 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_row_major_ta_ntb.js +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_row_major_ta_ntb.js @@ -93,7 +93,7 @@ function main() { var i; min = 1; // 10^min - max = 6; // 10^max + max = 5; // 10^max for ( i = min; i <= max; i++ ) { len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_row_major_ta_tb.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_row_major_ta_tb.js index a8345fb6d9a7..06832e1548ce 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_row_major_ta_tb.js +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_row_major_ta_tb.js @@ -93,7 +93,7 @@ function main() { var i; min = 1; // 10^min - max = 6; // 10^max + max = 5; // 10^max for ( i = min; i <= max; i++ ) { len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); From ab05c1af10e6e1bb21b86d64dc1636b0b0905477 Mon Sep 17 00:00:00 2001 From: aman-095 Date: Tue, 13 Aug 2024 11:57:19 +0530 Subject: [PATCH 14/26] docs: add README, test.js and update examples --- .../@stdlib/blas/base/sgemm/README.md | 258 ++++++++++++++++++ .../blas/base/sgemm/docs/types/index.d.ts | 4 +- .../@stdlib/blas/base/sgemm/test/test.js | 82 ++++++ 3 files changed, 342 insertions(+), 2 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/README.md b/lib/node_modules/@stdlib/blas/base/sgemm/README.md index e69de29bb2d1..0922fd6ddcba 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/README.md +++ b/lib/node_modules/@stdlib/blas/base/sgemm/README.md @@ -0,0 +1,258 @@ + + +# sgemm + +> Perform one of the matrix-matrix operation `C = α*op(A)*op(B) + β*C` where `op(A)` is one of the `op(A) = A`, or `op(A) = A^T`. + +
+ +## Usage + +```javascript +var sgemm = require( '@stdlib/blas/base/sgemm' ); +``` + +#### sgemm( ord, ta, tb, M, N, K, α, A, lda, B, ldb, β, C, ldc ) + +Performs the matrix-matrix operation `C = α*op(A)*op(B) + β*C` where `op(A)` is either `op(X) = X` or `op(X) = X^T`, `α` and `β` are scalars, `A`, `B`, and `C` are matrices, with `op(A)` an `M` by `K` matrix, `op(B)` a `K` by `N` matrix, and `C` an `M` by `N` matrix. + +```javascript +var Float32Array = require( '@stdlib/array/float32' ); + +var A = new Float32Array( [ 1.0, 2.0, 3.0, 4.0 ] ); +var B = new Float32Array( [ 1.0, 1.0, 0.0, 1.0 ] ); +var C = new Float32Array( [ 1.0, 2.0, 3.0, 4.0 ] ); + +sgemm( 'row-major', 'no-transpose', 'no-transpose', 2, 2, 2, 1.0, A, 2, B, 2, 1.0, C, 2 ); +// C => [ 2.0, 5.0, 6.0, 11.0 ] +``` + +The function has the following parameters: + +- **ord**: storage layout. +- **ta**: specifies whether `A` should be transposed, conjugate-transposed, or not transposed. +- **tb**: specifies whether `B` should be transposed, conjugate-transposed, or not transposed. +- **M**: number of rows in the matrix `op(A)` and in the matrix `C`. +- **N**: number of columns in the matrix `op(B)` and in the matrix `C`. +- **K**: number of columns in the matrix `op(A)` and number of rows in the matrix `op(B)`. +- **α**: scalar constant. +- **A**: first input matrix stored in linear memory as a [`Float32Array`][mdn-float32array]. +- **lda**: stride of the first dimension of `A` (leading dimension of `A`). +- **B**: second input matrix stored in linear memory as a [`Float32Array`][mdn-float32array]. +- **ldb**: stride of the first dimension of `B` (leading dimension of `B`). +- **β**: scalar constant +- **C**: third input matrix stored in linear memory as a [`Float32Array`][mdn-float32array]. +- **ldc**: stride of the first dimension of `C` (leading dimension of `C`). + +The order parameters determine how operations are performed. For example, + +```javascript +var Float32Array = require( '@stdlib/array/float32' ); + +var A = new Float32Array( [ 1.0, 3.0, 2.0, 4.0 ] ); +var B = new Float32Array( [ 1.0, 0.0, 1.0, 1.0 ] ); +var C = new Float32Array( [ 1.0, 3.0, 2.0, 4.0 ] ); + +sgemm( 'column-major', 'no-transpose', 'no-transpose', 2, 2, 2, 1.0, A, 2, B, 2, 1.0, C, 2 ); +// C => [ 2.0, 6.0, 5.0, 11.0 ] +``` + +#### sgemm.ndarray( ta,tb,M,N,K,α,A,sa1,sa2,oa,B,sb1,sb2,ob,β,C,sc1,sc2,oc ) + +Performs the matrix-matrix operation `C = α*op(A)*op(B) + β*C`, using alternative indexing semantics and where `op(A)` is either `op(X) = X` or `op(X) = X^T`, `α` and `β` are scalars, `A`, `B`, and `C` are matrices, with `op(A)` an `M` by `K` matrix, `op(B)` a `K` by `N` matrix, and `C` an `M` by `N` matrix. + +```javascript +var Float32Array = require( '@stdlib/array/float32' ); + +var A = new Float32Array( [ 1.0, 2.0, 3.0, 4.0 ] ); +var B = new Float32Array( [ 1.0, 1.0, 0.0, 1.0 ] ); +var C = new Float32Array( [ 1.0, 2.0, 3.0, 4.0 ] ); + +sgemm.ndarray( 'no-transpose', 'no-transpose', 2, 2, 2, 1.0, A, 2, 1, 0, B, 2, 1, 0, 1.0, C, 2, 1, 0 ); +// C => [ 2.0, 5.0, 6.0, 11.0 ] +``` + +The function has the following additional parameters: + +- **sa1**: stride of the first dimension of `A`. +- **sa2**: stride of the second dimension of `A`. +- **oa**: starting index for `A`. +- **sb1**: stride of the first dimension of `B`. +- **sb2**: stride of the second dimension of `B`. +- **ob**: starting index for `B`. +- **sc1**: stride of the first dimension of `C`. +- **sc2**: stride of the second dimension of `C`. +- **oc**: starting index for `C`. + +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, + +```javascript +var Float32Array = require( '@stdlib/array/float32' ); + +var A = new Float32Array( [ 1.0, 3.0, 2.0, 4.0 ] ); +var B = new Float32Array( [ 1.0, 0.0, 1.0, 1.0 ] ); +var C = new Float32Array( [ 1.0, 3.0, 2.0, 4.0 ] ); + +sgemm.ndarray( 'no-transpose', 'no-transpose', 2, 2, 2, 1.0, A, 1, 2, 0, B, 1, 2, 0, 1.0, C, 1, 2, 0 ); +// C => [ 2.0, 6.0, 5.0, 11.0 ] +``` + +
+ + + +
+ +## Notes + +- `sgemm()` corresponds to the [BLAS][blas] level 3 function [`sgemm`][blas-sgemm]. + +
+ + + +
+ +## Examples + + + +```javascript +var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); +var sgemm = require( '@stdlib/blas/base/sgemm' ); + +var opts = { + 'dtype': 'float32' +}; + +var M = 3; +var N = 4; +var K = 2; + +var A = discreteUniform( M*K, 0, 10, opts ); // 3x2 +var B = discreteUniform( K*N, 0, 10, opts ); // 2x4 +var C = discreteUniform( M*N, 0, 10, opts ); // 3x4 + +sgemm( 'row-major', 'no-transpose', 'no-transpose', M, N, K, 1.0, A, K, B, N, 1.0, C, N ); +console.log( C ); + +sgemm.ndarray( 'no-transpose', 'no-transpose', M, N, K, 1.0, A, K, 1, 0, B, N, 1, 0, 1.0, C, N, 1, 0 ); +console.log( C ); + +``` + +
+ + + + + +* * * + +
+ +## C APIs + + + +
+ +
+ + + + + +
+ +### Usage + +```c +#include "stdlib/blas/base/sgemm.h" +``` + +#### TODO + +TODO. + +```c +TODO +``` + +TODO + +```c +TODO +``` + +
+ + + + + +
+ +
+ + + + + +
+ +### Examples + +```c +TODO +``` + +
+ + + +
+ + + + + + + + + + + + + + diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/docs/types/index.d.ts b/lib/node_modules/@stdlib/blas/base/sgemm/docs/types/index.d.ts index 8f781e219f6d..8914ba715930 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/blas/base/sgemm/docs/types/index.d.ts @@ -88,7 +88,7 @@ interface Routine { * var B = new Float32Array( [ 1.0, 1.0, 0.0, 1.0 ] ); * var C = new Float32Array( [ 1.0, 2.0, 3.0, 4.0 ] ); * - * sgemm.ndarray( 'row-major', 'no-transpose', 'no-transpose', 2, 2, 2, 1.0, A, 2, 1, 0, B, 2, 1, 0, 1.0, C, 2, 1, 0 ); + * sgemm.ndarray( 'no-transpose', 'no-transpose', 2, 2, 2, 1.0, A, 2, 1, 0, B, 2, 1, 0, 1.0, C, 2, 1, 0 ); * // C => [ 2.0, 5.0, 6.0, 11.0 ] */ ndarray( transA: TransposeOperation, transB: TransposeOperation, M: number, N: number, K: number, alpha: number, A: Float32Array, strideA1: number, strideA2: number, offsetA: number, B: Float32Array, strideB1: number, strideB2: number, offsetB: number, beta: number, C: Float32Array, strideC1: number, strideC2: number, offsetC: number ): Float32Array; @@ -130,7 +130,7 @@ interface Routine { * var B = new Float32Array( [ 1.0, 0.0, 1.0, 1.0 ] ); * var C = new Float32Array( [ 1.0, 3.0, 2.0, 4.0 ] ); * -* sgemm.ndarray( 'column-major', 'no-transpose', 'no-transpose', 2, 2, 2, 1.0, A, 1, 2, 0, B, 1, 2, 0, 1.0, C, 1, 2, 0 ); +* sgemm.ndarray( 'no-transpose', 'no-transpose', 2, 2, 2, 1.0, A, 1, 2, 0, B, 1, 2, 0, 1.0, C, 1, 2, 0 ); * // C => [ 2.0, 6.0, 5.0, 11.0 ] */ declare var sgemm: Routine; diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/test/test.js b/lib/node_modules/@stdlib/blas/base/sgemm/test/test.js index e69de29bb2d1..977a31ddedd1 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/test/test.js +++ b/lib/node_modules/@stdlib/blas/base/sgemm/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 sgemm = 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 sgemm, '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 sgemm.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 sgemm = proxyquire( './../lib', { + '@stdlib/utils/try-require': tryRequire + }); + + t.strictEqual( sgemm, 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 sgemm; + var main; + + main = require( './../lib/sgemm.js' ); + + sgemm = proxyquire( './../lib', { + '@stdlib/utils/try-require': tryRequire + }); + + t.strictEqual( sgemm, main, 'returns expected value' ); + t.end(); + + function tryRequire() { + return new Error( 'Cannot find module' ); + } +}); From fbdabab8704435cc244cbf83fbe1a5a62564cf25 Mon Sep 17 00:00:00 2001 From: Athan Reines Date: Tue, 13 Aug 2024 14:07:43 -0700 Subject: [PATCH 15/26] bench: add missing facets and reduce max power --- .../sgemm/benchmark/benchmark_ca_cb_cc_nta_ntb.ndarray.js | 4 ++-- .../base/sgemm/benchmark/benchmark_ca_cb_cc_nta_tb.ndarray.js | 4 ++-- .../base/sgemm/benchmark/benchmark_ca_cb_cc_ta_ntb.ndarray.js | 4 ++-- .../base/sgemm/benchmark/benchmark_ca_cb_cc_ta_tb.ndarray.js | 4 ++-- .../sgemm/benchmark/benchmark_ca_cb_rc_nta_ntb.ndarray.js | 4 ++-- .../base/sgemm/benchmark/benchmark_ca_cb_rc_nta_tb.ndarray.js | 4 ++-- .../base/sgemm/benchmark/benchmark_ca_cb_rc_ta_ntb.ndarray.js | 4 ++-- .../base/sgemm/benchmark/benchmark_ca_cb_rc_ta_tb.ndarray.js | 4 ++-- .../sgemm/benchmark/benchmark_ca_rb_cc_nta_ntb.ndarray.js | 4 ++-- .../base/sgemm/benchmark/benchmark_ca_rb_cc_nta_tb.ndarray.js | 4 ++-- .../base/sgemm/benchmark/benchmark_ca_rb_cc_ta_ntb.ndarray.js | 4 ++-- .../base/sgemm/benchmark/benchmark_ca_rb_cc_ta_tb.ndarray.js | 4 ++-- .../sgemm/benchmark/benchmark_ca_rb_rc_nta_ntb.ndarray.js | 4 ++-- .../base/sgemm/benchmark/benchmark_ca_rb_rc_nta_tb.ndarray.js | 4 ++-- .../base/sgemm/benchmark/benchmark_ca_rb_rc_ta_ntb.ndarray.js | 4 ++-- .../base/sgemm/benchmark/benchmark_ca_rb_rc_ta_tb.ndarray.js | 4 ++-- .../base/sgemm/benchmark/benchmark_column_major_nta_ntb.js | 4 ++-- .../base/sgemm/benchmark/benchmark_column_major_nta_tb.js | 4 ++-- .../base/sgemm/benchmark/benchmark_column_major_ta_ntb.js | 4 ++-- .../blas/base/sgemm/benchmark/benchmark_column_major_ta_tb.js | 4 ++-- .../sgemm/benchmark/benchmark_ra_cb_cc_nta_ntb.ndarray.js | 4 ++-- .../base/sgemm/benchmark/benchmark_ra_cb_cc_nta_tb.ndarray.js | 4 ++-- .../base/sgemm/benchmark/benchmark_ra_cb_cc_ta_ntb.ndarray.js | 4 ++-- .../base/sgemm/benchmark/benchmark_ra_cb_cc_ta_tb.ndarray.js | 4 ++-- .../sgemm/benchmark/benchmark_ra_cb_rc_nta_ntb.ndarray.js | 4 ++-- .../base/sgemm/benchmark/benchmark_ra_cb_rc_nta_tb.ndarray.js | 4 ++-- .../base/sgemm/benchmark/benchmark_ra_cb_rc_ta_ntb.ndarray.js | 4 ++-- .../base/sgemm/benchmark/benchmark_ra_cb_rc_ta_tb.ndarray.js | 4 ++-- .../sgemm/benchmark/benchmark_ra_rb_cc_nta_ntb.ndarray.js | 4 ++-- .../base/sgemm/benchmark/benchmark_ra_rb_cc_nta_tb.ndarray.js | 4 ++-- .../base/sgemm/benchmark/benchmark_ra_rb_cc_ta_ntb.ndarray.js | 4 ++-- .../base/sgemm/benchmark/benchmark_ra_rb_cc_ta_tb.ndarray.js | 4 ++-- .../sgemm/benchmark/benchmark_ra_rb_rc_nta_ntb.ndarray.js | 4 ++-- .../base/sgemm/benchmark/benchmark_ra_rb_rc_nta_tb.ndarray.js | 4 ++-- .../base/sgemm/benchmark/benchmark_ra_rb_rc_ta_ntb.ndarray.js | 4 ++-- .../base/sgemm/benchmark/benchmark_ra_rb_rc_ta_tb.ndarray.js | 4 ++-- .../blas/base/sgemm/benchmark/benchmark_row_major_nta_ntb.js | 4 ++-- .../blas/base/sgemm/benchmark/benchmark_row_major_nta_tb.js | 4 ++-- .../blas/base/sgemm/benchmark/benchmark_row_major_ta_ntb.js | 4 ++-- .../blas/base/sgemm/benchmark/benchmark_row_major_ta_tb.js | 4 ++-- 40 files changed, 80 insertions(+), 80 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_cb_cc_nta_ntb.ndarray.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_cb_cc_nta_ntb.ndarray.js index 1413b82600d2..48ffb089479f 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_cb_cc_nta_ntb.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_cb_cc_nta_ntb.ndarray.js @@ -93,12 +93,12 @@ function main() { var i; min = 1; // 10^min - max = 5; // 10^max + max = 4; // 10^max for ( i = min; i <= max; i++ ) { len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); f = createBenchmark( len ); - bench( pkg+':ndarray:size='+(len*len), f ); + bench( pkg+':ndarray:order(A)=column-major,order(B)=column-major,order(C)=column-major,trans(A)=false,trans(B)=false,size='+(len*len), f ); } } diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_cb_cc_nta_tb.ndarray.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_cb_cc_nta_tb.ndarray.js index c6134178c061..6f8cc5b08849 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_cb_cc_nta_tb.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_cb_cc_nta_tb.ndarray.js @@ -93,12 +93,12 @@ function main() { var i; min = 1; // 10^min - max = 5; // 10^max + max = 4; // 10^max for ( i = min; i <= max; i++ ) { len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); f = createBenchmark( len ); - bench( pkg+':ndarray:size='+(len*len), f ); + bench( pkg+':ndarray:order(A)=column-major,order(B)=column-major,order(C)=column-major,trans(A)=false,trans(B)=true,size='+(len*len), f ); } } diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_cb_cc_ta_ntb.ndarray.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_cb_cc_ta_ntb.ndarray.js index d195ced66881..ab89cd6c76bb 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_cb_cc_ta_ntb.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_cb_cc_ta_ntb.ndarray.js @@ -93,12 +93,12 @@ function main() { var i; min = 1; // 10^min - max = 5; // 10^max + max = 4; // 10^max for ( i = min; i <= max; i++ ) { len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); f = createBenchmark( len ); - bench( pkg+':ndarray:size='+(len*len), f ); + bench( pkg+':ndarrayorder(A)=column-major,order(B)=column-major,order(C)=column-major,trans(A)=true,trans(B)=false,:size='+(len*len), f ); } } diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_cb_cc_ta_tb.ndarray.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_cb_cc_ta_tb.ndarray.js index 35af9ee2a0f2..d56b46304822 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_cb_cc_ta_tb.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_cb_cc_ta_tb.ndarray.js @@ -93,12 +93,12 @@ function main() { var i; min = 1; // 10^min - max = 5; // 10^max + max = 4; // 10^max for ( i = min; i <= max; i++ ) { len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); f = createBenchmark( len ); - bench( pkg+':ndarray:size='+(len*len), f ); + bench( pkg+':ndarray:order(A)=column-major,order(B)=column-major,order(C)=column-major,trans(A)=true,trans(B)=true,size='+(len*len), f ); } } diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_cb_rc_nta_ntb.ndarray.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_cb_rc_nta_ntb.ndarray.js index e7658c76c181..3d99c35a2db2 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_cb_rc_nta_ntb.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_cb_rc_nta_ntb.ndarray.js @@ -93,12 +93,12 @@ function main() { var i; min = 1; // 10^min - max = 5; // 10^max + max = 4; // 10^max for ( i = min; i <= max; i++ ) { len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); f = createBenchmark( len ); - bench( pkg+':ndarray:size='+(len*len), f ); + bench( pkg+':ndarray:order(A)=column-major,order(B)=column-major,order(C)=row-major,trans(A)=false,trans(B)=false,size='+(len*len), f ); } } diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_cb_rc_nta_tb.ndarray.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_cb_rc_nta_tb.ndarray.js index ceb6ff45af2d..d1c0b3b58e3c 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_cb_rc_nta_tb.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_cb_rc_nta_tb.ndarray.js @@ -93,12 +93,12 @@ function main() { var i; min = 1; // 10^min - max = 5; // 10^max + max = 4; // 10^max for ( i = min; i <= max; i++ ) { len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); f = createBenchmark( len ); - bench( pkg+':ndarray:size='+(len*len), f ); + bench( pkg+':ndarray:order(A)=column-major,order(B)=column-major,order(C)=row-major,trans(A)=false,trans(B)=true,size='+(len*len), f ); } } diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_cb_rc_ta_ntb.ndarray.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_cb_rc_ta_ntb.ndarray.js index 9f7ff7d992ea..d1ee9bd9ba2f 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_cb_rc_ta_ntb.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_cb_rc_ta_ntb.ndarray.js @@ -93,12 +93,12 @@ function main() { var i; min = 1; // 10^min - max = 5; // 10^max + max = 4; // 10^max for ( i = min; i <= max; i++ ) { len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); f = createBenchmark( len ); - bench( pkg+':ndarray:size='+(len*len), f ); + bench( pkg+':ndarray:order(A)=column-major,order(B)=column-major,order(C)=row-major,trans(A)=true,trans(B)=false,size='+(len*len), f ); } } diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_cb_rc_ta_tb.ndarray.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_cb_rc_ta_tb.ndarray.js index dc46bc47ba16..1e7e5c4fb996 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_cb_rc_ta_tb.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_cb_rc_ta_tb.ndarray.js @@ -93,12 +93,12 @@ function main() { var i; min = 1; // 10^min - max = 5; // 10^max + max = 4; // 10^max for ( i = min; i <= max; i++ ) { len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); f = createBenchmark( len ); - bench( pkg+':ndarray:size='+(len*len), f ); + bench( pkg+':ndarray:order(A)=column-major,order(B)=column-major,order(C)=row-major,trans(A)=true,trans(B)=true,size='+(len*len), f ); } } diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_rb_cc_nta_ntb.ndarray.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_rb_cc_nta_ntb.ndarray.js index 8d13f7160dab..74907eb5bce9 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_rb_cc_nta_ntb.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_rb_cc_nta_ntb.ndarray.js @@ -93,12 +93,12 @@ function main() { var i; min = 1; // 10^min - max = 5; // 10^max + max = 4; // 10^max for ( i = min; i <= max; i++ ) { len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); f = createBenchmark( len ); - bench( pkg+':ndarray:size='+(len*len), f ); + bench( pkg+':ndarray:order(A)=column-major,order(B)=row-major,order(C)=column-major,trans(A)=false,trans(B)=false,size='+(len*len), f ); } } diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_rb_cc_nta_tb.ndarray.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_rb_cc_nta_tb.ndarray.js index d691671d7f18..f5363e58abb5 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_rb_cc_nta_tb.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_rb_cc_nta_tb.ndarray.js @@ -93,12 +93,12 @@ function main() { var i; min = 1; // 10^min - max = 5; // 10^max + max = 4; // 10^max for ( i = min; i <= max; i++ ) { len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); f = createBenchmark( len ); - bench( pkg+':ndarray:size='+(len*len), f ); + bench( pkg+':ndarray:order(A)=column-major,order(B)=row-major,order(C)=column-major,trans(A)=false,trans(B)=true,size='+(len*len), f ); } } diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_rb_cc_ta_ntb.ndarray.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_rb_cc_ta_ntb.ndarray.js index a4a47a17e4ca..73be234147d9 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_rb_cc_ta_ntb.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_rb_cc_ta_ntb.ndarray.js @@ -93,12 +93,12 @@ function main() { var i; min = 1; // 10^min - max = 5; // 10^max + max = 4; // 10^max for ( i = min; i <= max; i++ ) { len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); f = createBenchmark( len ); - bench( pkg+':ndarray:size='+(len*len), f ); + bench( pkg+':ndarray:order(A)=column-major,order(B)=row-major,order(C)=column-major,trans(A)=true,trans(B)=false,size='+(len*len), f ); } } diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_rb_cc_ta_tb.ndarray.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_rb_cc_ta_tb.ndarray.js index d98803dfe73d..aa3ace995b1d 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_rb_cc_ta_tb.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_rb_cc_ta_tb.ndarray.js @@ -93,12 +93,12 @@ function main() { var i; min = 1; // 10^min - max = 5; // 10^max + max = 4; // 10^max for ( i = min; i <= max; i++ ) { len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); f = createBenchmark( len ); - bench( pkg+':ndarray:size='+(len*len), f ); + bench( pkg+':ndarray:order(A)=column-major,order(B)=row-major,order(C)=column-major,trans(A)=true,trans(B)=true,size='+(len*len), f ); } } diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_rb_rc_nta_ntb.ndarray.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_rb_rc_nta_ntb.ndarray.js index 01a9d3674875..4944de7163fc 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_rb_rc_nta_ntb.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_rb_rc_nta_ntb.ndarray.js @@ -93,12 +93,12 @@ function main() { var i; min = 1; // 10^min - max = 5; // 10^max + max = 4; // 10^max for ( i = min; i <= max; i++ ) { len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); f = createBenchmark( len ); - bench( pkg+':ndarray:size='+(len*len), f ); + bench( pkg+':ndarray:order(A)=column-major,order(B)=row-major,order(C)=row-major,trans(A)=false,trans(B)=false,size='+(len*len), f ); } } diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_rb_rc_nta_tb.ndarray.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_rb_rc_nta_tb.ndarray.js index c81af812dc0d..69d0ce6c9707 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_rb_rc_nta_tb.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_rb_rc_nta_tb.ndarray.js @@ -93,12 +93,12 @@ function main() { var i; min = 1; // 10^min - max = 5; // 10^max + max = 4; // 10^max for ( i = min; i <= max; i++ ) { len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); f = createBenchmark( len ); - bench( pkg+':ndarray:size='+(len*len), f ); + bench( pkg+':ndarray:order(A)=column-major,order(B)=row-major,order(C)=row-major,trans(A)=false,trans(B)=true,size='+(len*len), f ); } } diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_rb_rc_ta_ntb.ndarray.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_rb_rc_ta_ntb.ndarray.js index b93f1f0663b7..3b8c02daaf66 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_rb_rc_ta_ntb.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_rb_rc_ta_ntb.ndarray.js @@ -93,12 +93,12 @@ function main() { var i; min = 1; // 10^min - max = 5; // 10^max + max = 4; // 10^max for ( i = min; i <= max; i++ ) { len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); f = createBenchmark( len ); - bench( pkg+':ndarray:size='+(len*len), f ); + bench( pkg+':ndarray:order(A)=column-major,order(B)=row-major,order(C)=row-major,trans(A)=true,trans(B)=false,size='+(len*len), f ); } } diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_rb_rc_ta_tb.ndarray.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_rb_rc_ta_tb.ndarray.js index 74fd3deef4c6..9a7809c4ef07 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_rb_rc_ta_tb.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ca_rb_rc_ta_tb.ndarray.js @@ -93,12 +93,12 @@ function main() { var i; min = 1; // 10^min - max = 5; // 10^max + max = 4; // 10^max for ( i = min; i <= max; i++ ) { len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); f = createBenchmark( len ); - bench( pkg+':ndarray:size='+(len*len), f ); + bench( pkg+':ndarray:order(A)=column-major,order(B)=row-major,order(C)=row-major,trans(A)=true,trans(B)=true,size='+(len*len), f ); } } diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_column_major_nta_ntb.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_column_major_nta_ntb.js index ebf1f5fb919a..9a3636f8afa8 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_column_major_nta_ntb.js +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_column_major_nta_ntb.js @@ -93,12 +93,12 @@ function main() { var i; min = 1; // 10^min - max = 5; // 10^max + max = 4; // 10^max for ( i = min; i <= max; i++ ) { len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); f = createBenchmark( len ); - bench( pkg+':size='+(len*len), f ); + bench( pkg+':order(A)=column-major,order(B)=column-major,order(C)=column-major,trans(A)=false,trans(B)=false,size='+(len*len), f ); } } diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_column_major_nta_tb.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_column_major_nta_tb.js index cbabe59537ce..baff16b529ca 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_column_major_nta_tb.js +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_column_major_nta_tb.js @@ -93,12 +93,12 @@ function main() { var i; min = 1; // 10^min - max = 5; // 10^max + max = 4; // 10^max for ( i = min; i <= max; i++ ) { len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); f = createBenchmark( len ); - bench( pkg+':size='+(len*len), f ); + bench( pkg+':order(A)=column-major,order(B)=column-major,order(C)=column-major,trans(A)=false,trans(B)=true,size='+(len*len), f ); } } diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_column_major_ta_ntb.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_column_major_ta_ntb.js index bafb0948685a..1dde84e66a32 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_column_major_ta_ntb.js +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_column_major_ta_ntb.js @@ -93,12 +93,12 @@ function main() { var i; min = 1; // 10^min - max = 5; // 10^max + max = 4; // 10^max for ( i = min; i <= max; i++ ) { len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); f = createBenchmark( len ); - bench( pkg+':size='+(len*len), f ); + bench( pkg+':order(A)=column-major,order(B)=column-major,order(C)=column-major,trans(A)=true,trans(B)=false,size='+(len*len), f ); } } diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_column_major_ta_tb.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_column_major_ta_tb.js index 15476b942b16..53319b42ab6e 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_column_major_ta_tb.js +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_column_major_ta_tb.js @@ -93,12 +93,12 @@ function main() { var i; min = 1; // 10^min - max = 5; // 10^max + max = 4; // 10^max for ( i = min; i <= max; i++ ) { len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); f = createBenchmark( len ); - bench( pkg+':size='+(len*len), f ); + bench( pkg+':order(A)=column-major,order(B)=column-major,order(C)=column-major,trans(A)=true,trans(B)=true,size='+(len*len), f ); } } diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_cb_cc_nta_ntb.ndarray.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_cb_cc_nta_ntb.ndarray.js index 10577a26a334..90c31329a835 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_cb_cc_nta_ntb.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_cb_cc_nta_ntb.ndarray.js @@ -93,12 +93,12 @@ function main() { var i; min = 1; // 10^min - max = 5; // 10^max + max = 4; // 10^max for ( i = min; i <= max; i++ ) { len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); f = createBenchmark( len ); - bench( pkg+':ndarray:size='+(len*len), f ); + bench( pkg+':ndarray:order(A)=row-major,order(B)=column-major,order(C)=column-major,trans(A)=false,trans(B)=false,size='+(len*len), f ); } } diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_cb_cc_nta_tb.ndarray.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_cb_cc_nta_tb.ndarray.js index 29313b0b448e..89fb6955f8c0 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_cb_cc_nta_tb.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_cb_cc_nta_tb.ndarray.js @@ -93,12 +93,12 @@ function main() { var i; min = 1; // 10^min - max = 5; // 10^max + max = 4; // 10^max for ( i = min; i <= max; i++ ) { len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); f = createBenchmark( len ); - bench( pkg+':ndarray:size='+(len*len), f ); + bench( pkg+':ndarray:order(A)=row-major,order(B)=column-major,order(C)=column-major,trans(A)=false,trans(B)=true,size='+(len*len), f ); } } diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_cb_cc_ta_ntb.ndarray.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_cb_cc_ta_ntb.ndarray.js index 5a0385998177..f0b88b7bdbe5 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_cb_cc_ta_ntb.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_cb_cc_ta_ntb.ndarray.js @@ -93,12 +93,12 @@ function main() { var i; min = 1; // 10^min - max = 5; // 10^max + max = 4; // 10^max for ( i = min; i <= max; i++ ) { len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); f = createBenchmark( len ); - bench( pkg+':ndarray:size='+(len*len), f ); + bench( pkg+':order(A)=row-major,order(B)=column-major,order(C)=column-major,trans(A)=true,trans(B)=false,ndarray:size='+(len*len), f ); } } diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_cb_cc_ta_tb.ndarray.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_cb_cc_ta_tb.ndarray.js index 08ab80972cc2..04ea3b0e10a2 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_cb_cc_ta_tb.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_cb_cc_ta_tb.ndarray.js @@ -93,12 +93,12 @@ function main() { var i; min = 1; // 10^min - max = 5; // 10^max + max = 4; // 10^max for ( i = min; i <= max; i++ ) { len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); f = createBenchmark( len ); - bench( pkg+':ndarray:size='+(len*len), f ); + bench( pkg+':ndarray:order(A)=row-major,order(B)=column-major,order(C)=column-major,trans(A)=true,trans(B)=true,size='+(len*len), f ); } } diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_cb_rc_nta_ntb.ndarray.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_cb_rc_nta_ntb.ndarray.js index f3b5f928e444..a3bfb12c21d3 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_cb_rc_nta_ntb.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_cb_rc_nta_ntb.ndarray.js @@ -93,12 +93,12 @@ function main() { var i; min = 1; // 10^min - max = 5; // 10^max + max = 4; // 10^max for ( i = min; i <= max; i++ ) { len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); f = createBenchmark( len ); - bench( pkg+':ndarray:size='+(len*len), f ); + bench( pkg+':ndarray:order(A)=row-major,order(B)=column-major,order(C)=row-major,trans(A)=false,trans(B)=false,size='+(len*len), f ); } } diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_cb_rc_nta_tb.ndarray.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_cb_rc_nta_tb.ndarray.js index ff9021c70683..fdc7d7ca406d 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_cb_rc_nta_tb.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_cb_rc_nta_tb.ndarray.js @@ -93,12 +93,12 @@ function main() { var i; min = 1; // 10^min - max = 5; // 10^max + max = 4; // 10^max for ( i = min; i <= max; i++ ) { len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); f = createBenchmark( len ); - bench( pkg+':ndarray:size='+(len*len), f ); + bench( pkg+':ndarray:order(A)=row-major,order(B)=column-major,order(C)=row-major,trans(A)=false,trans(B)=true,size='+(len*len), f ); } } diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_cb_rc_ta_ntb.ndarray.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_cb_rc_ta_ntb.ndarray.js index 3210563a9b0b..38bca2912ed3 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_cb_rc_ta_ntb.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_cb_rc_ta_ntb.ndarray.js @@ -93,12 +93,12 @@ function main() { var i; min = 1; // 10^min - max = 5; // 10^max + max = 4; // 10^max for ( i = min; i <= max; i++ ) { len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); f = createBenchmark( len ); - bench( pkg+':ndarray:size='+(len*len), f ); + bench( pkg+':ndarray:order(A)=row-major,order(B)=column-major,order(C)=row-major,trans(A)=true,trans(B)=false,size='+(len*len), f ); } } diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_cb_rc_ta_tb.ndarray.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_cb_rc_ta_tb.ndarray.js index 89b2ae03a852..fa842578f45d 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_cb_rc_ta_tb.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_cb_rc_ta_tb.ndarray.js @@ -93,12 +93,12 @@ function main() { var i; min = 1; // 10^min - max = 5; // 10^max + max = 4; // 10^max for ( i = min; i <= max; i++ ) { len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); f = createBenchmark( len ); - bench( pkg+':ndarray:size='+(len*len), f ); + bench( pkg+':ndarray:order(A)=row-major,order(B)=column-major,order(C)=row-major,trans(A)=true,trans(B)=true,size='+(len*len), f ); } } diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_rb_cc_nta_ntb.ndarray.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_rb_cc_nta_ntb.ndarray.js index 1ed84e301438..1345e16a4372 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_rb_cc_nta_ntb.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_rb_cc_nta_ntb.ndarray.js @@ -93,12 +93,12 @@ function main() { var i; min = 1; // 10^min - max = 5; // 10^max + max = 4; // 10^max for ( i = min; i <= max; i++ ) { len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); f = createBenchmark( len ); - bench( pkg+':ndarray:size='+(len*len), f ); + bench( pkg+':ndarray:order(A)=row-major,order(B)=row-major,order(C)=column-major,trans(A)=false,trans(B)=false,size='+(len*len), f ); } } diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_rb_cc_nta_tb.ndarray.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_rb_cc_nta_tb.ndarray.js index e187efdec713..af1b07570fb0 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_rb_cc_nta_tb.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_rb_cc_nta_tb.ndarray.js @@ -93,12 +93,12 @@ function main() { var i; min = 1; // 10^min - max = 5; // 10^max + max = 4; // 10^max for ( i = min; i <= max; i++ ) { len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); f = createBenchmark( len ); - bench( pkg+':ndarray:size='+(len*len), f ); + bench( pkg+':ndarray:order(A)=row-major,order(B)=row-major,order(C)=column-major,trans(A)=false,trans(B)=true,size='+(len*len), f ); } } diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_rb_cc_ta_ntb.ndarray.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_rb_cc_ta_ntb.ndarray.js index fd3c341c3c9a..bfe498438154 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_rb_cc_ta_ntb.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_rb_cc_ta_ntb.ndarray.js @@ -93,12 +93,12 @@ function main() { var i; min = 1; // 10^min - max = 5; // 10^max + max = 4; // 10^max for ( i = min; i <= max; i++ ) { len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); f = createBenchmark( len ); - bench( pkg+':ndarray:size='+(len*len), f ); + bench( pkg+':ndarray:order(A)=row-major,order(B)=row-major,order(C)=column-major,trans(A)=true,trans(B)=false,size='+(len*len), f ); } } diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_rb_cc_ta_tb.ndarray.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_rb_cc_ta_tb.ndarray.js index 24dc2e804ebe..d9d45c88367b 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_rb_cc_ta_tb.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_rb_cc_ta_tb.ndarray.js @@ -93,12 +93,12 @@ function main() { var i; min = 1; // 10^min - max = 5; // 10^max + max = 4; // 10^max for ( i = min; i <= max; i++ ) { len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); f = createBenchmark( len ); - bench( pkg+':ndarray:size='+(len*len), f ); + bench( pkg+':ndarray:order(A)=row-major,order(B)=row-major,order(C)=column-major,trans(A)=true,trans(B)=true,size='+(len*len), f ); } } diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_rb_rc_nta_ntb.ndarray.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_rb_rc_nta_ntb.ndarray.js index fd35dc846173..0d2fa631d445 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_rb_rc_nta_ntb.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_rb_rc_nta_ntb.ndarray.js @@ -93,12 +93,12 @@ function main() { var i; min = 1; // 10^min - max = 5; // 10^max + max = 4; // 10^max for ( i = min; i <= max; i++ ) { len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); f = createBenchmark( len ); - bench( pkg+':ndarray:size='+(len*len), f ); + bench( pkg+':ndarray:order(A)=row-major,order(B)=row-major,order(C)=row-major,trans(A)=false,trans(B)=false,size='+(len*len), f ); } } diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_rb_rc_nta_tb.ndarray.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_rb_rc_nta_tb.ndarray.js index ae21a7403f52..5523fb2d957d 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_rb_rc_nta_tb.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_rb_rc_nta_tb.ndarray.js @@ -93,12 +93,12 @@ function main() { var i; min = 1; // 10^min - max = 5; // 10^max + max = 4; // 10^max for ( i = min; i <= max; i++ ) { len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); f = createBenchmark( len ); - bench( pkg+':ndarray:size='+(len*len), f ); + bench( pkg+':ndarray:order(A)=row-major,order(B)=row-major,order(C)=row-major,trans(A)=false,trans(B)=true,size='+(len*len), f ); } } diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_rb_rc_ta_ntb.ndarray.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_rb_rc_ta_ntb.ndarray.js index ee2883ab4dce..54231a72c152 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_rb_rc_ta_ntb.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_rb_rc_ta_ntb.ndarray.js @@ -93,12 +93,12 @@ function main() { var i; min = 1; // 10^min - max = 5; // 10^max + max = 4; // 10^max for ( i = min; i <= max; i++ ) { len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); f = createBenchmark( len ); - bench( pkg+':ndarray:size='+(len*len), f ); + bench( pkg+':ndarray:order(A)=row-major,order(B)=row-major,order(C)=row-major,trans(A)=true,trans(B)=false,size='+(len*len), f ); } } diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_rb_rc_ta_tb.ndarray.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_rb_rc_ta_tb.ndarray.js index 77e9c83d7937..835ca1d2012a 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_rb_rc_ta_tb.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_ra_rb_rc_ta_tb.ndarray.js @@ -93,12 +93,12 @@ function main() { var i; min = 1; // 10^min - max = 5; // 10^max + max = 4; // 10^max for ( i = min; i <= max; i++ ) { len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); f = createBenchmark( len ); - bench( pkg+':ndarray:size='+(len*len), f ); + bench( pkg+':ndarray:order(A)=row-major,order(B)=row-major,order(C)=row-major,trans(A)=true,trans(B)=true,size='+(len*len), f ); } } diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_row_major_nta_ntb.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_row_major_nta_ntb.js index 9feec19fa807..83b3c638270b 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_row_major_nta_ntb.js +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_row_major_nta_ntb.js @@ -93,12 +93,12 @@ function main() { var i; min = 1; // 10^min - max = 5; // 10^max + max = 4; // 10^max for ( i = min; i <= max; i++ ) { len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); f = createBenchmark( len ); - bench( pkg+':size='+(len*len), f ); + bench( pkg+':order(A)=row-major,order(B)=row-major,order(C)=row-major,trans(A)=false,trans(B)=false,size='+(len*len), f ); } } diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_row_major_nta_tb.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_row_major_nta_tb.js index 1b75580c1900..92ba2f85508a 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_row_major_nta_tb.js +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_row_major_nta_tb.js @@ -93,12 +93,12 @@ function main() { var i; min = 1; // 10^min - max = 5; // 10^max + max = 4; // 10^max for ( i = min; i <= max; i++ ) { len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); f = createBenchmark( len ); - bench( pkg+':size='+(len*len), f ); + bench( pkg+':order(A)=row-major,order(B)=row-major,order(C)=row-major,trans(A)=false,trans(B)=true,size='+(len*len), f ); } } diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_row_major_ta_ntb.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_row_major_ta_ntb.js index 03d215d615fb..e0502301294c 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_row_major_ta_ntb.js +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_row_major_ta_ntb.js @@ -93,12 +93,12 @@ function main() { var i; min = 1; // 10^min - max = 5; // 10^max + max = 4; // 10^max for ( i = min; i <= max; i++ ) { len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); f = createBenchmark( len ); - bench( pkg+':size='+(len*len), f ); + bench( pkg+':order(A)=row-major,order(B)=row-major,order(C)=row-major,trans(A)=true,trans(B)=false,size='+(len*len), f ); } } diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_row_major_ta_tb.js b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_row_major_ta_tb.js index 06832e1548ce..f18346c913d5 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_row_major_ta_tb.js +++ b/lib/node_modules/@stdlib/blas/base/sgemm/benchmark/benchmark_row_major_ta_tb.js @@ -93,12 +93,12 @@ function main() { var i; min = 1; // 10^min - max = 5; // 10^max + max = 4; // 10^max for ( i = min; i <= max; i++ ) { len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); f = createBenchmark( len ); - bench( pkg+':size='+(len*len), f ); + bench( pkg+':order(A)=row-major,order(B)=row-major,order(C)=row-major,trans(A)=true,trans(B)=true,size='+(len*len), f ); } } From 9d5236bbb824f359dad35c7ca6d3a6d69a78e0b0 Mon Sep 17 00:00:00 2001 From: Athan Reines Date: Tue, 13 Aug 2024 14:14:20 -0700 Subject: [PATCH 16/26] docs: fix wrapping and visually group related arguments --- .../@stdlib/blas/base/sgemm/docs/repl.txt | 28 +++++++++---------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/docs/repl.txt b/lib/node_modules/@stdlib/blas/base/sgemm/docs/repl.txt index bbc630e560e9..4fa481d3971d 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/docs/repl.txt +++ b/lib/node_modules/@stdlib/blas/base/sgemm/docs/repl.txt @@ -1,9 +1,9 @@ {{alias}}( ord, ta, tb, M, N, K, α, A, lda, B, ldb, β, C, ldc ) - Performs the matrix-matrix operation `C = α*op(A)*op(B) + β*C` where - `op(A)` is either `op(X) = X` or `op(X) = X^T`, `α` and `β` are scalars, - `A`, `B`, and `C` are matrices, with `op(A)` an `M` by `K` matrix, `op(B)` - a `K` by `N` matrix, and `C` an `M` by `N` matrix. + Performs the matrix-matrix operation `C = α*op(A)*op(B) + β*C` where `op(A)` + is either `op(X) = X` or `op(X) = X^T`, `α` and `β` are scalars, `A`, `B`, + and `C` are matrices, with `op(A)` an `M` by `K` matrix, `op(B)` a `K` by + `N` matrix, and `C` an `M` by `N` matrix. Indexing is relative to the first index. To introduce an offset, use typed array views. @@ -19,12 +19,12 @@ Row-major (C-style) or column-major (Fortran-style) order. ta: string - Specifies whether `A` should be transposed, conjugate-transposed, or - not transposed. + Specifies whether `A` should be transposed, conjugate-transposed, or not + transposed. tb: string - Specifies whether `B` should be transposed, conjugate-transposed, or - not transposed. + Specifies whether `B` should be transposed, conjugate-transposed, or not + transposed. M: integer Number of rows in the matrix `op(A)` and in the matrix `C`. @@ -81,12 +81,12 @@ [ 2.0, 5.0, 6.0, 11.0 ] -{{alias}}.ndarray( ta,tb,M,N,K,α,A,sa1,sa2,oa,B,sb1,sb2,ob,β,C,sc1,sc2,oc ) +{{alias}}.ndarray(ta,tb, M,N,K, α, A,sa1,sa2,oa, B,sb1,sb2,ob, β, C,sc1,sc2,oc) Performs the matrix-matrix operation `C = α*op(A)*op(B) + β*C`, using alternative indexing semantics and where `op(A)` is either `op(X) = X` or - `op(X) = X^T`, `α` and `β` are scalars, `A`, `B`, and `C` are matrices, - with `op(A)` an `M` by `K` matrix, `op(B)` a `K` by `N` matrix, and `C` an - `M` by `N` matrix. + `op(X) = X^T`, `α` and `β` are scalars, `A`, `B`, and `C` are matrices, with + `op(A)` an `M` by `K` matrix, `op(B)` a `K` by `N` matrix, and `C` an `M` by + `N` matrix. While typed array views mandate a view offset based on the underlying buffer, the offset parameters support indexing semantics based on starting @@ -166,9 +166,7 @@ > var C = new {{alias:@stdlib/array/float32}}( [ 1.0, 2.0, 3.0, 4.0 ] ); > var ta = 'no-transpose'; > var tb = 'no-transpose'; - > var α = 1.0; - > var β = 1.0; - > {{alias}}.ndarray( ta,tb,2,2,2,α,A,2,1,0,B,2,1,0,β,C,2,1,0 ) + > {{alias}}.ndarray( ta,tb, 2,2,2, 1.0, A,2,1,0, B,2,1,0, 1.0, C,2,1,0 ) [ 2.0, 5.0, 6.0, 11.0 ] See Also From 9d02719c1d0b9e1fa138b31096d81e56f44024de Mon Sep 17 00:00:00 2001 From: Athan Reines Date: Tue, 13 Aug 2024 14:17:07 -0700 Subject: [PATCH 17/26] docs: add todos --- lib/node_modules/@stdlib/blas/base/sgemm/lib/base.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/lib/base.js b/lib/node_modules/@stdlib/blas/base/sgemm/lib/base.js index 1bf979688e5e..373e563938d2 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/lib/base.js +++ b/lib/node_modules/@stdlib/blas/base/sgemm/lib/base.js @@ -54,7 +54,7 @@ var bsize = blockSize( 'float32' ); // TODO: consider using a larger block size * var bool = isTransposed( 'no-transpose' ); * // returns false */ -function isTransposed( str ) { +function isTransposed( str ) { // TODO: consider moving to a separate helper utility package return ( str !== 'no-transpose' ); } @@ -86,7 +86,7 @@ function isTransposed( str ) { * zeros( 2, 3, X, 1, 2, 0 ); * // X => [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] */ -function zeros( M, N, X, strideX1, strideX2, offsetX ) { +function zeros( M, N, X, strideX1, strideX2, offsetX ) { // TODO: consider moving to a separate package var dx0; var dx1; var S0; @@ -148,7 +148,7 @@ function zeros( M, N, X, strideX1, strideX2, offsetX ) { * scal( 2, 3, 5.0, X, 1, 2, 0 ); * // X => [ 5.0, 10.0, 15.0, 20.0, 25.0, 30.0 ] */ -function scal( M, N, beta, X, strideX1, strideX2, offsetX ) { +function scal( M, N, beta, X, strideX1, strideX2, offsetX ) { // TODO: consider moving to a separate package var dx0; var dx1; var S0; From c57d21a5a2c32f23fb74fc30755c5da83687a665 Mon Sep 17 00:00:00 2001 From: Athan Reines Date: Tue, 13 Aug 2024 14:22:20 -0700 Subject: [PATCH 18/26] docs: fix descriptions --- lib/node_modules/@stdlib/blas/base/sgemm/README.md | 2 +- lib/node_modules/@stdlib/blas/base/sgemm/package.json | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/README.md b/lib/node_modules/@stdlib/blas/base/sgemm/README.md index 0922fd6ddcba..7028839ad338 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/README.md +++ b/lib/node_modules/@stdlib/blas/base/sgemm/README.md @@ -20,7 +20,7 @@ limitations under the License. # sgemm -> Perform one of the matrix-matrix operation `C = α*op(A)*op(B) + β*C` where `op(A)` is one of the `op(A) = A`, or `op(A) = A^T`. +> Perform the matrix-matrix operation `C = α*op(A)*op(B) + β*C` where `op(X)` is one of the `op(X) = X`, or `op(X) = X^T`.
diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/package.json b/lib/node_modules/@stdlib/blas/base/sgemm/package.json index 4c257cf5cb03..a9696080acdd 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/package.json +++ b/lib/node_modules/@stdlib/blas/base/sgemm/package.json @@ -1,7 +1,7 @@ { "name": "@stdlib/blas/base/sgemm", "version": "0.0.0", - "description": "Perform one of the matrix-matrix operation `C = α*op(A)*op(B) + β*C` where `op(A)` is one of the `op(A) = A`, or `op(A) = A^T`.", + "description": "Perform the matrix-matrix operation `C = α*op(A)*op(B) + β*C` where `op(X)` is either `op(X) = X` or `op(X) = X^T`.", "license": "Apache-2.0", "author": { "name": "The Stdlib Authors", @@ -56,6 +56,10 @@ "blas", "level 3", "sgemm", + "matmul", + "matrix multiplication", + "matrix", + "multiplication", "linear", "algebra", "subroutines", From 0dbc0beb95e3369e2e6cc16c1b76172b1449b36a Mon Sep 17 00:00:00 2001 From: Athan Reines Date: Tue, 13 Aug 2024 18:22:35 -0700 Subject: [PATCH 19/26] docs: fix examples and style --- .../@stdlib/blas/base/sgemm/README.md | 27 ++++++++++--------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/README.md b/lib/node_modules/@stdlib/blas/base/sgemm/README.md index 7028839ad338..d285cf855906 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/README.md +++ b/lib/node_modules/@stdlib/blas/base/sgemm/README.md @@ -62,20 +62,22 @@ The function has the following parameters: - **C**: third input matrix stored in linear memory as a [`Float32Array`][mdn-float32array]. - **ldc**: stride of the first dimension of `C` (leading dimension of `C`). -The order parameters determine how operations are performed. For example, +The stride parameters determine how elements in the input arrays are accessed at runtime. For example, to perform matrix multiplication of two subarrays ```javascript var Float32Array = require( '@stdlib/array/float32' ); -var A = new Float32Array( [ 1.0, 3.0, 2.0, 4.0 ] ); -var B = new Float32Array( [ 1.0, 0.0, 1.0, 1.0 ] ); -var C = new Float32Array( [ 1.0, 3.0, 2.0, 4.0 ] ); +var A = new Float32Array( [ 1.0, 2.0, 0.0, 0.0, 3.0, 4.0, 0.0, 0.0 ] ); +var B = new Float32Array( [ 1.0, 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0 ] ); +var C = new Float32Array( [ 1.0, 2.0, 3.0, 4.0 ] ); -sgemm( 'column-major', 'no-transpose', 'no-transpose', 2, 2, 2, 1.0, A, 2, B, 2, 1.0, C, 2 ); -// C => [ 2.0, 6.0, 5.0, 11.0 ] +sgemm( 'row-major', 'no-transpose', 'no-transpose', 2, 2, 2, 1.0, A, 4, B, 4, 1.0, C, 2 ); +// C => [ 2.0, 5.0, 6.0, 11.0 ] ``` -#### sgemm.ndarray( ta,tb,M,N,K,α,A,sa1,sa2,oa,B,sb1,sb2,ob,β,C,sc1,sc2,oc ) + + +#### sgemm.ndarray( ta, tb, M, N, K, α, A, sa1, sa2, oa, B, sb1, sb2, ob, β, C, sc1, sc2, oc ) Performs the matrix-matrix operation `C = α*op(A)*op(B) + β*C`, using alternative indexing semantics and where `op(A)` is either `op(X) = X` or `op(X) = X^T`, `α` and `β` are scalars, `A`, `B`, and `C` are matrices, with `op(A)` an `M` by `K` matrix, `op(B)` a `K` by `N` matrix, and `C` an `M` by `N` matrix. @@ -107,12 +109,12 @@ While [`typed array`][mdn-typed-array] views mandate a view offset based on the ```javascript var Float32Array = require( '@stdlib/array/float32' ); -var A = new Float32Array( [ 1.0, 3.0, 2.0, 4.0 ] ); -var B = new Float32Array( [ 1.0, 0.0, 1.0, 1.0 ] ); -var C = new Float32Array( [ 1.0, 3.0, 2.0, 4.0 ] ); +var A = new Float32Array( [ 0.0, 0.0, 1.0, 3.0, 2.0, 4.0 ] ); +var B = new Float32Array( [ 0.0, 1.0, 0.0, 1.0, 1.0 ] ); +var C = new Float32Array( [ 0.0, 0.0, 0.0, 1.0, 3.0, 2.0, 4.0 ] ); -sgemm.ndarray( 'no-transpose', 'no-transpose', 2, 2, 2, 1.0, A, 1, 2, 0, B, 1, 2, 0, 1.0, C, 1, 2, 0 ); -// C => [ 2.0, 6.0, 5.0, 11.0 ] +sgemm.ndarray( 'no-transpose', 'no-transpose', 2, 2, 2, 1.0, A, 1, 2, 2, B, 1, 2, 1, 1.0, C, 1, 2, 3 ); +// C => [ 0.0, 0.0, 0.0, 2.0, 6.0, 5.0, 11.0 ] ```
@@ -156,7 +158,6 @@ console.log( C ); sgemm.ndarray( 'no-transpose', 'no-transpose', M, N, K, 1.0, A, K, 1, 0, B, N, 1, 0, 1.0, C, N, 1, 0 ); console.log( C ); - ``` From 09e0cb9d6e1b4017d426124ef966402684d93671 Mon Sep 17 00:00:00 2001 From: Athan Reines Date: Wed, 14 Aug 2024 21:36:10 -0700 Subject: [PATCH 20/26] test: simplify test descriptions --- .../blas/base/sgemm/test/test.ndarray.js | 64 +++++++++---------- 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/test/test.ndarray.js b/lib/node_modules/@stdlib/blas/base/sgemm/test/test.ndarray.js index 9588638c1049..4fe61f35fce4 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/test/test.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/sgemm/test/test.ndarray.js @@ -252,7 +252,7 @@ tape( 'the function throws an error if provided an invalid fifth argument', func } }); -tape( 'the function performs one of the matrix-matrix operation `C = α*op(A)*op(B) + β*C` where `op(A)` is one of the `op(A) = A`, or `op(A) = A^T (column_major, column_major, column_major, no-transpose, no-transpose)', function test( t ) { +tape( 'the function performs the matrix-matrix operation `C = α*op(A)*op(B) + β*C` (column_major, column_major, column_major, no-transpose, no-transpose)', function test( t ) { var expected; var data; var out; @@ -274,7 +274,7 @@ tape( 'the function performs one of the matrix-matrix operation `C = α*op(A)*op t.end(); }); -tape( 'the function performs one of the matrix-matrix operation `C = α*op(A)*op(B) + β*C` where `op(A)` is one of the `op(A) = A`, or `op(A) = A^T (column_major, column_major, column_major, transpose, no-transpose)', function test( t ) { +tape( 'the function performs the matrix-matrix operation `C = α*op(A)*op(B) + β*C` (column_major, column_major, column_major, transpose, no-transpose)', function test( t ) { var expected; var data; var out; @@ -296,7 +296,7 @@ tape( 'the function performs one of the matrix-matrix operation `C = α*op(A)*op t.end(); }); -tape( 'the function performs one of the matrix-matrix operation `C = α*op(A)*op(B) + β*C` where `op(A)` is one of the `op(A) = A`, or `op(A) = A^T (column_major, column_major, column_major, no-transpose, transpose)', function test( t ) { +tape( 'the function performs the matrix-matrix operation `C = α*op(A)*op(B) + β*C` (column_major, column_major, column_major, no-transpose, transpose)', function test( t ) { var expected; var data; var out; @@ -318,7 +318,7 @@ tape( 'the function performs one of the matrix-matrix operation `C = α*op(A)*op t.end(); }); -tape( 'the function performs one of the matrix-matrix operation `C = α*op(A)*op(B) + β*C` where `op(A)` is one of the `op(A) = A`, or `op(A) = A^T (column_major, column_major, column_major, transpose, transpose)', function test( t ) { +tape( 'the function performs the matrix-matrix operation `C = α*op(A)*op(B) + β*C` (column_major, column_major, column_major, transpose, transpose)', function test( t ) { var expected; var data; var out; @@ -340,7 +340,7 @@ tape( 'the function performs one of the matrix-matrix operation `C = α*op(A)*op t.end(); }); -tape( 'the function performs one of the matrix-matrix operation `C = α*op(A)*op(B) + β*C` where `op(A)` is one of the `op(A) = A`, or `op(A) = A^T (column_major, column_major, row_major, no-transpose, no-transpose)', function test( t ) { +tape( 'the function performs the matrix-matrix operation `C = α*op(A)*op(B) + β*C` (column_major, column_major, row_major, no-transpose, no-transpose)', function test( t ) { var expected; var data; var out; @@ -362,7 +362,7 @@ tape( 'the function performs one of the matrix-matrix operation `C = α*op(A)*op t.end(); }); -tape( 'the function performs one of the matrix-matrix operation `C = α*op(A)*op(B) + β*C` where `op(A)` is one of the `op(A) = A`, or `op(A) = A^T (column_major, column_major, row_major, transpose, no-transpose)', function test( t ) { +tape( 'the function performs the matrix-matrix operation `C = α*op(A)*op(B) + β*C` (column_major, column_major, row_major, transpose, no-transpose)', function test( t ) { var expected; var data; var out; @@ -384,7 +384,7 @@ tape( 'the function performs one of the matrix-matrix operation `C = α*op(A)*op t.end(); }); -tape( 'the function performs one of the matrix-matrix operation `C = α*op(A)*op(B) + β*C` where `op(A)` is one of the `op(A) = A`, or `op(A) = A^T (column_major, column_major, row_major, no-transpose, transpose)', function test( t ) { +tape( 'the function performs the matrix-matrix operation `C = α*op(A)*op(B) + β*C` (column_major, column_major, row_major, no-transpose, transpose)', function test( t ) { var expected; var data; var out; @@ -406,7 +406,7 @@ tape( 'the function performs one of the matrix-matrix operation `C = α*op(A)*op t.end(); }); -tape( 'the function performs one of the matrix-matrix operation `C = α*op(A)*op(B) + β*C` where `op(A)` is one of the `op(A) = A`, or `op(A) = A^T (column_major, column_major, row_major, transpose, transpose)', function test( t ) { +tape( 'the function performs the matrix-matrix operation `C = α*op(A)*op(B) + β*C` (column_major, column_major, row_major, transpose, transpose)', function test( t ) { var expected; var data; var out; @@ -428,7 +428,7 @@ tape( 'the function performs one of the matrix-matrix operation `C = α*op(A)*op t.end(); }); -tape( 'the function performs one of the matrix-matrix operation `C = α*op(A)*op(B) + β*C` where `op(A)` is one of the `op(A) = A`, or `op(A) = A^T (column_major, row_major, column_major, no-transpose, no-transpose)', function test( t ) { +tape( 'the function performs the matrix-matrix operation `C = α*op(A)*op(B) + β*C` (column_major, row_major, column_major, no-transpose, no-transpose)', function test( t ) { var expected; var data; var out; @@ -450,7 +450,7 @@ tape( 'the function performs one of the matrix-matrix operation `C = α*op(A)*op t.end(); }); -tape( 'the function performs one of the matrix-matrix operation `C = α*op(A)*op(B) + β*C` where `op(A)` is one of the `op(A) = A`, or `op(A) = A^T (column_major, row_major, column_major, transpose, no-transpose)', function test( t ) { +tape( 'the function performs the matrix-matrix operation `C = α*op(A)*op(B) + β*C` (column_major, row_major, column_major, transpose, no-transpose)', function test( t ) { var expected; var data; var out; @@ -472,7 +472,7 @@ tape( 'the function performs one of the matrix-matrix operation `C = α*op(A)*op t.end(); }); -tape( 'the function performs one of the matrix-matrix operation `C = α*op(A)*op(B) + β*C` where `op(A)` is one of the `op(A) = A`, or `op(A) = A^T (column_major, row_major, column_major, no-transpose, transpose)', function test( t ) { +tape( 'the function performs the matrix-matrix operation `C = α*op(A)*op(B) + β*C` (column_major, row_major, column_major, no-transpose, transpose)', function test( t ) { var expected; var data; var out; @@ -494,7 +494,7 @@ tape( 'the function performs one of the matrix-matrix operation `C = α*op(A)*op t.end(); }); -tape( 'the function performs one of the matrix-matrix operation `C = α*op(A)*op(B) + β*C` where `op(A)` is one of the `op(A) = A`, or `op(A) = A^T (column_major, row_major, column_major, transpose, transpose)', function test( t ) { +tape( 'the function performs the matrix-matrix operation `C = α*op(A)*op(B) + β*C` (column_major, row_major, column_major, transpose, transpose)', function test( t ) { var expected; var data; var out; @@ -516,7 +516,7 @@ tape( 'the function performs one of the matrix-matrix operation `C = α*op(A)*op t.end(); }); -tape( 'the function performs one of the matrix-matrix operation `C = α*op(A)*op(B) + β*C` where `op(A)` is one of the `op(A) = A`, or `op(A) = A^T (column_major, row_major, row_major, no-transpose, no-transpose)', function test( t ) { +tape( 'the function performs the matrix-matrix operation `C = α*op(A)*op(B) + β*C` (column_major, row_major, row_major, no-transpose, no-transpose)', function test( t ) { var expected; var data; var out; @@ -538,7 +538,7 @@ tape( 'the function performs one of the matrix-matrix operation `C = α*op(A)*op t.end(); }); -tape( 'the function performs one of the matrix-matrix operation `C = α*op(A)*op(B) + β*C` where `op(A)` is one of the `op(A) = A`, or `op(A) = A^T (column_major, row_major, row_major, transpose, no-transpose)', function test( t ) { +tape( 'the function performs the matrix-matrix operation `C = α*op(A)*op(B) + β*C` (column_major, row_major, row_major, transpose, no-transpose)', function test( t ) { var expected; var data; var out; @@ -560,7 +560,7 @@ tape( 'the function performs one of the matrix-matrix operation `C = α*op(A)*op t.end(); }); -tape( 'the function performs one of the matrix-matrix operation `C = α*op(A)*op(B) + β*C` where `op(A)` is one of the `op(A) = A`, or `op(A) = A^T (column_major, row_major, row_major, no-transpose, transpose)', function test( t ) { +tape( 'the function performs the matrix-matrix operation `C = α*op(A)*op(B) + β*C` (column_major, row_major, row_major, no-transpose, transpose)', function test( t ) { var expected; var data; var out; @@ -582,7 +582,7 @@ tape( 'the function performs one of the matrix-matrix operation `C = α*op(A)*op t.end(); }); -tape( 'the function performs one of the matrix-matrix operation `C = α*op(A)*op(B) + β*C` where `op(A)` is one of the `op(A) = A`, or `op(A) = A^T (column_major, row_major, row_major, transpose, transpose)', function test( t ) { +tape( 'the function performs the matrix-matrix operation `C = α*op(A)*op(B) + β*C` (column_major, row_major, row_major, transpose, transpose)', function test( t ) { var expected; var data; var out; @@ -604,7 +604,7 @@ tape( 'the function performs one of the matrix-matrix operation `C = α*op(A)*op t.end(); }); -tape( 'the function performs one of the matrix-matrix operation `C = α*op(A)*op(B) + β*C` where `op(A)` is one of the `op(A) = A`, or `op(A) = A^T (row_major, column_major, column_major, no-transpose, no-transpose)', function test( t ) { +tape( 'the function performs the matrix-matrix operation `C = α*op(A)*op(B) + β*C` (row_major, column_major, column_major, no-transpose, no-transpose)', function test( t ) { var expected; var data; var out; @@ -626,7 +626,7 @@ tape( 'the function performs one of the matrix-matrix operation `C = α*op(A)*op t.end(); }); -tape( 'the function performs one of the matrix-matrix operation `C = α*op(A)*op(B) + β*C` where `op(A)` is one of the `op(A) = A`, or `op(A) = A^T (row_major, column_major, column_major, transpose, no-transpose)', function test( t ) { +tape( 'the function performs the matrix-matrix operation `C = α*op(A)*op(B) + β*C` (row_major, column_major, column_major, transpose, no-transpose)', function test( t ) { var expected; var data; var out; @@ -648,7 +648,7 @@ tape( 'the function performs one of the matrix-matrix operation `C = α*op(A)*op t.end(); }); -tape( 'the function performs one of the matrix-matrix operation `C = α*op(A)*op(B) + β*C` where `op(A)` is one of the `op(A) = A`, or `op(A) = A^T (row_major, column_major, column_major, no-transpose, transpose)', function test( t ) { +tape( 'the function performs the matrix-matrix operation `C = α*op(A)*op(B) + β*C` (row_major, column_major, column_major, no-transpose, transpose)', function test( t ) { var expected; var data; var out; @@ -670,7 +670,7 @@ tape( 'the function performs one of the matrix-matrix operation `C = α*op(A)*op t.end(); }); -tape( 'the function performs one of the matrix-matrix operation `C = α*op(A)*op(B) + β*C` where `op(A)` is one of the `op(A) = A`, or `op(A) = A^T (row_major, column_major, column_major, transpose, transpose)', function test( t ) { +tape( 'the function performs the matrix-matrix operation `C = α*op(A)*op(B) + β*C` (row_major, column_major, column_major, transpose, transpose)', function test( t ) { var expected; var data; var out; @@ -692,7 +692,7 @@ tape( 'the function performs one of the matrix-matrix operation `C = α*op(A)*op t.end(); }); -tape( 'the function performs one of the matrix-matrix operation `C = α*op(A)*op(B) + β*C` where `op(A)` is one of the `op(A) = A`, or `op(A) = A^T (row_major, column_major, row_major, no-transpose, no-transpose)', function test( t ) { +tape( 'the function performs the matrix-matrix operation `C = α*op(A)*op(B) + β*C` (row_major, column_major, row_major, no-transpose, no-transpose)', function test( t ) { var expected; var data; var out; @@ -714,7 +714,7 @@ tape( 'the function performs one of the matrix-matrix operation `C = α*op(A)*op t.end(); }); -tape( 'the function performs one of the matrix-matrix operation `C = α*op(A)*op(B) + β*C` where `op(A)` is one of the `op(A) = A`, or `op(A) = A^T (row_major, column_major, row_major, transpose, no-transpose)', function test( t ) { +tape( 'the function performs the matrix-matrix operation `C = α*op(A)*op(B) + β*C` (row_major, column_major, row_major, transpose, no-transpose)', function test( t ) { var expected; var data; var out; @@ -736,7 +736,7 @@ tape( 'the function performs one of the matrix-matrix operation `C = α*op(A)*op t.end(); }); -tape( 'the function performs one of the matrix-matrix operation `C = α*op(A)*op(B) + β*C` where `op(A)` is one of the `op(A) = A`, or `op(A) = A^T (row_major, column_major, row_major, no-transpose, transpose)', function test( t ) { +tape( 'the function performs the matrix-matrix operation `C = α*op(A)*op(B) + β*C` (row_major, column_major, row_major, no-transpose, transpose)', function test( t ) { var expected; var data; var out; @@ -758,7 +758,7 @@ tape( 'the function performs one of the matrix-matrix operation `C = α*op(A)*op t.end(); }); -tape( 'the function performs one of the matrix-matrix operation `C = α*op(A)*op(B) + β*C` where `op(A)` is one of the `op(A) = A`, or `op(A) = A^T (row_major, column_major, row_major, transpose, transpose)', function test( t ) { +tape( 'the function performs the matrix-matrix operation `C = α*op(A)*op(B) + β*C` (row_major, column_major, row_major, transpose, transpose)', function test( t ) { var expected; var data; var out; @@ -780,7 +780,7 @@ tape( 'the function performs one of the matrix-matrix operation `C = α*op(A)*op t.end(); }); -tape( 'the function performs one of the matrix-matrix operation `C = α*op(A)*op(B) + β*C` where `op(A)` is one of the `op(A) = A`, or `op(A) = A^T (row_major, row_major, column_major, no-transpose, no-transpose)', function test( t ) { +tape( 'the function performs the matrix-matrix operation `C = α*op(A)*op(B) + β*C` (row_major, row_major, column_major, no-transpose, no-transpose)', function test( t ) { var expected; var data; var out; @@ -802,7 +802,7 @@ tape( 'the function performs one of the matrix-matrix operation `C = α*op(A)*op t.end(); }); -tape( 'the function performs one of the matrix-matrix operation `C = α*op(A)*op(B) + β*C` where `op(A)` is one of the `op(A) = A`, or `op(A) = A^T (row_major, row_major, column_major, transpose, no-transpose)', function test( t ) { +tape( 'the function performs the matrix-matrix operation `C = α*op(A)*op(B) + β*C` (row_major, row_major, column_major, transpose, no-transpose)', function test( t ) { var expected; var data; var out; @@ -824,7 +824,7 @@ tape( 'the function performs one of the matrix-matrix operation `C = α*op(A)*op t.end(); }); -tape( 'the function performs one of the matrix-matrix operation `C = α*op(A)*op(B) + β*C` where `op(A)` is one of the `op(A) = A`, or `op(A) = A^T (row_major, row_major, column_major, no-transpose, transpose)', function test( t ) { +tape( 'the function performs the matrix-matrix operation `C = α*op(A)*op(B) + β*C` (row_major, row_major, column_major, no-transpose, transpose)', function test( t ) { var expected; var data; var out; @@ -846,7 +846,7 @@ tape( 'the function performs one of the matrix-matrix operation `C = α*op(A)*op t.end(); }); -tape( 'the function performs one of the matrix-matrix operation `C = α*op(A)*op(B) + β*C` where `op(A)` is one of the `op(A) = A`, or `op(A) = A^T (row_major, row_major, column_major, transpose, transpose)', function test( t ) { +tape( 'the function performs the matrix-matrix operation `C = α*op(A)*op(B) + β*C` (row_major, row_major, column_major, transpose, transpose)', function test( t ) { var expected; var data; var out; @@ -868,7 +868,7 @@ tape( 'the function performs one of the matrix-matrix operation `C = α*op(A)*op t.end(); }); -tape( 'the function performs one of the matrix-matrix operation `C = α*op(A)*op(B) + β*C` where `op(A)` is one of the `op(A) = A`, or `op(A) = A^T (row_major, row_major, row_major, no-transpose, no-transpose)', function test( t ) { +tape( 'the function performs the matrix-matrix operation `C = α*op(A)*op(B) + β*C` (row_major, row_major, row_major, no-transpose, no-transpose)', function test( t ) { var expected; var data; var out; @@ -890,7 +890,7 @@ tape( 'the function performs one of the matrix-matrix operation `C = α*op(A)*op t.end(); }); -tape( 'the function performs one of the matrix-matrix operation `C = α*op(A)*op(B) + β*C` where `op(A)` is one of the `op(A) = A`, or `op(A) = A^T (row_major, row_major, row_major, transpose, no-transpose)', function test( t ) { +tape( 'the function performs the matrix-matrix operation `C = α*op(A)*op(B) + β*C` (row_major, row_major, row_major, transpose, no-transpose)', function test( t ) { var expected; var data; var out; @@ -912,7 +912,7 @@ tape( 'the function performs one of the matrix-matrix operation `C = α*op(A)*op t.end(); }); -tape( 'the function performs one of the matrix-matrix operation `C = α*op(A)*op(B) + β*C` where `op(A)` is one of the `op(A) = A`, or `op(A) = A^T (row_major, row_major, row_major, no-transpose, transpose)', function test( t ) { +tape( 'the function performs the matrix-matrix operation `C = α*op(A)*op(B) + β*C` (row_major, row_major, row_major, no-transpose, transpose)', function test( t ) { var expected; var data; var out; @@ -934,7 +934,7 @@ tape( 'the function performs one of the matrix-matrix operation `C = α*op(A)*op t.end(); }); -tape( 'the function performs one of the matrix-matrix operation `C = α*op(A)*op(B) + β*C` where `op(A)` is one of the `op(A) = A`, or `op(A) = A^T (row_major, row_major, row_major, transpose, transpose)', function test( t ) { +tape( 'the function performs the matrix-matrix operation `C = α*op(A)*op(B) + β*C` (row_major, row_major, row_major, transpose, transpose)', function test( t ) { var expected; var data; var out; From a84ddd33dc0bdcc99be4411c14583321e04e0004 Mon Sep 17 00:00:00 2001 From: Athan Reines Date: Wed, 14 Aug 2024 21:41:43 -0700 Subject: [PATCH 21/26] test: simplify test descriptions --- .../blas/base/sgemm/test/test.ndarray.js | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/test/test.ndarray.js b/lib/node_modules/@stdlib/blas/base/sgemm/test/test.ndarray.js index 4fe61f35fce4..b9bbe1c96397 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/test/test.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/sgemm/test/test.ndarray.js @@ -1028,7 +1028,7 @@ tape( 'if `α` is `0` or `K` is `0` and `β` is `1`, the function returns the th t.end(); }); -tape( 'the function supports specifying the strides of the first and second dimensions of `A` (column-major, row-major, column-major, transpose, no-transpose)', function test( t ) { +tape( 'the function supports specifying the strides of the first and second dimensions of `A`', function test( t ) { var expected; var data; var out; @@ -1050,7 +1050,7 @@ tape( 'the function supports specifying the strides of the first and second dime t.end(); }); -tape( 'the function supports a negative stride for the first dimension of `A` (column-major, row-major, column-major, transpose, no-transpose)', function test( t ) { +tape( 'the function supports a negative stride for the first dimension of `A`', function test( t ) { var expected; var data; var out; @@ -1072,7 +1072,7 @@ tape( 'the function supports a negative stride for the first dimension of `A` (c t.end(); }); -tape( 'the function supports a negative stride for the second dimension of `A` (column-major, row-major, column-major, transpose, no-transpose)', function test( t ) { +tape( 'the function supports a negative stride for the second dimension of `A`', function test( t ) { var expected; var data; var out; @@ -1094,7 +1094,7 @@ tape( 'the function supports a negative stride for the second dimension of `A` ( t.end(); }); -tape( 'the function supports negative strides for `A` (column-major, row-major, column-major, transpose, no-transpose)', function test( t ) { +tape( 'the function supports negative strides for `A`', function test( t ) { var expected; var data; var out; @@ -1116,7 +1116,7 @@ tape( 'the function supports negative strides for `A` (column-major, row-major, t.end(); }); -tape( 'the function supports specifying an offset parameter for `A` (row-major, row-major, row-major, no-transpose, no-transpose)', function test( t ) { +tape( 'the function supports specifying an offset parameter for `A`', function test( t ) { var expected; var data; var out; @@ -1138,7 +1138,7 @@ tape( 'the function supports specifying an offset parameter for `A` (row-major, t.end(); }); -tape( 'the function supports specifying the strides of the first and second dimensions of `B` (row-major, row-major, column-major, transpose, no-transpose)', function test( t ) { +tape( 'the function supports specifying the strides of the first and second dimensions of `B`', function test( t ) { var expected; var data; var out; @@ -1160,7 +1160,7 @@ tape( 'the function supports specifying the strides of the first and second dime t.end(); }); -tape( 'the function supports a negative stride for the first dimension of `B` (row-major, row-major, column-major, transpose, no-transpose)', function test( t ) { +tape( 'the function supports a negative stride for the first dimension of `B`', function test( t ) { var expected; var data; var out; @@ -1182,7 +1182,7 @@ tape( 'the function supports a negative stride for the first dimension of `B` (r t.end(); }); -tape( 'the function supports a negative stride for the second dimension of `B` (row-major, row-major, column-major, transpose, no-transpose)', function test( t ) { +tape( 'the function supports a negative stride for the second dimension of `B`', function test( t ) { var expected; var data; var out; @@ -1204,7 +1204,7 @@ tape( 'the function supports a negative stride for the second dimension of `B` ( t.end(); }); -tape( 'the function supports negative strides for `B` (row-major, row-major, column-major, transpose, no-transpose)', function test( t ) { +tape( 'the function supports negative strides for `B`', function test( t ) { var expected; var data; var out; @@ -1226,7 +1226,7 @@ tape( 'the function supports negative strides for `B` (row-major, row-major, col t.end(); }); -tape( 'the function supports specifying an offset parameter for `B` (row-major, row-major, row-major, no-transpose, no-transpose)', function test( t ) { +tape( 'the function supports specifying an offset parameter for `B`', function test( t ) { var expected; var data; var out; @@ -1248,7 +1248,7 @@ tape( 'the function supports specifying an offset parameter for `B` (row-major, t.end(); }); -tape( 'the function supports specifying the strides of the first and second dimensions of `C` (row-major, column-major, column-major, no-transpose, transpose)', function test( t ) { +tape( 'the function supports specifying the strides of the first and second dimensions of `C`', function test( t ) { var expected; var data; var out; @@ -1270,7 +1270,7 @@ tape( 'the function supports specifying the strides of the first and second dime t.end(); }); -tape( 'the function supports a negative stride for the first dimension of `C` (row-major, row-major, column-major, transpose, no-transpose)', function test( t ) { +tape( 'the function supports a negative stride for the first dimension of `C`', function test( t ) { var expected; var data; var out; @@ -1292,7 +1292,7 @@ tape( 'the function supports a negative stride for the first dimension of `C` (r t.end(); }); -tape( 'the function supports a negative stride for the second dimension of `C` (row-major, row-major, column-major, transpose, no-transpose)', function test( t ) { +tape( 'the function supports a negative stride for the second dimension of `C`', function test( t ) { var expected; var data; var out; @@ -1314,7 +1314,7 @@ tape( 'the function supports a negative stride for the second dimension of `C` ( t.end(); }); -tape( 'the function supports negative strides for `C` (row-major, row-major, column-major, transpose, no-transpose)', function test( t ) { +tape( 'the function supports negative strides for `C`', function test( t ) { var expected; var data; var out; @@ -1336,7 +1336,7 @@ tape( 'the function supports negative strides for `C` (row-major, row-major, col t.end(); }); -tape( 'the function supports specifying an offset parameter for `C` (row-major, row-major, row-major, no-transpose, no-transpose)', function test( t ) { +tape( 'the function supports specifying an offset parameter for `C`', function test( t ) { var expected; var data; var out; @@ -1358,7 +1358,7 @@ tape( 'the function supports specifying an offset parameter for `C` (row-major, t.end(); }); -tape( 'the function supports complex access patterns (row-major, row-major, row-major, no-transpose, no-transpose)', function test( t ) { +tape( 'the function supports complex access patterns', function test( t ) { var expected; var data; var out; From e47811c2c546e68be0e2fe752e8d9f887dd0738e Mon Sep 17 00:00:00 2001 From: Athan Reines Date: Wed, 14 Aug 2024 21:43:55 -0700 Subject: [PATCH 22/26] test: simplify test descriptions --- .../@stdlib/blas/base/sgemm/test/test.sgemm.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/test/test.sgemm.js b/lib/node_modules/@stdlib/blas/base/sgemm/test/test.sgemm.js index edfda2ac18ae..06cb73e6c832 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/test/test.sgemm.js +++ b/lib/node_modules/@stdlib/blas/base/sgemm/test/test.sgemm.js @@ -323,7 +323,7 @@ tape( 'the function throws an error if provided an invalid fourteenth argument', } }); -tape( 'the function performs one of the matrix-matrix operation `C = α*op(A)*op(B) + β*C` where `op(A)` is one of the `op(A) = A`, or `op(A) = A^T (row-major, no-transpose, no-transpose)', function test( t ) { +tape( 'the function performs the matrix-matrix operation `C = α*op(A)*op(B) + β*C` (row-major, no-transpose, no-transpose)', function test( t ) { var expected; var data; var out; @@ -345,7 +345,7 @@ tape( 'the function performs one of the matrix-matrix operation `C = α*op(A)*op t.end(); }); -tape( 'the function performs one of the matrix-matrix operation `C = α*op(A)*op(B) + β*C` where `op(A)` is one of the `op(A) = A`, or `op(A) = A^T (column-major, no-transpose, no-transpose)', function test( t ) { +tape( 'the function performs the matrix-matrix operation `C = α*op(A)*op(B) + β*C` (column-major, no-transpose, no-transpose)', function test( t ) { var expected; var data; var out; @@ -367,7 +367,7 @@ tape( 'the function performs one of the matrix-matrix operation `C = α*op(A)*op t.end(); }); -tape( 'the function performs one of the matrix-matrix operation `C = α*op(A)*op(B) + β*C` where `op(A)` is one of the `op(A) = A`, or `op(A) = A^T (row-major, transpose, no-transpose)', function test( t ) { +tape( 'the function performs the matrix-matrix operation `C = α*op(A)*op(B) + β*C` (row-major, transpose, no-transpose)', function test( t ) { var expected; var data; var out; @@ -389,7 +389,7 @@ tape( 'the function performs one of the matrix-matrix operation `C = α*op(A)*op t.end(); }); -tape( 'the function performs one of the matrix-matrix operation `C = α*op(A)*op(B) + β*C` where `op(A)` is one of the `op(A) = A`, or `op(A) = A^T (column-major, transpose, no-transpose)', function test( t ) { +tape( 'the function performs the matrix-matrix operation `C = α*op(A)*op(B) + β*C` (column-major, transpose, no-transpose)', function test( t ) { var expected; var data; var out; @@ -411,7 +411,7 @@ tape( 'the function performs one of the matrix-matrix operation `C = α*op(A)*op t.end(); }); -tape( 'the function performs one of the matrix-matrix operation `C = α*op(A)*op(B) + β*C` where `op(A)` is one of the `op(A) = A`, or `op(A) = A^T (row-major, no-transpose, transpose)', function test( t ) { +tape( 'the function performs the matrix-matrix operation `C = α*op(A)*op(B) + β*C` (row-major, no-transpose, transpose)', function test( t ) { var expected; var data; var out; @@ -433,7 +433,7 @@ tape( 'the function performs one of the matrix-matrix operation `C = α*op(A)*op t.end(); }); -tape( 'the function performs one of the matrix-matrix operation `C = α*op(A)*op(B) + β*C` where `op(A)` is one of the `op(A) = A`, or `op(A) = A^T (column-major, no-transpose, transpose)', function test( t ) { +tape( 'the function performs the matrix-matrix operation `C = α*op(A)*op(B) + β*C` (column-major, no-transpose, transpose)', function test( t ) { var expected; var data; var out; @@ -455,7 +455,7 @@ tape( 'the function performs one of the matrix-matrix operation `C = α*op(A)*op t.end(); }); -tape( 'the function performs one of the matrix-matrix operation `C = α*op(A)*op(B) + β*C` where `op(A)` is one of the `op(A) = A`, or `op(A) = A^T (row-major, transpose, transpose)', function test( t ) { +tape( 'the function performs the matrix-matrix operation `C = α*op(A)*op(B) + β*C` (row-major, transpose, transpose)', function test( t ) { var expected; var data; var out; @@ -477,7 +477,7 @@ tape( 'the function performs one of the matrix-matrix operation `C = α*op(A)*op t.end(); }); -tape( 'the function performs one of the matrix-matrix operation `C = α*op(A)*op(B) + β*C` where `op(A)` is one of the `op(A) = A`, or `op(A) = A^T (column-major, transpose, transpose)', function test( t ) { +tape( 'the function performs the matrix-matrix operation `C = α*op(A)*op(B) + β*C` (column-major, transpose, transpose)', function test( t ) { var expected; var data; var out; From 5b77a41a4a2365e443a458c77ea09140f8f3c801 Mon Sep 17 00:00:00 2001 From: Athan Reines Date: Wed, 14 Aug 2024 22:23:56 -0700 Subject: [PATCH 23/26] refactor: reduce code duplication and update descriptions --- lib/node_modules/@stdlib/blas/base/sgemm/docs/repl.txt | 4 ++-- lib/node_modules/@stdlib/blas/base/sgemm/lib/base.js | 3 +++ lib/node_modules/@stdlib/blas/base/sgemm/lib/ndarray.js | 7 ------- lib/node_modules/@stdlib/blas/base/sgemm/lib/sgemm.js | 7 ------- .../@stdlib/blas/base/sgemm/test/test.ndarray.js | 2 +- .../@stdlib/blas/base/sgemm/test/test.sgemm.js | 4 ++-- 6 files changed, 8 insertions(+), 19 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/docs/repl.txt b/lib/node_modules/@stdlib/blas/base/sgemm/docs/repl.txt index 4fa481d3971d..952c314dc8ef 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/docs/repl.txt +++ b/lib/node_modules/@stdlib/blas/base/sgemm/docs/repl.txt @@ -10,8 +10,8 @@ If `M` or `N` is equal to `0`, the function returns `C` unchanged. - If `α` equals `0` or `K` equals `0` and β equals `1`, the function returns - `C` unchanged. + If `α` or `K` equals `0` and `β` equals `1`, the function returns `C` + unchanged. Parameters ---------- diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/lib/base.js b/lib/node_modules/@stdlib/blas/base/sgemm/lib/base.js index 373e563938d2..49e065c5b32a 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/lib/base.js +++ b/lib/node_modules/@stdlib/blas/base/sgemm/lib/base.js @@ -409,6 +409,9 @@ function sgemm( transA, transB, M, N, K, alpha, A, strideA1, strideA2, offsetA, var sb1; var sb2; + if ( M === 0 || N === 0 || ( ( beta === 1.0 ) && ( ( alpha === 0.0 ) || ( K === 0 ) ) ) ) { + return C; + } // Form: C = β⋅C if ( beta === 0.0 ) { C = zeros( M, N, C, strideC1, strideC2, offsetC ); diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/lib/ndarray.js b/lib/node_modules/@stdlib/blas/base/sgemm/lib/ndarray.js index 9c7e4ea09f84..504c7ae9c164 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/lib/ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/sgemm/lib/ndarray.js @@ -82,13 +82,6 @@ function sgemm( transA, transB, M, N, K, alpha, A, strideA1, strideA2, offsetA, if ( K < 0 ) { throw new RangeError( format( 'invalid argument. Fifth argument must be a nonnegative integer. Value: `%d`.', K ) ); } - if ( - M === 0 || - N === 0 || - ( ( beta === 1.0 ) && ( ( alpha === 0.0 ) || ( K === 0 ) ) ) - ) { - return C; - } return base( transA, transB, M, N, K, alpha, A, strideA1, strideA2, offsetA, B, strideB1, strideB2, offsetB, beta, C, strideC1, strideC2, offsetC ); // eslint-disable-line max-len } diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/lib/sgemm.js b/lib/node_modules/@stdlib/blas/base/sgemm/lib/sgemm.js index 36a1ee7d252c..eb1451b3e524 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/lib/sgemm.js +++ b/lib/node_modules/@stdlib/blas/base/sgemm/lib/sgemm.js @@ -126,13 +126,6 @@ function sgemm( order, transA, transB, M, N, K, alpha, A, LDA, B, LDB, beta, C, if ( LDC < max( 1, valc ) ) { throw new RangeError( format( 'invalid argument. Fourteenth argument must be greater than or equal to max(1,%d). Value: `%d`.', valc, LDC ) ); } - if ( - M === 0 || - N === 0 || - ( ( beta === 1.0 ) && ( ( alpha === 0.0 ) || ( K === 0 ) ) ) - ) { - return C; - } if ( order === 'column-major' ) { sa1 = 1; sa2 = LDA; diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/test/test.ndarray.js b/lib/node_modules/@stdlib/blas/base/sgemm/test/test.ndarray.js index b9bbe1c96397..ce1d542c937c 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/test/test.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/sgemm/test/test.ndarray.js @@ -1001,7 +1001,7 @@ tape( 'if either `M` or `N` is `0`, the function returns the third input matrix t.end(); }); -tape( 'if `α` is `0` or `K` is `0` and `β` is `1`, the function returns the third input matrix unchanged', function test( t ) { +tape( 'if `α` or `K` is `0` and `β` is `1`, the function returns the third input matrix unchanged', function test( t ) { var expected; var data; var out; diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/test/test.sgemm.js b/lib/node_modules/@stdlib/blas/base/sgemm/test/test.sgemm.js index 06cb73e6c832..92f75b00b1c8 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/test/test.sgemm.js +++ b/lib/node_modules/@stdlib/blas/base/sgemm/test/test.sgemm.js @@ -589,7 +589,7 @@ tape( 'if either `M` or `N` is `0`, the function returns the third input matrix t.end(); }); -tape( 'if `α` is `0` or `K` is `0` and `β` is `1`, the function returns the third input matrix unchanged (row-major)', function test( t ) { +tape( 'if `α` or `K` is `0` and `β` is `1`, the function returns the third input matrix unchanged (row-major)', function test( t ) { var expected; var data; var out; @@ -616,7 +616,7 @@ tape( 'if `α` is `0` or `K` is `0` and `β` is `1`, the function returns the th t.end(); }); -tape( 'if `α` is `0` or `K` is `0` and `β` is `1`, the function returns the third input matrix unchanged (column-major)', function test( t ) { +tape( 'if `α` or `K` is `0` and `β` is `1`, the function returns the third input matrix unchanged (column-major)', function test( t ) { var expected; var data; var out; From f79d1b171e1d9665d4bcca35483700e8b3670d9d Mon Sep 17 00:00:00 2001 From: Athan Reines Date: Wed, 14 Aug 2024 22:32:30 -0700 Subject: [PATCH 24/26] test: add missing tests --- .../blas/base/sgemm/test/test.sgemm.js | 93 +++++++++++++++++++ 1 file changed, 93 insertions(+) diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/test/test.sgemm.js b/lib/node_modules/@stdlib/blas/base/sgemm/test/test.sgemm.js index 92f75b00b1c8..47b79cae4819 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/test/test.sgemm.js +++ b/lib/node_modules/@stdlib/blas/base/sgemm/test/test.sgemm.js @@ -26,6 +26,7 @@ var tape = require( 'tape' ); var Float32Array = require( '@stdlib/array/float32' ); var EPS = require( '@stdlib/constants/float32/eps' ); var abs = require( '@stdlib/math/base/special/abs' ); +var sscal = require( '@stdlib/blas/base/sscal' ); var sgemm = require( './../lib/sgemm.js' ); @@ -642,3 +643,95 @@ tape( 'if `α` or `K` is `0` and `β` is `1`, the function returns the third inp t.end(); }); + +tape( 'if `α` is `0` and `β` is `0`, the function returns the third input matrix filled with zeros (row-major)', function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = rtatb; + + a = new Float32Array( data.A ); + b = new Float32Array( data.B ); + c = new Float32Array( data.C ); + + expected = new Float32Array( c.length ); + + out = sgemm( data.order, data.transA, data.transB, data.M, data.N, data.K, 0.0, a, data.lda, b, data.ldb, 0.0, c, data.ldc ); + t.strictEqual( out, c, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'if `α` is `0` and `β` is `0`, the function returns the third input matrix filled with zeros (column-major)', function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = ctatb; + + a = new Float32Array( data.A ); + b = new Float32Array( data.B ); + c = new Float32Array( data.C ); + + expected = new Float32Array( c.length ); + + out = sgemm( data.order, data.transA, data.transB, data.M, data.N, data.K, 0.0, a, data.lda, b, data.ldb, 0.0, c, data.ldc ); + t.strictEqual( out, c, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'if `α` is `0` and `β` is neither `0` nor `1`, the function returns the third input matrix scaled by `β` (row-major)', function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = rtatb; + + a = new Float32Array( data.A ); + b = new Float32Array( data.B ); + c = new Float32Array( data.C ); + + expected = sscal( c.length, 10.0, new Float32Array( c ), 1 ); + + out = sgemm( data.order, data.transA, data.transB, data.M, data.N, data.K, 0.0, a, data.lda, b, data.ldb, 10.0, c, data.ldc ); + t.strictEqual( out, c, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'if `α` is `0` and `β` is neither `0` nor `1`, the function returns the third input matrix scaled by `β` (column-major)', function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = ctatb; + + a = new Float32Array( data.A ); + b = new Float32Array( data.B ); + c = new Float32Array( data.C ); + + expected = sscal( c.length, 10.0, new Float32Array( c ), 1 ); + + out = sgemm( data.order, data.transA, data.transB, data.M, data.N, data.K, 0.0, a, data.lda, b, data.ldb, 10.0, c, data.ldc ); + t.strictEqual( out, c, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); From d185ae77b921f790cbccd82494500ee88c0db317 Mon Sep 17 00:00:00 2001 From: Athan Reines Date: Wed, 14 Aug 2024 23:10:49 -0700 Subject: [PATCH 25/26] test: add missing tests --- .../blas/base/sgemm/test/test.ndarray.js | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/test/test.ndarray.js b/lib/node_modules/@stdlib/blas/base/sgemm/test/test.ndarray.js index ce1d542c937c..2b8d9dcfb676 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/test/test.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/sgemm/test/test.ndarray.js @@ -26,6 +26,7 @@ var tape = require( 'tape' ); var Float32Array = require( '@stdlib/array/float32' ); var EPS = require( '@stdlib/constants/float32/eps' ); var abs = require( '@stdlib/math/base/special/abs' ); +var sscal = require( '@stdlib/blas/base/sscal' ); var sgemm = require( './../lib/ndarray.js' ); @@ -1028,6 +1029,52 @@ tape( 'if `α` or `K` is `0` and `β` is `1`, the function returns the third inp t.end(); }); +tape( 'if `α` is `0` and `β` is `0`, the function returns the third input matrix filled with zeros', function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = rarbrctatb; + + a = new Float32Array( data.A ); + b = new Float32Array( data.B ); + c = new Float32Array( data.C ); + + expected = new Float32Array( c.length ); + + out = sgemm( data.transA, data.transB, data.M, data.N, data.K, 0.0, a, data.strideA1, data.strideA2, data.offsetA, b, data.strideB1, data.strideB2, data.offsetB, 0.0, c, data.strideC1, data.strideC2, data.offsetC ); + t.strictEqual( out, c, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'if `α` is `0` and `β` is neither `0` nor `1`, the function returns the third input matrix scaled by `β`', function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = rarbrctatb; + + a = new Float32Array( data.A ); + b = new Float32Array( data.B ); + c = new Float32Array( data.C ); + + expected = sscal( c.length, 10.0, new Float32Array( c ), 1 ); + + out = sgemm( data.transA, data.transB, data.M, data.N, data.K, 0.0, a, data.strideA1, data.strideA2, data.offsetA, b, data.strideB1, data.strideB2, data.offsetB, 10.0, c, data.strideC1, data.strideC2, data.offsetC ); + t.strictEqual( out, c, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + tape( 'the function supports specifying the strides of the first and second dimensions of `A`', function test( t ) { var expected; var data; From f93fe2aff9ffc5a13b8530788a26bb4e42be868f Mon Sep 17 00:00:00 2001 From: Athan Reines Date: Thu, 15 Aug 2024 00:07:13 -0700 Subject: [PATCH 26/26] test: add tests to verify blocked iteration behavior --- .../blas/base/sgemm/test/test.ndarray.js | 46 +++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/lib/node_modules/@stdlib/blas/base/sgemm/test/test.ndarray.js b/lib/node_modules/@stdlib/blas/base/sgemm/test/test.ndarray.js index 2b8d9dcfb676..db4f51075bc3 100644 --- a/lib/node_modules/@stdlib/blas/base/sgemm/test/test.ndarray.js +++ b/lib/node_modules/@stdlib/blas/base/sgemm/test/test.ndarray.js @@ -26,6 +26,8 @@ var tape = require( 'tape' ); var Float32Array = require( '@stdlib/array/float32' ); var EPS = require( '@stdlib/constants/float32/eps' ); var abs = require( '@stdlib/math/base/special/abs' ); +var ones = require( '@stdlib/array/ones' ); +var filled = require( '@stdlib/array/filled' ); var sscal = require( '@stdlib/blas/base/sscal' ); var sgemm = require( './../lib/ndarray.js' ); @@ -1426,3 +1428,47 @@ tape( 'the function supports complex access patterns', function test( t ) { t.strictEqual( out, c, 'returns expected value' ); t.end(); }); + +tape( 'the function supports computation over large arrays (row-major, row-major, row-major)', function test( t ) { + var expected; + var out; + var N; + var a; + var b; + var c; + + N = 100; + + a = ones( N*N, 'float32' ); + b = ones( a.length, 'float32' ); + c = new Float32Array( a.length ); + + expected = filled( N, a.length, 'float32' ); + + out = sgemm( 'no-transpose', 'no-transpose', N, N, N, 1.0, a, N, 1, 0, b, N, 1, 0, 1.0, c, N, 1, 0 ); + t.strictEqual( out, c, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports computation over large arrays (column-major, column-major, column-major)', function test( t ) { + var expected; + var out; + var N; + var a; + var b; + var c; + + N = 100; + + a = ones( N*N, 'float32' ); + b = ones( a.length, 'float32' ); + c = new Float32Array( a.length ); + + expected = filled( N, a.length, 'float32' ); + + out = sgemm( 'no-transpose', 'no-transpose', N, N, N, 1.0, a, 1, N, 0, b, 1, N, 0, 1.0, c, 1, N, 0 ); + t.strictEqual( out, c, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + t.end(); +});