diff --git a/lib/node_modules/@stdlib/blas/base/ggemm/README.md b/lib/node_modules/@stdlib/blas/base/ggemm/README.md new file mode 100644 index 000000000000..eb8bb1afddd4 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ggemm/README.md @@ -0,0 +1,256 @@ + + +# ggemm + +> 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`. + +
+ +## Usage + +```javascript +var ggemm = require( '@stdlib/blas/base/ggemm' ); +``` + +#### ggemm( 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(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. + +```javascript +var A = [ 1.0, 2.0, 3.0, 4.0 ]; +var B = [ 1.0, 1.0, 0.0, 1.0 ]; +var C = [ 1.0, 2.0, 3.0, 4.0 ]; + +ggemm( '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. +- **lda**: stride of the first dimension of `A` (leading dimension of `A`). +- **B**: second input matrix stored in linear memory. +- **ldb**: stride of the first dimension of `B` (leading dimension of `B`). +- **β**: scalar constant +- **C**: third input matrix stored in linear memory. +- **ldc**: stride of the first dimension of `C` (leading dimension of `C`). + +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 A = [ 1.0, 2.0, 0.0, 0.0, 3.0, 4.0, 0.0, 0.0 ]; +var B = [ 1.0, 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0 ]; +var C = [ 1.0, 2.0, 3.0, 4.0 ]; + +ggemm( '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 ] +``` + + + +#### ggemm.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(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. + +```javascript +var A = [ 1.0, 2.0, 3.0, 4.0 ]; +var B = [ 1.0, 1.0, 0.0, 1.0 ]; +var C = [ 1.0, 2.0, 3.0, 4.0 ]; + +ggemm.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 A = [ 0.0, 0.0, 1.0, 3.0, 2.0, 4.0 ]; +var B = [ 0.0, 1.0, 0.0, 1.0, 1.0 ]; +var C = [ 0.0, 0.0, 0.0, 1.0, 3.0, 2.0, 4.0 ]; + +ggemm.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 ] +``` + +
+ + + +
+ +## Notes + +- `ggemm()` corresponds to the [BLAS][blas] level 3 function [`dgemm`][dgemm] with the exception that this implementation works with any array type, not just Float64Arrays. Depending on the environment, the typed versions ([`dgemm`][@stdlib/blas/base/dgemm], [`sgemm`][@stdlib/blas/base/sgemm], etc.) are likely to be significantly more performant. +- Both functions support array-like objects having getter and setter accessors for array element access (e.g., [`@stdlib/array/base/accessor`][@stdlib/array/base/accessor]). + +
+ + + +
+ +## Examples + + + +```javascript +var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); +var ggemm = require( '@stdlib/blas/base/ggemm' ); + +var opts = { + 'dtype': 'generic' +}; + +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 + +ggemm( 'row-major', 'no-transpose', 'no-transpose', M, N, K, 1.0, A, K, B, N, 1.0, C, N ); +console.log( C ); + +ggemm.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/ggemm.h" +``` + +#### TODO + +TODO. + +```c +TODO +``` + +TODO + +```c +TODO +``` + +
+ + + + + +
+ +
+ + + + + +
+ +### Examples + +```c +TODO +``` + +
+ + + +
+ + + + + + + + + + + + + + diff --git a/lib/node_modules/@stdlib/blas/base/ggemm/benchmark/benchmark_ca_cb_cc_nta_ntb.ndarray.js b/lib/node_modules/@stdlib/blas/base/ggemm/benchmark/benchmark_ca_cb_cc_nta_ntb.ndarray.js new file mode 100644 index 000000000000..704c54e100e1 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ggemm/benchmark/benchmark_ca_cb_cc_nta_ntb.ndarray.js @@ -0,0 +1,105 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var uniform = require( '@stdlib/random/array/uniform' ); +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var pkg = require( './../package.json' ).name; +var ggemm = require( './../lib/ndarray.js' ); + + +// VARIABLES // + +var options = { + 'dtype': 'float64' +}; + + +// 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 = ggemm( 'no-transpose', 'no-transpose', N, N, N, 1.0, A, 1, N, 0, B, 1, N, 0, 1.0, C, 1, N, 0 ); + if ( isnan( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var min; + var max; + var N; + var f; + var i; + + min = 1; // 10^min + max = 5; // 10^max + + for ( i = min; i <= max; i++ ) { + N = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + f = createBenchmark( N ); + bench( pkg+':ndarray:order(A)=column-major,order(B)=column-major,order(C)=column-major,trans(A)=false,trans(B)=false,size='+(N*N), f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/ggemm/benchmark/benchmark_ca_cb_cc_nta_tb.ndarray.js b/lib/node_modules/@stdlib/blas/base/ggemm/benchmark/benchmark_ca_cb_cc_nta_tb.ndarray.js new file mode 100644 index 000000000000..2d12a379e661 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ggemm/benchmark/benchmark_ca_cb_cc_nta_tb.ndarray.js @@ -0,0 +1,105 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var uniform = require( '@stdlib/random/array/uniform' ); +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var pkg = require( './../package.json' ).name; +var ggemm = require( './../lib/ndarray.js' ); + + +// VARIABLES // + +var options = { + 'dtype': 'float64' +}; + + +// 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 = ggemm( 'no-transpose', 'transpose', N, N, N, 1.0, A, 1, N, 0, B, 1, N, 0, 1.0, C, 1, N, 0 ); + if ( isnan( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var min; + var max; + var N; + var f; + var i; + + min = 1; // 10^min + max = 5; // 10^max + + for ( i = min; i <= max; i++ ) { + N = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + f = createBenchmark( N ); + bench( pkg+':ndarray:order(A)=column-major,order(B)=column-major,order(C)=column-major,trans(A)=false,trans(B)=true,size='+(N*N), f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/ggemm/benchmark/benchmark_ca_cb_cc_ta_ntb.ndarray.js b/lib/node_modules/@stdlib/blas/base/ggemm/benchmark/benchmark_ca_cb_cc_ta_ntb.ndarray.js new file mode 100644 index 000000000000..1eb520acc280 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ggemm/benchmark/benchmark_ca_cb_cc_ta_ntb.ndarray.js @@ -0,0 +1,105 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var uniform = require( '@stdlib/random/array/uniform' ); +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var pkg = require( './../package.json' ).name; +var ggemm = require( './../lib/ndarray.js' ); + + +// VARIABLES // + +var options = { + 'dtype': 'float64' +}; + + +// 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 = ggemm( 'transpose', 'no-transpose', N, N, N, 1.0, A, 1, N, 0, B, 1, N, 0, 1.0, C, 1, N, 0 ); + if ( isnan( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var min; + var max; + var N; + var f; + var i; + + min = 1; // 10^min + max = 5; // 10^max + + for ( i = min; i <= max; i++ ) { + N = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + f = createBenchmark( N ); + bench( pkg+':ndarray:order(A)=column-major,order(B)=column-major,order(C)=column-major,trans(A)=true,trans(B)=false,size='+(N*N), f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/ggemm/benchmark/benchmark_ca_cb_cc_ta_tb.ndarray.js b/lib/node_modules/@stdlib/blas/base/ggemm/benchmark/benchmark_ca_cb_cc_ta_tb.ndarray.js new file mode 100644 index 000000000000..322ec9071dfb --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ggemm/benchmark/benchmark_ca_cb_cc_ta_tb.ndarray.js @@ -0,0 +1,105 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var uniform = require( '@stdlib/random/array/uniform' ); +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var pkg = require( './../package.json' ).name; +var ggemm = require( './../lib/ndarray.js' ); + + +// VARIABLES // + +var options = { + 'dtype': 'float64' +}; + + +// 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 = ggemm( 'transpose', 'transpose', N, N, N, 1.0, A, 1, N, 0, B, 1, N, 0, 1.0, C, 1, N, 0 ); + if ( isnan( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var min; + var max; + var N; + var f; + var i; + + min = 1; // 10^min + max = 5; // 10^max + + for ( i = min; i <= max; i++ ) { + N = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + f = createBenchmark( N ); + bench( pkg+':ndarray:order(A)=column-major,order(B)=column-major,order(C)=column-major,trans(A)=true,trans(B)=true,size='+(N*N), f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/ggemm/benchmark/benchmark_ca_cb_rc_nta_ntb.ndarray.js b/lib/node_modules/@stdlib/blas/base/ggemm/benchmark/benchmark_ca_cb_rc_nta_ntb.ndarray.js new file mode 100644 index 000000000000..435520264a7c --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ggemm/benchmark/benchmark_ca_cb_rc_nta_ntb.ndarray.js @@ -0,0 +1,105 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var uniform = require( '@stdlib/random/array/uniform' ); +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var pkg = require( './../package.json' ).name; +var ggemm = require( './../lib/ndarray.js' ); + + +// VARIABLES // + +var options = { + 'dtype': 'float64' +}; + + +// 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 = ggemm( 'no-transpose', 'no-transpose', N, N, N, 1.0, A, 1, N, 0, B, 1, N, 0, 1.0, C, N, 1, 0 ); + if ( isnan( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var min; + var max; + var N; + var f; + var i; + + min = 1; // 10^min + max = 5; // 10^max + + for ( i = min; i <= max; i++ ) { + N = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + f = createBenchmark( N ); + bench( pkg+':ndarray:order(A)=column-major,order(B)=column-major,order(C)=row-major,trans(A)=false,trans(B)=false,size='+(N*N), f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/ggemm/benchmark/benchmark_ca_cb_rc_nta_tb.ndarray.js b/lib/node_modules/@stdlib/blas/base/ggemm/benchmark/benchmark_ca_cb_rc_nta_tb.ndarray.js new file mode 100644 index 000000000000..28eee2041045 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ggemm/benchmark/benchmark_ca_cb_rc_nta_tb.ndarray.js @@ -0,0 +1,105 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var uniform = require( '@stdlib/random/array/uniform' ); +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var pkg = require( './../package.json' ).name; +var ggemm = require( './../lib/ndarray.js' ); + + +// VARIABLES // + +var options = { + 'dtype': 'float64' +}; + + +// 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 = ggemm( 'no-transpose', 'transpose', N, N, N, 1.0, A, 1, N, 0, B, 1, N, 0, 1.0, C, N, 1, 0 ); + if ( isnan( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var min; + var max; + var N; + var f; + var i; + + min = 1; // 10^min + max = 5; // 10^max + + for ( i = min; i <= max; i++ ) { + N = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + f = createBenchmark( N ); + bench( pkg+':ndarray:order(A)=column-major,order(B)=column-major,order(C)=row-major,trans(A)=false,trans(B)=true,size='+(N*N), f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/ggemm/benchmark/benchmark_ca_cb_rc_ta_ntb.ndarray.js b/lib/node_modules/@stdlib/blas/base/ggemm/benchmark/benchmark_ca_cb_rc_ta_ntb.ndarray.js new file mode 100644 index 000000000000..af1246cbab95 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ggemm/benchmark/benchmark_ca_cb_rc_ta_ntb.ndarray.js @@ -0,0 +1,105 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var uniform = require( '@stdlib/random/array/uniform' ); +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var pkg = require( './../package.json' ).name; +var ggemm = require( './../lib/ndarray.js' ); + + +// VARIABLES // + +var options = { + 'dtype': 'float64' +}; + + +// 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 = ggemm( 'transpose', 'no-transpose', N, N, N, 1.0, A, 1, N, 0, B, 1, N, 0, 1.0, C, N, 1, 0 ); + if ( isnan( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var min; + var max; + var N; + var f; + var i; + + min = 1; // 10^min + max = 5; // 10^max + + for ( i = min; i <= max; i++ ) { + N = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + f = createBenchmark( N ); + bench( pkg+':ndarray:order(A)=column-major,order(B)=column-major,order(C)=row-major,trans(A)=true,trans(B)=false,size='+(N*N), f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/ggemm/benchmark/benchmark_ca_cb_rc_ta_tb.ndarray.js b/lib/node_modules/@stdlib/blas/base/ggemm/benchmark/benchmark_ca_cb_rc_ta_tb.ndarray.js new file mode 100644 index 000000000000..ff35088bb69c --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ggemm/benchmark/benchmark_ca_cb_rc_ta_tb.ndarray.js @@ -0,0 +1,105 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var uniform = require( '@stdlib/random/array/uniform' ); +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var pkg = require( './../package.json' ).name; +var ggemm = require( './../lib/ndarray.js' ); + + +// VARIABLES // + +var options = { + 'dtype': 'float64' +}; + + +// 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 = ggemm( 'transpose', 'transpose', N, N, N, 1.0, A, 1, N, 0, B, 1, N, 0, 1.0, C, N, 1, 0 ); + if ( isnan( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var min; + var max; + var N; + var f; + var i; + + min = 1; // 10^min + max = 5; // 10^max + + for ( i = min; i <= max; i++ ) { + N = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + f = createBenchmark( N ); + bench( pkg+':ndarray:order(A)=column-major,order(B)=column-major,order(C)=row-major,trans(A)=true,trans(B)=true,size='+(N*N), f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/ggemm/benchmark/benchmark_ca_rb_cc_nta_ntb.ndarray.js b/lib/node_modules/@stdlib/blas/base/ggemm/benchmark/benchmark_ca_rb_cc_nta_ntb.ndarray.js new file mode 100644 index 000000000000..8d74b6c8a6c9 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ggemm/benchmark/benchmark_ca_rb_cc_nta_ntb.ndarray.js @@ -0,0 +1,105 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var uniform = require( '@stdlib/random/array/uniform' ); +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var pkg = require( './../package.json' ).name; +var ggemm = require( './../lib/ndarray.js' ); + + +// VARIABLES // + +var options = { + 'dtype': 'float64' +}; + + +// 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 = ggemm( 'no-transpose', 'no-transpose', N, N, N, 1.0, A, 1, N, 0, B, N, 1, 0, 1.0, C, 1, N, 0 ); + if ( isnan( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var min; + var max; + var N; + var f; + var i; + + min = 1; // 10^min + max = 5; // 10^max + + for ( i = min; i <= max; i++ ) { + N = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + f = createBenchmark( N ); + bench( pkg+':ndarray:order(A)=column-major,order(B)=row-major,order(C)=column-major,trans(A)=false,trans(B)=false,size='+(N*N), f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/ggemm/benchmark/benchmark_ca_rb_cc_nta_tb.ndarray.js b/lib/node_modules/@stdlib/blas/base/ggemm/benchmark/benchmark_ca_rb_cc_nta_tb.ndarray.js new file mode 100644 index 000000000000..ab48561ca7f2 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ggemm/benchmark/benchmark_ca_rb_cc_nta_tb.ndarray.js @@ -0,0 +1,105 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var uniform = require( '@stdlib/random/array/uniform' ); +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var pkg = require( './../package.json' ).name; +var ggemm = require( './../lib/ndarray.js' ); + + +// VARIABLES // + +var options = { + 'dtype': 'float64' +}; + + +// 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 = ggemm( 'no-transpose', 'transpose', N, N, N, 1.0, A, 1, N, 0, B, N, 1, 0, 1.0, C, 1, N, 0 ); + if ( isnan( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var min; + var max; + var N; + var f; + var i; + + min = 1; // 10^min + max = 5; // 10^max + + for ( i = min; i <= max; i++ ) { + N = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + f = createBenchmark( N ); + bench( pkg+':ndarray:order(A)=column-major,order(B)=row-major,order(C)=column-major,trans(A)=false,trans(B)=true,size='+(N*N), f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/ggemm/benchmark/benchmark_ca_rb_cc_ta_ntb.ndarray.js b/lib/node_modules/@stdlib/blas/base/ggemm/benchmark/benchmark_ca_rb_cc_ta_ntb.ndarray.js new file mode 100644 index 000000000000..3f988ec25082 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ggemm/benchmark/benchmark_ca_rb_cc_ta_ntb.ndarray.js @@ -0,0 +1,105 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var uniform = require( '@stdlib/random/array/uniform' ); +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var pkg = require( './../package.json' ).name; +var ggemm = require( './../lib/ndarray.js' ); + + +// VARIABLES // + +var options = { + 'dtype': 'float64' +}; + + +// 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 = ggemm( 'transpose', 'no-transpose', N, N, N, 1.0, A, 1, N, 0, B, N, 1, 0, 1.0, C, 1, N, 0 ); + if ( isnan( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var min; + var max; + var N; + var f; + var i; + + min = 1; // 10^min + max = 5; // 10^max + + for ( i = min; i <= max; i++ ) { + N = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + f = createBenchmark( N ); + bench( pkg+':ndarray:order(A)=column-major,order(B)=row-major,order(C)=column-major,trans(A)=true,trans(B)=false,size='+(N*N), f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/ggemm/benchmark/benchmark_ca_rb_cc_ta_tb.ndarray.js b/lib/node_modules/@stdlib/blas/base/ggemm/benchmark/benchmark_ca_rb_cc_ta_tb.ndarray.js new file mode 100644 index 000000000000..a05870b08bdc --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ggemm/benchmark/benchmark_ca_rb_cc_ta_tb.ndarray.js @@ -0,0 +1,105 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var uniform = require( '@stdlib/random/array/uniform' ); +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var pkg = require( './../package.json' ).name; +var ggemm = require( './../lib/ndarray.js' ); + + +// VARIABLES // + +var options = { + 'dtype': 'float64' +}; + + +// 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 = ggemm( 'transpose', 'transpose', N, N, N, 1.0, A, 1, N, 0, B, N, 1, 0, 1.0, C, 1, N, 0 ); + if ( isnan( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var min; + var max; + var N; + var f; + var i; + + min = 1; // 10^min + max = 5; // 10^max + + for ( i = min; i <= max; i++ ) { + N = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + f = createBenchmark( N ); + bench( pkg+':ndarray:order(A)=column-major,order(B)=row-major,order(C)=column-major,trans(A)=true,trans(B)=true,size='+(N*N), f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/ggemm/benchmark/benchmark_ca_rb_rc_nta_ntb.ndarray.js b/lib/node_modules/@stdlib/blas/base/ggemm/benchmark/benchmark_ca_rb_rc_nta_ntb.ndarray.js new file mode 100644 index 000000000000..868a1e1a65dc --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ggemm/benchmark/benchmark_ca_rb_rc_nta_ntb.ndarray.js @@ -0,0 +1,105 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var uniform = require( '@stdlib/random/array/uniform' ); +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var pkg = require( './../package.json' ).name; +var ggemm = require( './../lib/ndarray.js' ); + + +// VARIABLES // + +var options = { + 'dtype': 'float64' +}; + + +// 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 = ggemm( 'no-transpose', 'no-transpose', N, N, N, 1.0, A, 1, N, 0, B, N, 1, 0, 1.0, C, N, 1, 0 ); + if ( isnan( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var min; + var max; + var N; + var f; + var i; + + min = 1; // 10^min + max = 5; // 10^max + + for ( i = min; i <= max; i++ ) { + N = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + f = createBenchmark( N ); + bench( pkg+':ndarray:order(A)=column-major,order(B)=row-major,order(C)=row-major,trans(A)=false,trans(B)=false,size='+(N*N), f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/ggemm/benchmark/benchmark_ca_rb_rc_nta_tb.ndarray.js b/lib/node_modules/@stdlib/blas/base/ggemm/benchmark/benchmark_ca_rb_rc_nta_tb.ndarray.js new file mode 100644 index 000000000000..cccfd6bb8638 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ggemm/benchmark/benchmark_ca_rb_rc_nta_tb.ndarray.js @@ -0,0 +1,105 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var uniform = require( '@stdlib/random/array/uniform' ); +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var pkg = require( './../package.json' ).name; +var ggemm = require( './../lib/ndarray.js' ); + + +// VARIABLES // + +var options = { + 'dtype': 'float64' +}; + + +// 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 = ggemm( 'no-transpose', 'transpose', N, N, N, 1.0, A, 1, N, 0, B, N, 1, 0, 1.0, C, N, 1, 0 ); + if ( isnan( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var min; + var max; + var N; + var f; + var i; + + min = 1; // 10^min + max = 5; // 10^max + + for ( i = min; i <= max; i++ ) { + N = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + f = createBenchmark( N ); + bench( pkg+':ndarray:order(A)=column-major,order(B)=row-major,order(C)=row-major,trans(A)=false,trans(B)=true,size='+(N*N), f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/ggemm/benchmark/benchmark_ca_rb_rc_ta_ntb.ndarray.js b/lib/node_modules/@stdlib/blas/base/ggemm/benchmark/benchmark_ca_rb_rc_ta_ntb.ndarray.js new file mode 100644 index 000000000000..49e07ae370c2 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ggemm/benchmark/benchmark_ca_rb_rc_ta_ntb.ndarray.js @@ -0,0 +1,105 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var uniform = require( '@stdlib/random/array/uniform' ); +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var pkg = require( './../package.json' ).name; +var ggemm = require( './../lib/ndarray.js' ); + + +// VARIABLES // + +var options = { + 'dtype': 'float64' +}; + + +// 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 = ggemm( 'transpose', 'no-transpose', N, N, N, 1.0, A, 1, N, 0, B, N, 1, 0, 1.0, C, N, 1, 0 ); + if ( isnan( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var min; + var max; + var N; + var f; + var i; + + min = 1; // 10^min + max = 5; // 10^max + + for ( i = min; i <= max; i++ ) { + N = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + f = createBenchmark( N ); + bench( pkg+':ndarray:order(A)=column-major,order(B)=row-major,order(C)=row-major,trans(A)=true,trans(B)=false,size='+(N*N), f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/ggemm/benchmark/benchmark_ca_rb_rc_ta_tb.ndarray.js b/lib/node_modules/@stdlib/blas/base/ggemm/benchmark/benchmark_ca_rb_rc_ta_tb.ndarray.js new file mode 100644 index 000000000000..2e57a3041272 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ggemm/benchmark/benchmark_ca_rb_rc_ta_tb.ndarray.js @@ -0,0 +1,105 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var uniform = require( '@stdlib/random/array/uniform' ); +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var pkg = require( './../package.json' ).name; +var ggemm = require( './../lib/ndarray.js' ); + + +// VARIABLES // + +var options = { + 'dtype': 'float64' +}; + + +// 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 = ggemm( 'transpose', 'transpose', N, N, N, 1.0, A, 1, N, 0, B, N, 1, 0, 1.0, C, N, 1, 0 ); + if ( isnan( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var min; + var max; + var N; + var f; + var i; + + min = 1; // 10^min + max = 5; // 10^max + + for ( i = min; i <= max; i++ ) { + N = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + f = createBenchmark( N ); + bench( pkg+':ndarray:order(A)=column-major,order(B)=row-major,order(C)=row-major,trans(A)=true,trans(B)=true,size='+(N*N), f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/ggemm/benchmark/benchmark_column_major_nta_ntb.js b/lib/node_modules/@stdlib/blas/base/ggemm/benchmark/benchmark_column_major_nta_ntb.js new file mode 100644 index 000000000000..7118a2522ca6 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ggemm/benchmark/benchmark_column_major_nta_ntb.js @@ -0,0 +1,105 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var uniform = require( '@stdlib/random/array/uniform' ); +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var pkg = require( './../package.json' ).name; +var ggemm = require( './../lib/main.js' ); + + +// VARIABLES // + +var options = { + 'dtype': 'float64' +}; + + +// 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 = ggemm( 'column-major', 'no-transpose', 'no-transpose', N, N, N, 1.0, A, N, B, N, 1.0, C, N ); + if ( isnan( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var min; + var max; + var N; + var f; + var i; + + min = 1; // 10^min + max = 5; // 10^max + + for ( i = min; i <= max; i++ ) { + N = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + f = createBenchmark( N ); + bench( pkg+':order(A)=column-major,order(B)=column-major,order(C)=column-major,trans(A)=false,trans(B)=false,size='+(N*N), f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/ggemm/benchmark/benchmark_column_major_nta_tb.js b/lib/node_modules/@stdlib/blas/base/ggemm/benchmark/benchmark_column_major_nta_tb.js new file mode 100644 index 000000000000..64a81568a3d9 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ggemm/benchmark/benchmark_column_major_nta_tb.js @@ -0,0 +1,105 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var uniform = require( '@stdlib/random/array/uniform' ); +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var pkg = require( './../package.json' ).name; +var ggemm = require( './../lib/main.js' ); + + +// VARIABLES // + +var options = { + 'dtype': 'float64' +}; + + +// 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 = ggemm( 'column-major', 'no-transpose', 'transpose', N, N, N, 1.0, A, N, B, N, 1.0, C, N ); + if ( isnan( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var min; + var max; + var N; + var f; + var i; + + min = 1; // 10^min + max = 5; // 10^max + + for ( i = min; i <= max; i++ ) { + N = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + f = createBenchmark( N ); + bench( pkg+':order(A)=column-major,order(B)=column-major,order(C)=column-major,trans(A)=false,trans(B)=true,size='+(N*N), f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/ggemm/benchmark/benchmark_column_major_ta_ntb.js b/lib/node_modules/@stdlib/blas/base/ggemm/benchmark/benchmark_column_major_ta_ntb.js new file mode 100644 index 000000000000..3b00c06c367f --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ggemm/benchmark/benchmark_column_major_ta_ntb.js @@ -0,0 +1,105 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var uniform = require( '@stdlib/random/array/uniform' ); +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var pkg = require( './../package.json' ).name; +var ggemm = require( './../lib/main.js' ); + + +// VARIABLES // + +var options = { + 'dtype': 'float64' +}; + + +// 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 = ggemm( 'column-major', 'transpose', 'no-transpose', N, N, N, 1.0, A, N, B, N, 1.0, C, N ); + if ( isnan( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var min; + var max; + var N; + var f; + var i; + + min = 1; // 10^min + max = 5; // 10^max + + for ( i = min; i <= max; i++ ) { + N = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + f = createBenchmark( N ); + bench( pkg+':order(A)=column-major,order(B)=column-major,order(C)=column-major,trans(A)=true,trans(B)=false,size='+(N*N), f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/ggemm/benchmark/benchmark_column_major_ta_tb.js b/lib/node_modules/@stdlib/blas/base/ggemm/benchmark/benchmark_column_major_ta_tb.js new file mode 100644 index 000000000000..4154c106387c --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ggemm/benchmark/benchmark_column_major_ta_tb.js @@ -0,0 +1,105 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var uniform = require( '@stdlib/random/array/uniform' ); +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var pkg = require( './../package.json' ).name; +var ggemm = require( './../lib/main.js' ); + + +// VARIABLES // + +var options = { + 'dtype': 'float64' +}; + + +// 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 = ggemm( 'column-major', 'transpose', 'transpose', N, N, N, 1.0, A, N, B, N, 1.0, C, N ); + if ( isnan( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var min; + var max; + var N; + var f; + var i; + + min = 1; // 10^min + max = 5; // 10^max + + for ( i = min; i <= max; i++ ) { + N = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + f = createBenchmark( N ); + bench( pkg+':order(A)=column-major,order(B)=column-major,order(C)=column-major,trans(A)=true,trans(B)=true,size='+(N*N), f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/ggemm/benchmark/benchmark_ra_cb_cc_nta_ntb.ndarray.js b/lib/node_modules/@stdlib/blas/base/ggemm/benchmark/benchmark_ra_cb_cc_nta_ntb.ndarray.js new file mode 100644 index 000000000000..e3e96e59ea9c --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ggemm/benchmark/benchmark_ra_cb_cc_nta_ntb.ndarray.js @@ -0,0 +1,105 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var uniform = require( '@stdlib/random/array/uniform' ); +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var pkg = require( './../package.json' ).name; +var ggemm = require( './../lib/ndarray.js' ); + + +// VARIABLES // + +var options = { + 'dtype': 'float64' +}; + + +// 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 = ggemm( 'no-transpose', 'no-transpose', N, N, N, 1.0, A, N, 1, 0, B, 1, N, 0, 1.0, C, 1, N, 0 ); + if ( isnan( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var min; + var max; + var N; + var f; + var i; + + min = 1; // 10^min + max = 5; // 10^max + + for ( i = min; i <= max; i++ ) { + N = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + f = createBenchmark( N ); + bench( pkg+':ndarray:order(A)=row-major,order(B)=column-major,order(C)=column-major,trans(A)=false,trans(B)=false,size='+(N*N), f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/ggemm/benchmark/benchmark_ra_cb_cc_nta_tb.ndarray.js b/lib/node_modules/@stdlib/blas/base/ggemm/benchmark/benchmark_ra_cb_cc_nta_tb.ndarray.js new file mode 100644 index 000000000000..0c688d30d83c --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ggemm/benchmark/benchmark_ra_cb_cc_nta_tb.ndarray.js @@ -0,0 +1,105 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var uniform = require( '@stdlib/random/array/uniform' ); +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var pkg = require( './../package.json' ).name; +var ggemm = require( './../lib/ndarray.js' ); + + +// VARIABLES // + +var options = { + 'dtype': 'float64' +}; + + +// 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 = ggemm( 'no-transpose', 'transpose', N, N, N, 1.0, A, N, 1, 0, B, 1, N, 0, 1.0, C, 1, N, 0 ); + if ( isnan( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var min; + var max; + var N; + var f; + var i; + + min = 1; // 10^min + max = 5; // 10^max + + for ( i = min; i <= max; i++ ) { + N = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + f = createBenchmark( N ); + bench( pkg+':ndarray:order(A)=row-major,order(B)=column-major,order(C)=column-major,trans(A)=false,trans(B)=true,size='+(N*N), f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/ggemm/benchmark/benchmark_ra_cb_cc_ta_ntb.ndarray.js b/lib/node_modules/@stdlib/blas/base/ggemm/benchmark/benchmark_ra_cb_cc_ta_ntb.ndarray.js new file mode 100644 index 000000000000..d118c6bb36f8 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ggemm/benchmark/benchmark_ra_cb_cc_ta_ntb.ndarray.js @@ -0,0 +1,105 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var uniform = require( '@stdlib/random/array/uniform' ); +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var pkg = require( './../package.json' ).name; +var ggemm = require( './../lib/ndarray.js' ); + + +// VARIABLES // + +var options = { + 'dtype': 'float64' +}; + + +// 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 = ggemm( 'transpose', 'no-transpose', N, N, N, 1.0, A, N, 1, 0, B, 1, N, 0, 1.0, C, 1, N, 0 ); + if ( isnan( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var min; + var max; + var N; + var f; + var i; + + min = 1; // 10^min + max = 5; // 10^max + + for ( i = min; i <= max; i++ ) { + N = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + f = createBenchmark( N ); + bench( pkg+':ndarray:order(A)=row-major,order(B)=column-major,order(C)=column-major,trans(A)=true,trans(B)=false,size='+(N*N), f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/ggemm/benchmark/benchmark_ra_cb_cc_ta_tb.ndarray.js b/lib/node_modules/@stdlib/blas/base/ggemm/benchmark/benchmark_ra_cb_cc_ta_tb.ndarray.js new file mode 100644 index 000000000000..e39e4fbaf839 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ggemm/benchmark/benchmark_ra_cb_cc_ta_tb.ndarray.js @@ -0,0 +1,105 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var uniform = require( '@stdlib/random/array/uniform' ); +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var pkg = require( './../package.json' ).name; +var ggemm = require( './../lib/ndarray.js' ); + + +// VARIABLES // + +var options = { + 'dtype': 'float64' +}; + + +// 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 = ggemm( 'transpose', 'transpose', N, N, N, 1.0, A, N, 1, 0, B, 1, N, 0, 1.0, C, 1, N, 0 ); + if ( isnan( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var min; + var max; + var N; + var f; + var i; + + min = 1; // 10^min + max = 5; // 10^max + + for ( i = min; i <= max; i++ ) { + N = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + f = createBenchmark( N ); + bench( pkg+':ndarray:order(A)=row-major,order(B)=column-major,order(C)=column-major,trans(A)=true,trans(B)=true,size='+(N*N), f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/ggemm/benchmark/benchmark_ra_cb_rc_nta_ntb.ndarray.js b/lib/node_modules/@stdlib/blas/base/ggemm/benchmark/benchmark_ra_cb_rc_nta_ntb.ndarray.js new file mode 100644 index 000000000000..1bdfbbbe4c7d --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ggemm/benchmark/benchmark_ra_cb_rc_nta_ntb.ndarray.js @@ -0,0 +1,105 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var uniform = require( '@stdlib/random/array/uniform' ); +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var pkg = require( './../package.json' ).name; +var ggemm = require( './../lib/ndarray.js' ); + + +// VARIABLES // + +var options = { + 'dtype': 'float64' +}; + + +// 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 = ggemm( 'no-transpose', 'no-transpose', N, N, N, 1.0, A, N, 1, 0, B, 1, N, 0, 1.0, C, N, 1, 0 ); + if ( isnan( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var min; + var max; + var N; + var f; + var i; + + min = 1; // 10^min + max = 5; // 10^max + + for ( i = min; i <= max; i++ ) { + N = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + f = createBenchmark( N ); + bench( pkg+':ndarray:order(A)=row-major,order(B)=column-major,order(C)=row-major,trans(A)=false,trans(B)=false,size='+(N*N), f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/ggemm/benchmark/benchmark_ra_cb_rc_nta_tb.ndarray.js b/lib/node_modules/@stdlib/blas/base/ggemm/benchmark/benchmark_ra_cb_rc_nta_tb.ndarray.js new file mode 100644 index 000000000000..08f357541e8d --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ggemm/benchmark/benchmark_ra_cb_rc_nta_tb.ndarray.js @@ -0,0 +1,105 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var uniform = require( '@stdlib/random/array/uniform' ); +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var pkg = require( './../package.json' ).name; +var ggemm = require( './../lib/ndarray.js' ); + + +// VARIABLES // + +var options = { + 'dtype': 'float64' +}; + + +// 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 = ggemm( 'no-transpose', 'transpose', N, N, N, 1.0, A, N, 1, 0, B, 1, N, 0, 1.0, C, N, 1, 0 ); + if ( isnan( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var min; + var max; + var N; + var f; + var i; + + min = 1; // 10^min + max = 5; // 10^max + + for ( i = min; i <= max; i++ ) { + N = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + f = createBenchmark( N ); + bench( pkg+':ndarray:order(A)=row-major,order(B)=column-major,order(C)=row-major,trans(A)=false,trans(B)=true,size='+(N*N), f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/ggemm/benchmark/benchmark_ra_cb_rc_ta_ntb.ndarray.js b/lib/node_modules/@stdlib/blas/base/ggemm/benchmark/benchmark_ra_cb_rc_ta_ntb.ndarray.js new file mode 100644 index 000000000000..5278b03b52a7 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ggemm/benchmark/benchmark_ra_cb_rc_ta_ntb.ndarray.js @@ -0,0 +1,105 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var uniform = require( '@stdlib/random/array/uniform' ); +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var pkg = require( './../package.json' ).name; +var ggemm = require( './../lib/ndarray.js' ); + + +// VARIABLES // + +var options = { + 'dtype': 'float64' +}; + + +// 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 = ggemm( 'transpose', 'no-transpose', N, N, N, 1.0, A, N, 1, 0, B, 1, N, 0, 1.0, C, N, 1, 0 ); + if ( isnan( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var min; + var max; + var N; + var f; + var i; + + min = 1; // 10^min + max = 5; // 10^max + + for ( i = min; i <= max; i++ ) { + N = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + f = createBenchmark( N ); + bench( pkg+':ndarray:order(A)=row-major,order(B)=column-major,order(C)=row-major,trans(A)=true,trans(B)=false,size='+(N*N), f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/ggemm/benchmark/benchmark_ra_cb_rc_ta_tb.ndarray.js b/lib/node_modules/@stdlib/blas/base/ggemm/benchmark/benchmark_ra_cb_rc_ta_tb.ndarray.js new file mode 100644 index 000000000000..8fb579cc0486 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ggemm/benchmark/benchmark_ra_cb_rc_ta_tb.ndarray.js @@ -0,0 +1,105 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var uniform = require( '@stdlib/random/array/uniform' ); +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var pkg = require( './../package.json' ).name; +var ggemm = require( './../lib/ndarray.js' ); + + +// VARIABLES // + +var options = { + 'dtype': 'float64' +}; + + +// 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 = ggemm( 'transpose', 'transpose', N, N, N, 1.0, A, N, 1, 0, B, 1, N, 0, 1.0, C, N, 1, 0 ); + if ( isnan( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var min; + var max; + var N; + var f; + var i; + + min = 1; // 10^min + max = 5; // 10^max + + for ( i = min; i <= max; i++ ) { + N = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + f = createBenchmark( N ); + bench( pkg+':ndarray:order(A)=row-major,order(B)=column-major,order(C)=row-major,trans(A)=true,trans(B)=true,size='+(N*N), f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/ggemm/benchmark/benchmark_ra_rb_cc_nta_ntb.ndarray.js b/lib/node_modules/@stdlib/blas/base/ggemm/benchmark/benchmark_ra_rb_cc_nta_ntb.ndarray.js new file mode 100644 index 000000000000..98517ddb7b1c --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ggemm/benchmark/benchmark_ra_rb_cc_nta_ntb.ndarray.js @@ -0,0 +1,105 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var uniform = require( '@stdlib/random/array/uniform' ); +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var pkg = require( './../package.json' ).name; +var ggemm = require( './../lib/ndarray.js' ); + + +// VARIABLES // + +var options = { + 'dtype': 'float64' +}; + + +// 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 = ggemm( 'no-transpose', 'no-transpose', N, N, N, 1.0, A, N, 1, 0, B, N, 1, 0, 1.0, C, 1, N, 0 ); + if ( isnan( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var min; + var max; + var N; + var f; + var i; + + min = 1; // 10^min + max = 5; // 10^max + + for ( i = min; i <= max; i++ ) { + N = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + f = createBenchmark( N ); + bench( pkg+':ndarray:order(A)=row-major,order(B)=row-major,order(C)=column-major,trans(A)=false,trans(B)=false,size='+(N*N), f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/ggemm/benchmark/benchmark_ra_rb_cc_nta_tb.ndarray.js b/lib/node_modules/@stdlib/blas/base/ggemm/benchmark/benchmark_ra_rb_cc_nta_tb.ndarray.js new file mode 100644 index 000000000000..1bdb1c12a40d --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ggemm/benchmark/benchmark_ra_rb_cc_nta_tb.ndarray.js @@ -0,0 +1,105 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var uniform = require( '@stdlib/random/array/uniform' ); +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var pkg = require( './../package.json' ).name; +var ggemm = require( './../lib/ndarray.js' ); + + +// VARIABLES // + +var options = { + 'dtype': 'float64' +}; + + +// 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 = ggemm( 'no-transpose', 'transpose', N, N, N, 1.0, A, N, 1, 0, B, N, 1, 0, 1.0, C, 1, N, 0 ); + if ( isnan( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var min; + var max; + var N; + var f; + var i; + + min = 1; // 10^min + max = 5; // 10^max + + for ( i = min; i <= max; i++ ) { + N = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + f = createBenchmark( N ); + bench( pkg+':ndarray:order(A)=row-major,order(B)=row-major,order(C)=column-major,trans(A)=false,trans(B)=true,size='+(N*N), f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/ggemm/benchmark/benchmark_ra_rb_cc_ta_ntb.ndarray.js b/lib/node_modules/@stdlib/blas/base/ggemm/benchmark/benchmark_ra_rb_cc_ta_ntb.ndarray.js new file mode 100644 index 000000000000..170e2263dff0 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ggemm/benchmark/benchmark_ra_rb_cc_ta_ntb.ndarray.js @@ -0,0 +1,105 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var uniform = require( '@stdlib/random/array/uniform' ); +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var pkg = require( './../package.json' ).name; +var ggemm = require( './../lib/ndarray.js' ); + + +// VARIABLES // + +var options = { + 'dtype': 'float64' +}; + + +// 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 = ggemm( 'transpose', 'no-transpose', N, N, N, 1.0, A, N, 1, 0, B, N, 1, 0, 1.0, C, 1, N, 0 ); + if ( isnan( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var min; + var max; + var N; + var f; + var i; + + min = 1; // 10^min + max = 5; // 10^max + + for ( i = min; i <= max; i++ ) { + N = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + f = createBenchmark( N ); + bench( pkg+':ndarray:order(A)=row-major,order(B)=row-major,order(C)=column-major,trans(A)=true,trans(B)=false,size='+(N*N), f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/ggemm/benchmark/benchmark_ra_rb_cc_ta_tb.ndarray.js b/lib/node_modules/@stdlib/blas/base/ggemm/benchmark/benchmark_ra_rb_cc_ta_tb.ndarray.js new file mode 100644 index 000000000000..33162ac8a478 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ggemm/benchmark/benchmark_ra_rb_cc_ta_tb.ndarray.js @@ -0,0 +1,105 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var uniform = require( '@stdlib/random/array/uniform' ); +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var pkg = require( './../package.json' ).name; +var ggemm = require( './../lib/ndarray.js' ); + + +// VARIABLES // + +var options = { + 'dtype': 'float64' +}; + + +// 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 = ggemm( 'transpose', 'transpose', N, N, N, 1.0, A, N, 1, 0, B, N, 1, 0, 1.0, C, 1, N, 0 ); + if ( isnan( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var min; + var max; + var N; + var f; + var i; + + min = 1; // 10^min + max = 5; // 10^max + + for ( i = min; i <= max; i++ ) { + N = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + f = createBenchmark( N ); + bench( pkg+':ndarray:order(A)=row-major,order(B)=row-major,order(C)=column-major,trans(A)=true,trans(B)=true,size='+(N*N), f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/ggemm/benchmark/benchmark_ra_rb_rc_nta_ntb.ndarray.js b/lib/node_modules/@stdlib/blas/base/ggemm/benchmark/benchmark_ra_rb_rc_nta_ntb.ndarray.js new file mode 100644 index 000000000000..17d86ae8f422 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ggemm/benchmark/benchmark_ra_rb_rc_nta_ntb.ndarray.js @@ -0,0 +1,105 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var uniform = require( '@stdlib/random/array/uniform' ); +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var pkg = require( './../package.json' ).name; +var ggemm = require( './../lib/ndarray.js' ); + + +// VARIABLES // + +var options = { + 'dtype': 'float64' +}; + + +// 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 = ggemm( 'no-transpose', 'no-transpose', N, N, N, 1.0, A, N, 1, 0, B, N, 1, 0, 1.0, C, N, 1, 0 ); + if ( isnan( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var min; + var max; + var N; + var f; + var i; + + min = 1; // 10^min + max = 5; // 10^max + + for ( i = min; i <= max; i++ ) { + N = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + f = createBenchmark( N ); + bench( pkg+':ndarray:order(A)=row-major,order(B)=row-major,order(C)=row-major,trans(A)=false,trans(B)=false,size='+(N*N), f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/ggemm/benchmark/benchmark_ra_rb_rc_nta_tb.ndarray.js b/lib/node_modules/@stdlib/blas/base/ggemm/benchmark/benchmark_ra_rb_rc_nta_tb.ndarray.js new file mode 100644 index 000000000000..50aa4f70d2fa --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ggemm/benchmark/benchmark_ra_rb_rc_nta_tb.ndarray.js @@ -0,0 +1,105 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var uniform = require( '@stdlib/random/array/uniform' ); +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var pkg = require( './../package.json' ).name; +var ggemm = require( './../lib/ndarray.js' ); + + +// VARIABLES // + +var options = { + 'dtype': 'float64' +}; + + +// 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 = ggemm( 'no-transpose', 'transpose', N, N, N, 1.0, A, N, 1, 0, B, N, 1, 0, 1.0, C, N, 1, 0 ); + if ( isnan( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var min; + var max; + var N; + var f; + var i; + + min = 1; // 10^min + max = 5; // 10^max + + for ( i = min; i <= max; i++ ) { + N = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + f = createBenchmark( N ); + bench( pkg+':ndarray:order(A)=row-major,order(B)=row-major,order(C)=row-major,trans(A)=false,trans(B)=true,size='+(N*N), f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/ggemm/benchmark/benchmark_ra_rb_rc_ta_ntb.ndarray.js b/lib/node_modules/@stdlib/blas/base/ggemm/benchmark/benchmark_ra_rb_rc_ta_ntb.ndarray.js new file mode 100644 index 000000000000..a991634a8cef --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ggemm/benchmark/benchmark_ra_rb_rc_ta_ntb.ndarray.js @@ -0,0 +1,105 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var uniform = require( '@stdlib/random/array/uniform' ); +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var pkg = require( './../package.json' ).name; +var ggemm = require( './../lib/ndarray.js' ); + + +// VARIABLES // + +var options = { + 'dtype': 'float64' +}; + + +// 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 = ggemm( 'transpose', 'no-transpose', N, N, N, 1.0, A, N, 1, 0, B, N, 1, 0, 1.0, C, N, 1, 0 ); + if ( isnan( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var min; + var max; + var N; + var f; + var i; + + min = 1; // 10^min + max = 5; // 10^max + + for ( i = min; i <= max; i++ ) { + N = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + f = createBenchmark( N ); + bench( pkg+':ndarray:order(A)=row-major,order(B)=row-major,order(C)=row-major,trans(A)=true,trans(B)=false,size='+(N*N), f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/ggemm/benchmark/benchmark_ra_rb_rc_ta_tb.ndarray.js b/lib/node_modules/@stdlib/blas/base/ggemm/benchmark/benchmark_ra_rb_rc_ta_tb.ndarray.js new file mode 100644 index 000000000000..44e8e2bd9cb7 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ggemm/benchmark/benchmark_ra_rb_rc_ta_tb.ndarray.js @@ -0,0 +1,105 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var uniform = require( '@stdlib/random/array/uniform' ); +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var pkg = require( './../package.json' ).name; +var ggemm = require( './../lib/ndarray.js' ); + + +// VARIABLES // + +var options = { + 'dtype': 'float64' +}; + + +// 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 = ggemm( 'transpose', 'transpose', N, N, N, 1.0, A, N, 1, 0, B, N, 1, 0, 1.0, C, N, 1, 0 ); + if ( isnan( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var min; + var max; + var N; + var f; + var i; + + min = 1; // 10^min + max = 5; // 10^max + + for ( i = min; i <= max; i++ ) { + N = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + f = createBenchmark( N ); + bench( pkg+':ndarray:order(A)=row-major,order(B)=row-major,order(C)=row-major,trans(A)=true,trans(B)=true,size='+(N*N), f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/ggemm/benchmark/benchmark_row_major_nta_ntb.js b/lib/node_modules/@stdlib/blas/base/ggemm/benchmark/benchmark_row_major_nta_ntb.js new file mode 100644 index 000000000000..8e358fd266bb --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ggemm/benchmark/benchmark_row_major_nta_ntb.js @@ -0,0 +1,105 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var uniform = require( '@stdlib/random/array/uniform' ); +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var pkg = require( './../package.json' ).name; +var ggemm = require( './../lib/main.js' ); + + +// VARIABLES // + +var options = { + 'dtype': 'float64' +}; + + +// 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 = ggemm( 'row-major', 'no-transpose', 'no-transpose', N, N, N, 1.0, A, N, B, N, 1.0, C, N ); + if ( isnan( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var min; + var max; + var N; + var f; + var i; + + min = 1; // 10^min + max = 5; // 10^max + + for ( i = min; i <= max; i++ ) { + N = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + f = createBenchmark( N ); + bench( pkg+':order(A)=row-major,order(B)=row-major,order(C)=row-major,trans(A)=false,trans(B)=false,size='+(N*N), f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/ggemm/benchmark/benchmark_row_major_nta_tb.js b/lib/node_modules/@stdlib/blas/base/ggemm/benchmark/benchmark_row_major_nta_tb.js new file mode 100644 index 000000000000..ea2d08f9ac0f --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ggemm/benchmark/benchmark_row_major_nta_tb.js @@ -0,0 +1,105 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var uniform = require( '@stdlib/random/array/uniform' ); +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var pkg = require( './../package.json' ).name; +var ggemm = require( './../lib/main.js' ); + + +// VARIABLES // + +var options = { + 'dtype': 'float64' +}; + + +// 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 = ggemm( 'row-major', 'no-transpose', 'transpose', N, N, N, 1.0, A, N, B, N, 1.0, C, N ); + if ( isnan( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var min; + var max; + var N; + var f; + var i; + + min = 1; // 10^min + max = 5; // 10^max + + for ( i = min; i <= max; i++ ) { + N = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + f = createBenchmark( N ); + bench( pkg+':order(A)=row-major,order(B)=row-major,order(C)=row-major,trans(A)=false,trans(B)=true,size='+(N*N), f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/ggemm/benchmark/benchmark_row_major_ta_ntb.js b/lib/node_modules/@stdlib/blas/base/ggemm/benchmark/benchmark_row_major_ta_ntb.js new file mode 100644 index 000000000000..315b8f7f0765 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ggemm/benchmark/benchmark_row_major_ta_ntb.js @@ -0,0 +1,105 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var uniform = require( '@stdlib/random/array/uniform' ); +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var pkg = require( './../package.json' ).name; +var ggemm = require( './../lib/main.js' ); + + +// VARIABLES // + +var options = { + 'dtype': 'float64' +}; + + +// 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 = ggemm( 'row-major', 'transpose', 'no-transpose', N, N, N, 1.0, A, N, B, N, 1.0, C, N ); + if ( isnan( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var min; + var max; + var N; + var f; + var i; + + min = 1; // 10^min + max = 5; // 10^max + + for ( i = min; i <= max; i++ ) { + N = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + f = createBenchmark( N ); + bench( pkg+':order(A)=row-major,order(B)=row-major,order(C)=row-major,trans(A)=true,trans(B)=false,size='+(N*N), f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/ggemm/benchmark/benchmark_row_major_ta_tb.js b/lib/node_modules/@stdlib/blas/base/ggemm/benchmark/benchmark_row_major_ta_tb.js new file mode 100644 index 000000000000..ed34b84c2e66 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ggemm/benchmark/benchmark_row_major_ta_tb.js @@ -0,0 +1,105 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var uniform = require( '@stdlib/random/array/uniform' ); +var isnan = require( '@stdlib/math/base/assert/is-nan' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var floor = require( '@stdlib/math/base/special/floor' ); +var pkg = require( './../package.json' ).name; +var ggemm = require( './../lib/main.js' ); + + +// VARIABLES // + +var options = { + 'dtype': 'float64' +}; + + +// 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 = ggemm( 'row-major', 'transpose', 'transpose', N, N, N, 1.0, A, N, B, N, 1.0, C, N ); + if ( isnan( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + } + b.toc(); + if ( isnan( z[ i%z.length ] ) ) { + b.fail( 'should not return NaN' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var min; + var max; + var N; + var f; + var i; + + min = 1; // 10^min + max = 5; // 10^max + + for ( i = min; i <= max; i++ ) { + N = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + f = createBenchmark( N ); + bench( pkg+':order(A)=row-major,order(B)=row-major,order(C)=row-major,trans(A)=true,trans(B)=true,size='+(N*N), f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/ggemm/docs/repl.txt b/lib/node_modules/@stdlib/blas/base/ggemm/docs/repl.txt new file mode 100644 index 000000000000..114bce5120b3 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ggemm/docs/repl.txt @@ -0,0 +1,173 @@ + +{{alias}}( order, ta, tb, M, N, K, α, A, lda, B, ldb, β, C, ldc ) + Performs 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. + + 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 `α` or `K` equals `0` and `β` equals `1`, the function returns `C` + unchanged. + + Parameters + ---------- + order: 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: Array|TypedArray + First matrix. + + lda: integer + Stride of the first dimension of `A` (a.k.a., leading dimension of the + matrix `A`). + + B: Array|TypedArray + Second matrix. + + ldb: integer + Stride of the first dimension of `B` (a.k.a., leading dimension of the + matrix `B`). + + β: number + Scalar constant. + + C: Array|TypedArray + Third matrix. + + ldc: integer + Stride of the first dimension of `C` (a.k.a., leading dimension of the + matrix `C`). + + Returns + ------- + C: Array|TypedArray + Third matrix. + + Examples + -------- + // Standard usage: + > var A = [ 1.0, 2.0, 3.0, 4.0 ]; + > var B = [ 1.0, 1.0, 0.0, 1.0 ]; + > var C = [ 1.0, 2.0, 3.0, 4.0 ]; + > var order = 'row-major'; + > var ta = 'no-transpose'; + > var tb = 'no-transpose'; + > {{alias}}( order, 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(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. + + 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: Array|TypedArray + 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: Array|TypedArray + 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: Array|TypedArray + 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: Array|TypedArray + Third matrix. + + Examples + -------- + > var A = [ 1.0, 2.0, 3.0, 4.0 ]; + > var B = [ 1.0, 1.0, 0.0, 1.0 ]; + > var C = [ 1.0, 2.0, 3.0, 4.0 ]; + > var ta = 'no-transpose'; + > var tb = 'no-transpose'; + > {{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 + -------- diff --git a/lib/node_modules/@stdlib/blas/base/ggemm/docs/types/index.d.ts b/lib/node_modules/@stdlib/blas/base/ggemm/docs/types/index.d.ts new file mode 100644 index 000000000000..f4b20b9b4e84 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ggemm/docs/types/index.d.ts @@ -0,0 +1,139 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +// TypeScript Version: 4.1 + +/// + +import { NumericArray, Collection, AccessorArrayLike } from '@stdlib/types/array'; +import { Layout, TransposeOperation } from '@stdlib/types/blas'; + +/** +* Input array. +*/ +type InputArray = NumericArray | Collection | AccessorArrayLike; + +/** +* Interface describing `dgemm`. +*/ +interface Routine { + /** + * Performs 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. + * + * @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 A = [ 1.0, 2.0, 3.0, 4.0 ]; + * var B = [ 1.0, 1.0, 0.0, 1.0 ]; + * var C = [ 1.0, 2.0, 3.0, 4.0 ]; + * + * dgemm( '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: InputArray, LDA: number, B: InputArray, LDB: number, beta: number, C: T, LDC: number ): T; + + /** + * Performs the matrix-matrix operation `C = α*op(A)*op(B) + β*C`, using alternative indexing semantics and 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. + * + * @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 A = [ 1.0, 2.0, 3.0, 4.0 ]; + * var B = [ 1.0, 1.0, 0.0, 1.0 ]; + * var C = [ 1.0, 2.0, 3.0, 4.0 ]; + * + * dgemm.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: InputArray, strideA1: number, strideA2: number, offsetA: number, B: InputArray, strideB1: number, strideB2: number, offsetB: number, beta: number, C: T, strideC1: number, strideC2: number, offsetC: number ): T; +} + +/** +* Performs 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. +* +* @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 A = [ 1.0, 3.0, 2.0, 4.0 ]; +* var B = [ 1.0, 0.0, 1.0, 1.0 ]; +* var C = [ 1.0, 3.0, 2.0, 4.0 ]; +* +* dgemm( '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 A = [ 1.0, 3.0, 2.0, 4.0 ]; +* var B = [ 1.0, 0.0, 1.0, 1.0 ]; +* var C = [ 1.0, 3.0, 2.0, 4.0 ]; +* +* dgemm.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 dgemm: Routine; + + +// EXPORTS // + +export = dgemm; diff --git a/lib/node_modules/@stdlib/blas/base/ggemm/docs/types/test.ts b/lib/node_modules/@stdlib/blas/base/ggemm/docs/types/test.ts new file mode 100644 index 000000000000..2023b29dfad4 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ggemm/docs/types/test.ts @@ -0,0 +1,619 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +import ggemm = require( './index' ); + + +// TESTS // + +// The function returns an array... +{ + const A = new Float64Array( 25 ); + const B = new Float64Array( 25 ); + const C = new Float64Array( 25 ); + + ggemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, B, 5, 1.0, C, 5 ); // $ExpectType Float64Array +} + +// The compiler throws an error if the function is provided a first argument which is not a string... +{ + const A = new Float64Array( 25 ); + const B = new Float64Array( 25 ); + const C = new Float64Array( 25 ); + + ggemm( 10, 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, B, 5, 1.0, C, 5 ); // $ExpectError + ggemm( true, 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, B, 5, 1.0, C, 5 ); // $ExpectError + ggemm( false, 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, B, 5, 1.0, C, 5 ); // $ExpectError + ggemm( null, 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, B, 5, 1.0, C, 5 ); // $ExpectError + ggemm( undefined, 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, B, 5, 1.0, C, 5 ); // $ExpectError + ggemm( [], 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, B, 5, 1.0, C, 5 ); // $ExpectError + ggemm( {}, 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, B, 5, 1.0, C, 5 ); // $ExpectError + ggemm( ( 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 Float64Array( 25 ); + const B = new Float64Array( 25 ); + const C = new Float64Array( 25 ); + + ggemm( 'row-major', 10, 'no-transpose', 5, 5, 5, 1.0, A, 5, B, 5, 1.0, C, 5 ); // $ExpectError + ggemm( 'row-major', true, 'no-transpose', 5, 5, 5, 1.0, A, 5, B, 5, 1.0, C, 5 ); // $ExpectError + ggemm( 'row-major', false, 'no-transpose', 5, 5, 5, 1.0, A, 5, B, 5, 1.0, C, 5 ); // $ExpectError + ggemm( 'row-major', null, 'no-transpose', 5, 5, 5, 1.0, A, 5, B, 5, 1.0, C, 5 ); // $ExpectError + ggemm( 'row-major', undefined, 'no-transpose', 5, 5, 5, 1.0, A, 5, B, 5, 1.0, C, 5 ); // $ExpectError + ggemm( 'row-major', [ '1' ], 'no-transpose', 5, 5, 5, 1.0, A, 5, B, 5, 1.0, C, 5 ); // $ExpectError + ggemm( 'row-major', {}, 'no-transpose', 5, 5, 5, 1.0, A, 5, B, 5, 1.0, C, 5 ); // $ExpectError + ggemm( '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 Float64Array( 25 ); + const B = new Float64Array( 25 ); + const C = new Float64Array( 25 ); + + ggemm( 'row-major', 'no-transpose', 10, 5, 5, 5, 1.0, A, 5, B, 5, 1.0, C, 5 ); // $ExpectError + ggemm( 'row-major', 'no-transpose', true, 5, 5, 5, 1.0, A, 5, B, 5, 1.0, C, 5 ); // $ExpectError + ggemm( 'row-major', 'no-transpose', false, 5, 5, 5, 1.0, A, 5, B, 5, 1.0, C, 5 ); // $ExpectError + ggemm( 'row-major', 'no-transpose', null, 5, 5, 5, 1.0, A, 5, B, 5, 1.0, C, 5 ); // $ExpectError + ggemm( 'row-major', 'no-transpose', undefined, 5, 5, 5, 1.0, A, 5, B, 5, 1.0, C, 5 ); // $ExpectError + ggemm( 'row-major', 'no-transpose', [ '1' ], 5, 5, 5, 1.0, A, 5, B, 5, 1.0, C, 5 ); // $ExpectError + ggemm( 'row-major', 'no-transpose', {}, 5, 5, 5, 1.0, A, 5, B, 5, 1.0, C, 5 ); // $ExpectError + ggemm( '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 Float64Array( 25 ); + const B = new Float64Array( 25 ); + const C = new Float64Array( 25 ); + + ggemm( 'row-major', 'no-transpose', 'no-transpose', '10', 5, 5, 1.0, A, 5, B, 5, 1.0, C, 5 ); // $ExpectError + ggemm( 'row-major', 'no-transpose', 'no-transpose', true, 5, 5, 1.0, A, 5, B, 5, 1.0, C, 5 ); // $ExpectError + ggemm( 'row-major', 'no-transpose', 'no-transpose', false, 5, 5, 1.0, A, 5, B, 5, 1.0, C, 5 ); // $ExpectError + ggemm( 'row-major', 'no-transpose', 'no-transpose', null, 5, 5, 1.0, A, 5, B, 5, 1.0, C, 5 ); // $ExpectError + ggemm( 'row-major', 'no-transpose', 'no-transpose', undefined, 5, 5, 1.0, A, 5, B, 5, 1.0, C, 5 ); // $ExpectError + ggemm( 'row-major', 'no-transpose', 'no-transpose', [], 5, 5, 1.0, A, 5, B, 5, 1.0, C, 5 ); // $ExpectError + ggemm( 'row-major', 'no-transpose', 'no-transpose', {}, 5, 5, 1.0, A, 5, B, 5, 1.0, C, 5 ); // $ExpectError + ggemm( '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 Float64Array( 25 ); + const B = new Float64Array( 25 ); + const C = new Float64Array( 25 ); + + ggemm( 'row-major', 'no-transpose', 'no-transpose', 5, '10', 5, 1.0, A, 5, B, 5, 1.0, C, 5 ); // $ExpectError + ggemm( 'row-major', 'no-transpose', 'no-transpose', 5, true, 5, 1.0, A, 5, B, 5, 1.0, C, 5 ); // $ExpectError + ggemm( 'row-major', 'no-transpose', 'no-transpose', 5, false, 5, 1.0, A, 5, B, 5, 1.0, C, 5 ); // $ExpectError + ggemm( 'row-major', 'no-transpose', 'no-transpose', 5, null, 5, 1.0, A, 5, B, 5, 1.0, C, 5 ); // $ExpectError + ggemm( 'row-major', 'no-transpose', 'no-transpose', 5, undefined, 5, 1.0, A, 5, B, 5, 1.0, C, 5 ); // $ExpectError + ggemm( 'row-major', 'no-transpose', 'no-transpose', 5, [], 5, 1.0, A, 5, B, 5, 1.0, C, 5 ); // $ExpectError + ggemm( 'row-major', 'no-transpose', 'no-transpose', 5, {}, 5, 1.0, A, 5, B, 5, 1.0, C, 5 ); // $ExpectError + ggemm( '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 Float64Array( 25 ); + const B = new Float64Array( 25 ); + const C = new Float64Array( 25 ); + + ggemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, '10', 1.0, A, 5, B, 5, 1.0, C, 5 ); // $ExpectError + ggemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, true, 1.0, A, 5, B, 5, 1.0, C, 5 ); // $ExpectError + ggemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, false, 1.0, A, 5, B, 5, 1.0, C, 5 ); // $ExpectError + ggemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, null, 1.0, A, 5, B, 5, 1.0, C, 5 ); // $ExpectError + ggemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, undefined, 1.0, A, 5, B, 5, 1.0, C, 5 ); // $ExpectError + ggemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, [], 1.0, A, 5, B, 5, 1.0, C, 5 ); // $ExpectError + ggemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, {}, 1.0, A, 5, B, 5, 1.0, C, 5 ); // $ExpectError + ggemm( '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 Float64Array( 25 ); + const B = new Float64Array( 25 ); + const C = new Float64Array( 25 ); + + ggemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, 5, '10', A, 5, B, 5, 1.0, C, 5 ); // $ExpectError + ggemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, 5, true, A, 5, B, 5, 1.0, C, 5 ); // $ExpectError + ggemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, 5, false, A, 5, B, 5, 1.0, C, 5 ); // $ExpectError + ggemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, 5, null, A, 5, B, 5, 1.0, C, 5 ); // $ExpectError + ggemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, 5, undefined, A, 5, B, 5, 1.0, C, 5 ); // $ExpectError + ggemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, 5, [], A, 5, B, 5, 1.0, C, 5 ); // $ExpectError + ggemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, 5, {}, A, 5, B, 5, 1.0, C, 5 ); // $ExpectError + ggemm( '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 numeric array... +{ + const B = new Float64Array( 25 ); + const C = new Float64Array( 25 ); + + ggemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, 10, 5, B, 5, 1.0, C, 5 ); // $ExpectError + ggemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, '10', 5, B, 5, 1.0, C, 5 ); // $ExpectError + ggemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, true, 5, B, 5, 1.0, C, 5 ); // $ExpectError + ggemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, false, 5, B, 5, 1.0, C, 5 ); // $ExpectError + ggemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, null, 5, B, 5, 1.0, C, 5 ); // $ExpectError + ggemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, undefined, 5, B, 5, 1.0, C, 5 ); // $ExpectError + ggemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, [ '1' ], 5, B, 5, 1.0, C, 5 ); // $ExpectError + ggemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, {}, 5, B, 5, 1.0, C, 5 ); // $ExpectError + ggemm( '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 Float64Array( 25 ); + const B = new Float64Array( 25 ); + const C = new Float64Array( 25 ); + + ggemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, '10', B, 5, 1.0, C, 5 ); // $ExpectError + ggemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, true, B, 5, 1.0, C, 5 ); // $ExpectError + ggemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, false, B, 5, 1.0, C, 5 ); // $ExpectError + ggemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, null, B, 5, 1.0, C, 5 ); // $ExpectError + ggemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, undefined, B, 5, 1.0, C, 5 ); // $ExpectError + ggemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, [], B, 5, 1.0, C, 5 ); // $ExpectError + ggemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, {}, B, 5, 1.0, C, 5 ); // $ExpectError + ggemm( '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 numeric array... +{ + const A = new Float64Array( 25 ); + const C = new Float64Array( 25 ); + + ggemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, 10, 5, 1.0, C, 5 ); // $ExpectError + ggemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, '10', 5, 1.0, C, 5 ); // $ExpectError + ggemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, true, 5, 1.0, C, 5 ); // $ExpectError + ggemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, false, 5, 1.0, C, 5 ); // $ExpectError + ggemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, null, 5, 1.0, C, 5 ); // $ExpectError + ggemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, undefined, 5, 1.0, C, 5 ); // $ExpectError + ggemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, [ '1' ], 5, 1.0, C, 5 ); // $ExpectError + ggemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, {}, 5, 1.0, C, 5 ); // $ExpectError + ggemm( '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 Float64Array( 25 ); + const B = new Float64Array( 25 ); + const C = new Float64Array( 25 ); + + ggemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, B, '10', 1.0, C, 5 ); // $ExpectError + ggemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, B, true, 1.0, C, 5 ); // $ExpectError + ggemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, B, false, 1.0, C, 5 ); // $ExpectError + ggemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, B, null, 1.0, C, 5 ); // $ExpectError + ggemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, B, undefined, 1.0, C, 5 ); // $ExpectError + ggemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, B, [], 1.0, C, 5 ); // $ExpectError + ggemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, B, {}, 1.0, C, 5 ); // $ExpectError + ggemm( '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 Float64Array( 25 ); + const B = new Float64Array( 25 ); + const C = new Float64Array( 25 ); + + ggemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, B, 5, '10', C, 5 ); // $ExpectError + ggemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, B, 5, true, C, 5 ); // $ExpectError + ggemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, B, 5, false, C, 5 ); // $ExpectError + ggemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, B, 5, null, C, 5 ); // $ExpectError + ggemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, B, 5, undefined, C, 5 ); // $ExpectError + ggemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, B, 5, [], C, 5 ); // $ExpectError + ggemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, B, 5, {}, C, 5 ); // $ExpectError + ggemm( '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 numeric array... +{ + const A = new Float64Array( 25 ); + const B = new Float64Array( 25 ); + + ggemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, B, 5, 1.0, 10, 5 ); // $ExpectError + ggemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, B, 5, 1.0, '10', 5 ); // $ExpectError + ggemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, B, 5, 1.0, true, 5 ); // $ExpectError + ggemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, B, 5, 1.0, false, 5 ); // $ExpectError + ggemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, B, 5, 1.0, null, 5 ); // $ExpectError + ggemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, B, 5, 1.0, undefined, 5 ); // $ExpectError + ggemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, B, 5, 1.0, [ '1' ], 5 ); // $ExpectError + ggemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, B, 5, 1.0, {}, 5 ); // $ExpectError + ggemm( '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 Float64Array( 25 ); + const B = new Float64Array( 25 ); + const C = new Float64Array( 25 ); + + ggemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, B, 5, 1.0, C, '10' ); // $ExpectError + ggemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, B, 5, 1.0, C, true ); // $ExpectError + ggemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, B, 5, 1.0, C, false ); // $ExpectError + ggemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, B, 5, 1.0, C, null ); // $ExpectError + ggemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, B, 5, 1.0, C, undefined ); // $ExpectError + ggemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, B, 5, 1.0, C, [] ); // $ExpectError + ggemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, B, 5, 1.0, C, {} ); // $ExpectError + ggemm( '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 Float64Array( 25 ); + const B = new Float64Array( 25 ); + const C = new Float64Array( 25 ); + + ggemm(); // $ExpectError + ggemm( 'row-major' ); // $ExpectError + ggemm( 'row-major', 'no-transpose' ); // $ExpectError + ggemm( 'row-major', 'no-transpose', 'no-transpose' ); // $ExpectError + ggemm( 'row-major', 'no-transpose', 'no-transpose', 5 ); // $ExpectError + ggemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5 ); // $ExpectError + ggemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, 5 ); // $ExpectError + ggemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, 5, 1.0 ); // $ExpectError + ggemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A ); // $ExpectError + ggemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5 ); // $ExpectError + ggemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, B ); // $ExpectError + ggemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, B, 5 ); // $ExpectError + ggemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, B, 5, 1.0 ); // $ExpectError + ggemm( 'row-major', 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, B, 5, 1.0, C ); // $ExpectError + ggemm( '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 an array... +{ + const A = new Float64Array( 25 ); + const B = new Float64Array( 25 ); + const C = new Float64Array( 25 ); + + ggemm.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 Float64Array +} + +// The compiler throws an error if the function is provided a first argument which is not a string... +{ + const A = new Float64Array( 25 ); + const B = new Float64Array( 25 ); + const C = new Float64Array( 25 ); + + ggemm.ndarray( 10, 'no-transpose', 5, 5, 5, 1.0, A, 5, 1, 0, B, 5, 1, 0, 1.0, C, 5, 1, 0 ); // $ExpectError + ggemm.ndarray( true, 'no-transpose', 5, 5, 5, 1.0, A, 5, 1, 0, B, 5, 1, 0, 1.0, C, 5, 1, 0 ); // $ExpectError + ggemm.ndarray( false, 'no-transpose', 5, 5, 5, 1.0, A, 5, 1, 0, B, 5, 1, 0, 1.0, C, 5, 1, 0 ); // $ExpectError + ggemm.ndarray( null, 'no-transpose', 5, 5, 5, 1.0, A, 5, 1, 0, B, 5, 1, 0, 1.0, C, 5, 1, 0 ); // $ExpectError + ggemm.ndarray( undefined, 'no-transpose', 5, 5, 5, 1.0, A, 5, 1, 0, B, 5, 1, 0, 1.0, C, 5, 1, 0 ); // $ExpectError + ggemm.ndarray( [ '1' ], 'no-transpose', 5, 5, 5, 1.0, A, 5, 1, 0, B, 5, 1, 0, 1.0, C, 5, 1, 0 ); // $ExpectError + ggemm.ndarray( {}, 'no-transpose', 5, 5, 5, 1.0, A, 5, 1, 0, B, 5, 1, 0, 1.0, C, 5, 1, 0 ); // $ExpectError + ggemm.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 Float64Array( 25 ); + const B = new Float64Array( 25 ); + const C = new Float64Array( 25 ); + + ggemm.ndarray( 'no-transpose', 10, 5, 5, 5, 1.0, A, 5, 1, 0, B, 5, 1, 0, 1.0, C, 5, 1, 0 ); // $ExpectError + ggemm.ndarray( 'no-transpose', true, 5, 5, 5, 1.0, A, 5, 1, 0, B, 5, 1, 0, 1.0, C, 5, 1, 0 ); // $ExpectError + ggemm.ndarray( 'no-transpose', false, 5, 5, 5, 1.0, A, 5, 1, 0, B, 5, 1, 0, 1.0, C, 5, 1, 0 ); // $ExpectError + ggemm.ndarray( 'no-transpose', null, 5, 5, 5, 1.0, A, 5, 1, 0, B, 5, 1, 0, 1.0, C, 5, 1, 0 ); // $ExpectError + ggemm.ndarray( 'no-transpose', undefined, 5, 5, 5, 1.0, A, 5, 1, 0, B, 5, 1, 0, 1.0, C, 5, 1, 0 ); // $ExpectError + ggemm.ndarray( 'no-transpose', [ '1' ], 5, 5, 5, 1.0, A, 5, 1, 0, B, 5, 1, 0, 1.0, C, 5, 1, 0 ); // $ExpectError + ggemm.ndarray( 'no-transpose', {}, 5, 5, 5, 1.0, A, 5, 1, 0, B, 5, 1, 0, 1.0, C, 5, 1, 0 ); // $ExpectError + ggemm.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 Float64Array( 25 ); + const B = new Float64Array( 25 ); + const C = new Float64Array( 25 ); + + ggemm.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 + ggemm.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 + ggemm.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 + ggemm.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 + ggemm.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 + ggemm.ndarray( 'no-transpose', 'no-transpose', [], 5, 5, 1.0, A, 5, 1, 0, B, 5, 1, 0, 1.0, C, 5, 1, 0 ); // $ExpectError + ggemm.ndarray( 'no-transpose', 'no-transpose', {}, 5, 5, 1.0, A, 5, 1, 0, B, 5, 1, 0, 1.0, C, 5, 1, 0 ); // $ExpectError + ggemm.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 Float64Array( 25 ); + const B = new Float64Array( 25 ); + const C = new Float64Array( 25 ); + + ggemm.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 + ggemm.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 + ggemm.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 + ggemm.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 + ggemm.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 + ggemm.ndarray( 'no-transpose', 'no-transpose', 5, [], 5, 1.0, A, 5, 1, 0, B, 5, 1, 0, 1.0, C, 5, 1, 0 ); // $ExpectError + ggemm.ndarray( 'no-transpose', 'no-transpose', 5, {}, 5, 1.0, A, 5, 1, 0, B, 5, 1, 0, 1.0, C, 5, 1, 0 ); // $ExpectError + ggemm.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 Float64Array( 25 ); + const B = new Float64Array( 25 ); + const C = new Float64Array( 25 ); + + ggemm.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 + ggemm.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 + ggemm.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 + ggemm.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 + ggemm.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 + ggemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, [], 1.0, A, 5, 1, 0, B, 5, 1, 0, 1.0, C, 5, 1, 0 ); // $ExpectError + ggemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, {}, 1.0, A, 5, 1, 0, B, 5, 1, 0, 1.0, C, 5, 1, 0 ); // $ExpectError + ggemm.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 Float64Array( 25 ); + const B = new Float64Array( 25 ); + const C = new Float64Array( 25 ); + + ggemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, '10', A, 5, 1, 0, B, 5, 1, 0, 1.0, C, 5, 1, 0 ); // $ExpectError + ggemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, true, A, 5, 1, 0, B, 5, 1, 0, 1.0, C, 5, 1, 0 ); // $ExpectError + ggemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, false, A, 5, 1, 0, B, 5, 1, 0, 1.0, C, 5, 1, 0 ); // $ExpectError + ggemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, null, A, 5, 1, 0, B, 5, 1, 0, 1.0, C, 5, 1, 0 ); // $ExpectError + ggemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, undefined, A, 5, 1, 0, B, 5, 1, 0, 1.0, C, 5, 1, 0 ); // $ExpectError + ggemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, [], A, 5, 1, 0, B, 5, 1, 0, 1.0, C, 5, 1, 0 ); // $ExpectError + ggemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, {}, A, 5, 1, 0, B, 5, 1, 0, 1.0, C, 5, 1, 0 ); // $ExpectError + ggemm.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 numeric array... +{ + const B = new Float64Array( 25 ); + const C = new Float64Array( 25 ); + + ggemm.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 + ggemm.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 + ggemm.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 + ggemm.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 + ggemm.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 + ggemm.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 + ggemm.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 + ggemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, {}, 5, 1, 0, B, 5, 1, 0, 1.0, C, 5, 1, 0 ); // $ExpectError + ggemm.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 Float64Array( 25 ); + const B = new Float64Array( 25 ); + const C = new Float64Array( 25 ); + + ggemm.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 + ggemm.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 + ggemm.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 + ggemm.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 + ggemm.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 + ggemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, [], 1, 0, B, 5, 1, 0, 1.0, C, 5, 1, 0 ); // $ExpectError + ggemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, {}, 1, 0, B, 5, 1, 0, 1.0, C, 5, 1, 0 ); // $ExpectError + ggemm.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 Float64Array( 25 ); + const B = new Float64Array( 25 ); + const C = new Float64Array( 25 ); + + ggemm.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 + ggemm.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 + ggemm.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 + ggemm.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 + ggemm.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 + ggemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, [], 0, B, 5, 1, 0, 1.0, C, 5, 1, 0 ); // $ExpectError + ggemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, {}, 0, B, 5, 1, 0, 1.0, C, 5, 1, 0 ); // $ExpectError + ggemm.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 Float64Array( 25 ); + const B = new Float64Array( 25 ); + const C = new Float64Array( 25 ); + + ggemm.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 + ggemm.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 + ggemm.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 + ggemm.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 + ggemm.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 + ggemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, 1, [], B, 5, 1, 0, 1.0, C, 5, 1, 0 ); // $ExpectError + ggemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, 1, {}, B, 5, 1, 0, 1.0, C, 5, 1, 0 ); // $ExpectError + ggemm.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 numeric array... +{ + const A = new Float64Array( 25 ); + const C = new Float64Array( 25 ); + + ggemm.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 + ggemm.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 + ggemm.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 + ggemm.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 + ggemm.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 + ggemm.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 + ggemm.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 + ggemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, 1, 0, {}, 5, 1, 0, 1.0, C, 5, 1, 0 ); // $ExpectError + ggemm.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 Float64Array( 25 ); + const B = new Float64Array( 25 ); + const C = new Float64Array( 25 ); + + ggemm.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 + ggemm.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 + ggemm.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 + ggemm.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 + ggemm.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 + ggemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, 1, 0, B, [], 1, 0, 1.0, C, 5, 1, 0 ); // $ExpectError + ggemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, 1, 0, B, {}, 1, 0, 1.0, C, 5, 1, 0 ); // $ExpectError + ggemm.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 Float64Array( 25 ); + const B = new Float64Array( 25 ); + const C = new Float64Array( 25 ); + + ggemm.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 + ggemm.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 + ggemm.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 + ggemm.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 + ggemm.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 + ggemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, 1, 0, B, 5, [], 0, 1.0, C, 5, 1, 0 ); // $ExpectError + ggemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, 1, 0, B, 5, {}, 0, 1.0, C, 5, 1, 0 ); // $ExpectError + ggemm.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 Float64Array( 25 ); + const B = new Float64Array( 25 ); + const C = new Float64Array( 25 ); + + ggemm.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 + ggemm.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 + ggemm.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 + ggemm.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 + ggemm.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 + ggemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, 1, 0, B, 5, 1, [], 1.0, C, 5, 1, 0 ); // $ExpectError + ggemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, 1, 0, B, 5, 1, {}, 1.0, C, 5, 1, 0 ); // $ExpectError + ggemm.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 Float64Array( 25 ); + const B = new Float64Array( 25 ); + const C = new Float64Array( 25 ); + + ggemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, 1, 0, B, 5, 1, 0, '10', C, 5, 1, 0 ); // $ExpectError + ggemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, 1, 0, B, 5, 1, 0, true, C, 5, 1, 0 ); // $ExpectError + ggemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, 1, 0, B, 5, 1, 0, false, C, 5, 1, 0 ); // $ExpectError + ggemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, 1, 0, B, 5, 1, 0, null, C, 5, 1, 0 ); // $ExpectError + ggemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, 1, 0, B, 5, 1, 0, undefined, C, 5, 1, 0 ); // $ExpectError + ggemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, 1, 0, B, 5, 1, 0, [], C, 5, 1, 0 ); // $ExpectError + ggemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, 1, 0, B, 5, 1, 0, {}, C, 5, 1, 0 ); // $ExpectError + ggemm.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 numeric array... +{ + const A = new Float64Array( 25 ); + const B = new Float64Array( 25 ); + + ggemm.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 + ggemm.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 + ggemm.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 + ggemm.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 + ggemm.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 + ggemm.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 + ggemm.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 + ggemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, 1, 0, B, 5, 1, 0, 1.0, {}, 5, 1, 0 ); // $ExpectError + ggemm.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 Float64Array( 25 ); + const B = new Float64Array( 25 ); + const C = new Float64Array( 25 ); + + ggemm.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 + ggemm.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 + ggemm.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 + ggemm.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 + ggemm.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 + ggemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, 1, 0, B, 5, 1, 0, 1.0, C, [], 1, 0 ); // $ExpectError + ggemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, 1, 0, B, 5, 1, 0, 1.0, C, {}, 1, 0 ); // $ExpectError + ggemm.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 Float64Array( 25 ); + const B = new Float64Array( 25 ); + const C = new Float64Array( 25 ); + + ggemm.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 + ggemm.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 + ggemm.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 + ggemm.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 + ggemm.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 + ggemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, 1, 0, B, 5, 1, 0, 1.0, C, 5, [], 0 ); // $ExpectError + ggemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, 1, 0, B, 5, 1, 0, 1.0, C, 5, {}, 0 ); // $ExpectError + ggemm.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 Float64Array( 25 ); + const B = new Float64Array( 25 ); + const C = new Float64Array( 25 ); + + ggemm.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 + ggemm.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 + ggemm.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 + ggemm.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 + ggemm.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 + ggemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, 1, 0, B, 5, 1, 0, 1.0, C, 5, 1, [] ); // $ExpectError + ggemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, 1, 0, B, 5, 1, 0, 1.0, C, 5, 1, {} ); // $ExpectError + ggemm.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 Float64Array( 25 ); + const B = new Float64Array( 25 ); + const C = new Float64Array( 25 ); + + ggemm.ndarray(); // $ExpectError + ggemm.ndarray( 'no-transpose' ); // $ExpectError + ggemm.ndarray( 'no-transpose', 'no-transpose' ); // $ExpectError + ggemm.ndarray( 'no-transpose', 'no-transpose', 5 ); // $ExpectError + ggemm.ndarray( 'no-transpose', 'no-transpose', 5, 5 ); // $ExpectError + ggemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5 ); // $ExpectError + ggemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0 ); // $ExpectError + ggemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A ); // $ExpectError + ggemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5 ); // $ExpectError + ggemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, 1 ); // $ExpectError + ggemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, 1, 0 ); // $ExpectError + ggemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, 1, 0, B ); // $ExpectError + ggemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, 1, 0, B, 5 ); // $ExpectError + ggemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, 1, 0, B, 5, 1 ); // $ExpectError + ggemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, 1, 0, B, 5, 1, 0 ); // $ExpectError + ggemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, 1, 0, B, 5, 1, 0, 1.0 ); // $ExpectError + ggemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, 1, 0, B, 5, 1, 0, 1.0, C ); // $ExpectError + ggemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, 1, 0, B, 5, 1, 0, 1.0, C, 5 ); // $ExpectError + ggemm.ndarray( 'no-transpose', 'no-transpose', 5, 5, 5, 1.0, A, 5, 1, 0, B, 5, 1, 0, 1.0, C, 5, 1 ); // $ExpectError + ggemm.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 +} diff --git a/lib/node_modules/@stdlib/blas/base/ggemm/examples/index.js b/lib/node_modules/@stdlib/blas/base/ggemm/examples/index.js new file mode 100644 index 000000000000..6165332ceeea --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ggemm/examples/index.js @@ -0,0 +1,40 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); +var ggemm = require( './../lib' ); + +var opts = { + 'dtype': 'generic' +}; + +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 + +ggemm( 'row-major', 'no-transpose', 'no-transpose', M, N, K, 1.0, A, K, B, N, 1.0, C, N ); +console.log( C ); + +ggemm.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/ggemm/lib/accessors.js b/lib/node_modules/@stdlib/blas/base/ggemm/lib/accessors.js new file mode 100644 index 000000000000..d5e48659b5e5 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ggemm/lib/accessors.js @@ -0,0 +1,551 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable max-len, max-params */ + +'use strict'; + +// MODULES // + +var isRowMajor = require( '@stdlib/ndarray/base/assert/is-row-major' ); +var gdot = require( '@stdlib/blas/base/gdot' ).ndarray; +var blockSize = require( '@stdlib/ndarray/base/unary-tiling-block-size' ); + + +// VARIABLES // + +var bsize = blockSize( 'float64' ); // TODO: consider using a larger block size + + +// 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 ) { // TODO: consider moving to a separate helper utility package + return ( str !== 'no-transpose' ); +} + +/** +* Fills a matrix with zeros. +* +* @private +* @param {NonNegativeInteger} M - number of rows +* @param {NonNegativeInteger} N - number of columns +* @param {Object} X - matrix object to fill +* @param {Collection} X.data - matrix data to fill +* @param {Array} X.accessors - array element accessors +* @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 {Collection} matrix object to fill +* +* @example +* var toAccessorArray = require( '@stdlib/array/base/to-accessor-array' ); +* var arraylike2object = require( '@stdlib/array/base/arraylike2object' ); +* +* var X = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ]; +* +* zeros( 2, 3, arraylike2object( toAccessorArray( X ) ), 3, 1, 0 ); +* // X => [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] +* +* @example +* var toAccessorArray = require( '@stdlib/array/base/to-accessor-array' ); +* var arraylike2object = require( '@stdlib/array/base/arraylike2object' ); +* +* var X = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ]; +* +* zeros( 2, 3, arraylike2object( toAccessorArray( 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 ) { // TODO: consider moving to a separate package + var xbuf; + var set; + var dx0; + var dx1; + var S0; + var S1; + var i0; + var i1; + var ix; + + // Cache references to array data: + xbuf = X.data; + + // Cache references to element accessors: + set = X.accessors[ 1 ]; + + 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++ ) { + set( xbuf, 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 {Object} X - matrix object to fill +* @param {Collection} X.data - matrix data to fill +* @param {Array} X.accessors - array element accessors +* @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 {Collection} matrix object to fill +* +* @example +* var toAccessorArray = require( '@stdlib/array/base/to-accessor-array' ); +* var arraylike2object = require( '@stdlib/array/base/arraylike2object' ); +* +* var X = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ]; +* +* scal( 2, 3, 5.0, arraylike2object( toAccessorArray( X ) ), 3, 1, 0 ); +* // X => [ 5.0, 10.0, 15.0, 20.0, 25.0, 30.0 ] +* +* @example +* var toAccessorArray = require( '@stdlib/array/base/to-accessor-array' ); +* var arraylike2object = require( '@stdlib/array/base/arraylike2object' ); +* +* var X = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ]; +* +* scal( 2, 3, 5.0, arraylike2object( toAccessorArray( 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 ) { // TODO: consider moving to a separate package + var xbuf; + var get; + var set; + var dx0; + var dx1; + var S0; + var S1; + var i0; + var i1; + var ix; + + // Cache references to array data: + xbuf = X.data; + + // Cache references to element accessors: + get = X.accessors[ 0 ]; + set = X.accessors[ 1 ]; + + 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++ ) { + set( xbuf, ix, get( xbuf, 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 {Object} A - first matrix object +* @param {Collection} A.data - first matrix data +* @param {Array} A.accessors - array element accessors +* @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 {Object} B - second matrix object +* @param {Collection} B.data - second matrix data +* @param {Array} B.accessors - array element accessors +* @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 {Object} C - third matrix object +* @param {Collection} C.data - third matrix data +* @param {Array} C.accessors - array element accessors +* @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 {Float64Array} `C` +* +* @example +* var toAccessorArray = require( '@stdlib/array/base/to-accessor-array' ); +* var arraylike2object = require( '@stdlib/array/base/arraylike2object' ); +* +* var A = [ 1.0, 2.0, 3.0, 4.0 ]; +* var B = [ 1.0, 1.0, 0.0, 1.0 ]; +* var C = [ 1.0, 2.0, 3.0, 4.0 ]; +* +* naive( 2, 2, 2, 1.0, arraylike2object( toAccessorArray( A ) ), 2, 1, 0, arraylike2object( toAccessorArray( B ) ), 2, 1, 0, arraylike2object( toAccessorArray( 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 abuf; + var bbuf; + var cbuf; + var get; + var set; + var da0; + var db0; + var dc0; + var dc1; + var S0; + var S1; + var i0; + var i1; + var ia; + var ib; + var ic; + var v; + + // 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; + da0 = strideA2; + db0 = strideB1; + dc0 = strideC2; // offset increment for innermost loop + dc1 = strideC1 - ( S0*strideC2 ); // offset increment for outermost loop + + // Cache references to array data: + abuf = A.data; + bbuf = B.data; + cbuf = C.data; + + // Cache references to element accessors: + get = C.accessors[ 0 ]; + set = C.accessors[ 1 ]; + + ic = offsetC; + for ( i1 = 0; i1 < S1; i1++ ) { + ia = offsetA + ( i1*strideA1 ); + for ( i0 = 0; i0 < S0; i0++ ) { + ib = offsetB + ( i0*strideB2 ); + v = alpha * gdot( K, abuf, da0, ia, bbuf, db0, ib ); + set( cbuf, ic, get( cbuf, ic ) + v ); + ic += dc0; + } + ic += dc1; + } + 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 {Object} A - first matrix object +* @param {Collection} A.data - first matrix data +* @param {Array} A.accessors - array element accessors +* @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 {Object} B - second matrix object +* @param {Collection} B.data - second matrix data +* @param {Array} B.accessors - array element accessors +* @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 {Object} C - third matrix object +* @param {Collection} C.data - third matrix data +* @param {Array} C.accessors - array element accessors +* @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 {Float64Array} `C` +* +* @example +* var toAccessorArray = require( '@stdlib/array/base/to-accessor-array' ); +* var arraylike2object = require( '@stdlib/array/base/arraylike2object' ); +* +* var A = [ 1.0, 2.0, 3.0, 4.0 ]; +* var B = [ 1.0, 1.0, 0.0, 1.0 ]; +* var C = [ 1.0, 2.0, 3.0, 4.0 ]; +* +* blocked( 2, 2, 2, 1.0, arraylike2object( toAccessorArray( A ) ), 2, 1, 0, arraylike2object( toAccessorArray( B ) ), 2, 1, 0, arraylike2object( toAccessorArray( 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 abuf; + var bbuf; + var cbuf; + var get; + var set; + var da0; + var db0; + var dc0; + var dc1; + var oa1; + var ob0; + var oc0; + 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; + var v; + + // 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; + + // Define increments for the innermost loop: + da0 = strideA2; + db0 = strideB1; + dc0 = strideC2; + + // Cache references to array data: + abuf = A.data; + bbuf = B.data; + cbuf = C.data; + + // Cache references to element accessors: + get = C.accessors[ 0 ]; + set = C.accessors[ 1 ]; + + // 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 ); + 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; + k = 0; + } else { + sk = bsize; + k -= bsize; + } + 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++ ) { + ib = ob + ( i0*strideB2 ); + v = alpha * gdot( sk, abuf, da0, ia, bbuf, db0, ib ); + set( cbuf, ic, get( cbuf, ic ) + v ); + ic += dc0; + } + ic += dc1; + } + } + } + } + return C; +} + + +// MAIN // + +/** +* Performs 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. +* +* @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 - 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 {Object} A - first matrix object +* @param {Collection} A.data - first matrix data +* @param {Array} A.accessors - array element accessors +* @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 {Object} B - second matrix object +* @param {Collection} B.data - second matrix data +* @param {Array} B.accessors - array element accessors +* @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 {Object} C - third matrix object +* @param {Collection} C.data - third matrix data +* @param {Array} C.accessors - array element accessors +* @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 {Float64Array} `C` +* +* @example +* var toAccessorArray = require( '@stdlib/array/base/to-accessor-array' ); +* var arraylike2object = require( '@stdlib/array/base/arraylike2object' ); +* +* var A = [ 1.0, 2.0, 3.0, 4.0 ]; +* var B = [ 1.0, 1.0, 0.0, 1.0 ]; +* var C = [ 1.0, 2.0, 3.0, 4.0 ]; +* +* ggemm( 'no-transpose', 'no-transpose', 2, 2, 2, 1.0, arraylike2object( toAccessorArray( A ) ), 2, 1, 0, arraylike2object( toAccessorArray( B ) ), 2, 1, 0, 1.0, arraylike2object( toAccessorArray( C ) ), 2, 1, 0 ); +* // C => [ 2.0, 5.0, 6.0, 11.0 ] +*/ +function ggemm( transA, transB, M, N, K, alpha, A, strideA1, strideA2, offsetA, B, strideB1, strideB2, offsetB, beta, C, strideC1, strideC2, offsetC ) { + var isrma; + var isrmb; + var sa1; + var sa2; + 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 ); + } 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 ); + } + } + // Swap strides to perform transposes... + if ( isTransposed( transA ) ) { + sa1 = strideA2; + sa2 = strideA1; + } else { + sa1 = strideA1; + sa2 = strideA2; + } + if ( isTransposed( transB ) ) { + sb1 = strideB2; + sb2 = strideB1; + } else { + sb1 = strideB1; + sb2 = strideB2; + } + // 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 ); +} + + +// EXPORTS // + +module.exports = ggemm; diff --git a/lib/node_modules/@stdlib/blas/base/ggemm/lib/base.js b/lib/node_modules/@stdlib/blas/base/ggemm/lib/base.js new file mode 100644 index 000000000000..3ee761b90fae --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ggemm/lib/base.js @@ -0,0 +1,470 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable max-len, max-params */ + +'use strict'; + +// MODULES // + +var arraylike2object = require( '@stdlib/array/base/arraylike2object' ); +var isRowMajor = require( '@stdlib/ndarray/base/assert/is-row-major' ); +var ddot = require( '@stdlib/blas/base/ddot' ).ndarray; +var blockSize = require( '@stdlib/ndarray/base/unary-tiling-block-size' ); +var accessors = require( './accessors.js' ); + + +// VARIABLES // + +var bsize = blockSize( 'float64', 'float64' ); // TODO: consider using a larger block size + + +// 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 ) { // TODO: consider moving to a separate helper utility package + return ( str !== 'no-transpose' ); +} + +/** +* Fills a matrix with zeros. +* +* @private +* @param {NonNegativeInteger} M - number of rows +* @param {NonNegativeInteger} N - number of columns +* @param {NumericArray} 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 {NumericArray} input matrix +* +* @example +* var X = [ 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 X = [ 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 ) { // TODO: consider moving to a separate package + 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 {NumericArray} 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 {NumericArray} input matrix +* +* @example +* var X = [ 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 X = [ 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 ) { // TODO: consider moving to a separate package + 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 {NumericArray} 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 {NumericArray} 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 {NumericArray} 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 {NumericArray} `C` +* +* @example +* var A = [ 1.0, 2.0, 3.0, 4.0 ]; +* var B = [ 1.0, 1.0, 0.0, 1.0 ]; +* var C = [ 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; + + // 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; + 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++ ) { + ia = offsetA + ( i1*strideA1 ); + for ( i0 = 0; i0 < S0; i0++ ) { + ib = offsetB + ( i0*strideB2 ); + C[ ic ] += alpha * ddot( K, A, da0, ia, B, db0, ib ); + ic += dc0; + } + ic += dc1; + } + 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 {NumericArray} 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 {NumericArray} 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 {NumericArray} 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 {NumericArray} `C` +* +* @example +* var A = [ 1.0, 2.0, 3.0, 4.0 ]; +* var B = [ 1.0, 1.0, 0.0, 1.0 ]; +* var C = [ 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 oc0; + 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; + + // Define increments for the innermost loop: + da0 = strideA2; + db0 = strideB1; + dc0 = strideC2; + + // 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 ); + 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; + k = 0; + } else { + sk = bsize; + k -= bsize; + } + 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++ ) { + ib = ob + ( i0*strideB2 ); + C[ ic ] += alpha * ddot( sk, A, da0, ia, B, db0, ib ); + ic += dc0; + } + ic += dc1; + } + } + } + } + return C; +} + + +// MAIN // + +/** +* Performs 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. +* +* @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 - 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 {NumericArray} 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 {NumericArray} 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 {NumericArray} 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 {NumericArray} `C` +* +* @example +* var A = [ 1.0, 2.0, 3.0, 4.0 ]; +* var B = [ 1.0, 1.0, 0.0, 1.0 ]; +* var C = [ 1.0, 2.0, 3.0, 4.0 ]; +* +* ggemm( '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 ggemm( transA, transB, M, N, K, alpha, A, strideA1, strideA2, offsetA, B, strideB1, strideB2, offsetB, beta, C, strideC1, strideC2, offsetC ) { + var isrma; + var isrmb; + var sa1; + var sa2; + var sb1; + var sb2; + var oa; + var ob; + var oc; + + oa = arraylike2object( A ); + ob = arraylike2object( B ); + oc = arraylike2object( C ); + if ( oa.accessorProtocol || ob.accessorProtocol || oc.accessorProtocol ) { + accessors( transA, transB, M, N, K, alpha, oa, strideA1, strideA2, offsetA, ob, strideB1, strideB2, offsetB, beta, oc, strideC1, strideC2, offsetC ); + return C; + } + 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 ); + } 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 ); + } + } + // Swap strides to perform transposes... + if ( isTransposed( transA ) ) { + sa1 = strideA2; + sa2 = strideA1; + } else { + sa1 = strideA1; + sa2 = strideA2; + } + if ( isTransposed( transB ) ) { + sb1 = strideB2; + sb2 = strideB1; + } else { + sb1 = strideB1; + sb2 = strideB2; + } + // 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 ); +} + + +// EXPORTS // + +module.exports = ggemm; diff --git a/lib/node_modules/@stdlib/blas/base/ggemm/lib/index.js b/lib/node_modules/@stdlib/blas/base/ggemm/lib/index.js new file mode 100644 index 000000000000..b49879396da6 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ggemm/lib/index.js @@ -0,0 +1,63 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* BLAS level 2 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/ggemm +* +* @example +* var ggemm = require( '@stdlib/blas/base/ggemm' ); +* +* var A = [ 1.0, 2.0, 3.0, 4.0 ]; +* var B = [ 1.0, 1.0, 0.0, 1.0 ]; +* var C = [ 1.0, 2.0, 3.0, 4.0 ]; +* +* ggemm( '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 ggemm = require( '@stdlib/blas/base/ggemm' ); +* +* var A = [ 1.0, 2.0, 3.0, 4.0 ]; +* var B = [ 1.0, 1.0, 0.0, 1.0 ]; +* var C = [ 1.0, 2.0, 3.0, 4.0 ]; +* +* ggemm.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 setReadOnly = require( '@stdlib/utils/define-nonenumerable-read-only-property' ); +var main = require( './main.js' ); +var ndarray = require( './ndarray.js' ); + + +// MAIN // + +setReadOnly( main, 'ndarray', ndarray ); + + +// EXPORTS // + +module.exports = main; + +// exports: { "ndarray": "main.ndarray" } diff --git a/lib/node_modules/@stdlib/blas/base/ggemm/lib/main.js b/lib/node_modules/@stdlib/blas/base/ggemm/lib/main.js new file mode 100644 index 000000000000..413f4bb34286 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ggemm/lib/main.js @@ -0,0 +1,154 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +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 isRowMajor = require( '@stdlib/ndarray/base/assert/is-row-major-string' ); +var isColumnMajor = require( '@stdlib/ndarray/base/assert/is-column-major-string' ); +var format = require( '@stdlib/string/format' ); +var base = require( './base.js' ); + + +// MAIN // + +/** +* Performs 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. +* +* @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 - 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 {NumericArray} A - first matrix +* @param {PositiveInteger} LDA - stride of the first dimension of `A` (a.k.a., leading dimension of the matrix `A`) +* @param {NumericArray} 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 {NumericArray} 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,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 {NumericArray} `C` +* +* @example +* var A = [ 1.0, 2.0, 3.0, 4.0 ]; +* var B = [ 1.0, 1.0, 0.0, 1.0 ]; +* var C = [ 1.0, 2.0, 3.0, 4.0 ]; +* +* dgemm( '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 dgemm( 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 isrm; + var iscm; + var sa1; + var sa2; + var sb1; + var sb2; + var sc1; + var sc2; + + 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 ) ); + } + isrm = isRowMajor( order ); + iscm = isColumnMajor( order ); + if ( + ( isrm && transA === 'no-transpose' ) || + ( iscm && transA === 'transpose' ) + ) { + nrowsa = K; + } else { + nrowsa = M; + } + if ( + ( isrm && transB === 'no-transpose' ) || + ( iscm && transB === 'transpose' ) + ) { + nrowsb = N; + } else { + nrowsb = K; + } + 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 ( 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 ( isrm ) { + 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 ( iscm ) { + 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 = dgemm; diff --git a/lib/node_modules/@stdlib/blas/base/ggemm/lib/ndarray.js b/lib/node_modules/@stdlib/blas/base/ggemm/lib/ndarray.js new file mode 100644 index 000000000000..cd22be6d2c93 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ggemm/lib/ndarray.js @@ -0,0 +1,97 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var isMatrixTranspose = require( '@stdlib/blas/base/assert/is-transpose-operation' ); +var format = require( '@stdlib/string/format' ); +var base = require( './base.js' ); + + +// MAIN // + +/** +* Performs 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. +* +* @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 - 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 {NumericArray} 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 {NumericArray} 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 {NumericArray} 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 +* @throws {RangeError} seventeenth argument must be non-zero +* @throws {RangeError} eighteenth argument must be non-zero +* @returns {NumericArray} `C` +* +* @example +* var A = [ 1.0, 2.0, 3.0, 4.0 ]; +* var B = [ 1.0, 1.0, 0.0, 1.0 ]; +* var C = [ 1.0, 2.0, 3.0, 4.0 ]; +* +* ggemm( '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 ggemm( 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 + 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 ( strideC1 === 0 ) { + throw new RangeError( format( 'invalid argument. Seventeenth argument must be non-zero. Value: `%d`.', strideC1 ) ); + } + if ( strideC2 === 0 ) { + throw new RangeError( format( 'invalid argument. Eighteenth argument must be non-zero. Value: `%d`.', strideC2 ) ); + } + 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 = ggemm; diff --git a/lib/node_modules/@stdlib/blas/base/ggemm/package.json b/lib/node_modules/@stdlib/blas/base/ggemm/package.json new file mode 100644 index 000000000000..59cbdfc456c1 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ggemm/package.json @@ -0,0 +1,70 @@ +{ + "name": "@stdlib/blas/base/ggemm", + "version": "0.0.0", + "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", + "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", + "ggemm", + "gemm", + "matmul", + "matrix multiplication", + "matrix", + "multiplication", + "linear", + "algebra", + "subroutines", + "array", + "ndarray" + ] +} diff --git a/lib/node_modules/@stdlib/blas/base/ggemm/test/fixtures/ca_cb_cc_nta_ntb.json b/lib/node_modules/@stdlib/blas/base/ggemm/test/fixtures/ca_cb_cc_nta_ntb.json new file mode 100644 index 000000000000..9441f760a90e --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ggemm/test/fixtures/ca_cb_cc_nta_ntb.json @@ -0,0 +1,38 @@ +{ + "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 ], + "A_mat": [ + [ 1.0, 2.0, 3.0 ], + [ 4.0, 5.0, 6.0 ] + ], + "lda": 2, + "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 ], + "B_mat": [ + [ 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, + "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 ], + "C_mat": [ + [ 1.0, 2.0, 3.0, 4.0 ], + [ 5.0, 6.0, 7.0, 8.0 ] + ], + "ldc": 2, + "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/ggemm/test/fixtures/ca_cb_cc_nta_tb.json b/lib/node_modules/@stdlib/blas/base/ggemm/test/fixtures/ca_cb_cc_nta_tb.json new file mode 100644 index 000000000000..49ac6eb564cd --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ggemm/test/fixtures/ca_cb_cc_nta_tb.json @@ -0,0 +1,38 @@ +{ + "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 ], + "A_mat": [ + [ 1.0, 2.0, 3.0 ], + [ 4.0, 5.0, 6.0 ] + ], + "lda": 2, + "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 ], + "B_mat": [ + [ 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, + "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 ], + "C_mat": [ + [ 1.0, 2.0, 3.0, 4.0 ], + [ 5.0, 6.0, 7.0, 8.0 ] + ], + "ldc": 2, + "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/ggemm/test/fixtures/ca_cb_cc_ta_ntb.json b/lib/node_modules/@stdlib/blas/base/ggemm/test/fixtures/ca_cb_cc_ta_ntb.json new file mode 100644 index 000000000000..419804c5897b --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ggemm/test/fixtures/ca_cb_cc_ta_ntb.json @@ -0,0 +1,38 @@ +{ + "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 ], + "A_mat": [ + [ 1.0, 3.0, 5.0 ], + [ 2.0, 4.0, 6.0 ] + ], + "lda": 3, + "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 ], + "B_mat": [ + [ 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, + "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 ], + "C_mat": [ + [ 1.0, 2.0, 3.0, 4.0 ], + [ 5.0, 6.0, 7.0, 8.0 ] + ], + "ldc": 2, + "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/ggemm/test/fixtures/ca_cb_cc_ta_tb.json b/lib/node_modules/@stdlib/blas/base/ggemm/test/fixtures/ca_cb_cc_ta_tb.json new file mode 100644 index 000000000000..033553065a58 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ggemm/test/fixtures/ca_cb_cc_ta_tb.json @@ -0,0 +1,38 @@ +{ + "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 ], + "A_mat": [ + [ 1.0, 3.0, 5.0 ], + [ 2.0, 4.0, 6.0 ] + ], + "lda": 3, + "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 ], + "B_mat": [ + [ 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, + "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 ], + "C_mat": [ + [ 1.0, 2.0, 3.0, 4.0 ], + [ 5.0, 6.0, 7.0, 8.0 ] + ], + "ldc": 2, + "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/ggemm/test/fixtures/ca_cb_rc_nta_ntb.json b/lib/node_modules/@stdlib/blas/base/ggemm/test/fixtures/ca_cb_rc_nta_ntb.json new file mode 100644 index 000000000000..10ff731a2eb3 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ggemm/test/fixtures/ca_cb_rc_nta_ntb.json @@ -0,0 +1,38 @@ +{ + "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 ], + "A_mat": [ + [ 1.0, 2.0, 3.0 ], + [ 4.0, 5.0, 6.0 ] + ], + "lda": 2, + "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 ], + "B_mat": [ + [ 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, + "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 ], + "C_mat": [ + [ 1.0, 2.0, 3.0, 4.0 ], + [ 5.0, 6.0, 7.0, 8.0 ] + ], + "ldc": 2, + "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/ggemm/test/fixtures/ca_cb_rc_nta_tb.json b/lib/node_modules/@stdlib/blas/base/ggemm/test/fixtures/ca_cb_rc_nta_tb.json new file mode 100644 index 000000000000..702ece4fc8e3 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ggemm/test/fixtures/ca_cb_rc_nta_tb.json @@ -0,0 +1,38 @@ +{ + "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 ], + "A_mat": [ + [ 1.0, 2.0, 3.0 ], + [ 4.0, 5.0, 6.0 ] + ], + "lda": 2, + "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 ], + "B_mat": [ + [ 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, + "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 ], + "C_mat": [ + [ 1.0, 2.0, 3.0, 4.0 ], + [ 5.0, 6.0, 7.0, 8.0 ] + ], + "ldc": 4, + "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/ggemm/test/fixtures/ca_cb_rc_ta_ntb.json b/lib/node_modules/@stdlib/blas/base/ggemm/test/fixtures/ca_cb_rc_ta_ntb.json new file mode 100644 index 000000000000..98c46fc311fe --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ggemm/test/fixtures/ca_cb_rc_ta_ntb.json @@ -0,0 +1,38 @@ +{ + "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 ], + "A_mat": [ + [ 1.0, 3.0, 5.0 ], + [ 2.0, 4.0, 6.0 ] + ], + "lda": 3, + "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 ], + "B_mat": [ + [ 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, + "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 ], + "C_mat": [ + [ 1.0, 2.0, 3.0, 4.0 ], + [ 5.0, 6.0, 7.0, 8.0 ] + ], + "ldc": 4, + "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/ggemm/test/fixtures/ca_cb_rc_ta_tb.json b/lib/node_modules/@stdlib/blas/base/ggemm/test/fixtures/ca_cb_rc_ta_tb.json new file mode 100644 index 000000000000..a0623a2d5f91 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ggemm/test/fixtures/ca_cb_rc_ta_tb.json @@ -0,0 +1,38 @@ +{ + "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 ], + "A_mat": [ + [ 1.0, 3.0, 5.0 ], + [ 2.0, 4.0, 6.0 ] + ], + "lda": 3, + "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 ], + "B_mat": [ + [ 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, + "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 ], + "C_mat": [ + [ 1.0, 2.0, 3.0, 4.0 ], + [ 5.0, 6.0, 7.0, 8.0 ] + ], + "ldc": 4, + "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/ggemm/test/fixtures/ca_rb_cc_nta_ntb.json b/lib/node_modules/@stdlib/blas/base/ggemm/test/fixtures/ca_rb_cc_nta_ntb.json new file mode 100644 index 000000000000..eae165b7f34f --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ggemm/test/fixtures/ca_rb_cc_nta_ntb.json @@ -0,0 +1,38 @@ +{ + "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 ], + "A_mat": [ + [ 1.0, 2.0, 3.0 ], + [ 4.0, 5.0, 6.0 ] + ], + "lda": 2, + "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 ], + "B_mat": [ + [ 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, + "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 ], + "C_mat": [ + [ 1.0, 2.0, 3.0, 4.0 ], + [ 5.0, 6.0, 7.0, 8.0 ] + ], + "ldc": 2, + "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/ggemm/test/fixtures/ca_rb_cc_nta_tb.json b/lib/node_modules/@stdlib/blas/base/ggemm/test/fixtures/ca_rb_cc_nta_tb.json new file mode 100644 index 000000000000..b77b10484138 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ggemm/test/fixtures/ca_rb_cc_nta_tb.json @@ -0,0 +1,38 @@ +{ + "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 ], + "A_mat": [ + [ 1.0, 2.0, 3.0 ], + [ 4.0, 5.0, 6.0 ] + ], + "lda": 2, + "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 ], + "B_mat": [ + [ 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, + "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 ], + "C_mat": [ + [ 1.0, 2.0, 3.0, 4.0 ], + [ 5.0, 6.0, 7.0, 8.0 ] + ], + "ldc": 2, + "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/ggemm/test/fixtures/ca_rb_cc_ta_ntb.json b/lib/node_modules/@stdlib/blas/base/ggemm/test/fixtures/ca_rb_cc_ta_ntb.json new file mode 100644 index 000000000000..54345d0fddda --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ggemm/test/fixtures/ca_rb_cc_ta_ntb.json @@ -0,0 +1,38 @@ +{ + "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 ], + "A_mat": [ + [ 1.0, 3.0, 5.0 ], + [ 2.0, 4.0, 6.0 ] + ], + "lda": 3, + "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 ], + "B_mat": [ + [ 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, + "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 ], + "C_mat": [ + [ 1.0, 2.0, 3.0, 4.0 ], + [ 5.0, 6.0, 7.0, 8.0 ] + ], + "ldc": 2, + "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/ggemm/test/fixtures/ca_rb_cc_ta_ntb_sa1_sa2.json b/lib/node_modules/@stdlib/blas/base/ggemm/test/fixtures/ca_rb_cc_ta_ntb_sa1_sa2.json new file mode 100644 index 000000000000..87d83ba0dc6a --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ggemm/test/fixtures/ca_rb_cc_ta_ntb_sa1_sa2.json @@ -0,0 +1,38 @@ +{ + "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 ], + "A_mat": [ + [ 1.0, 3.0, 5.0 ], + [ 2.0, 4.0, 6.0 ] + ], + "lda": 14, + "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 ], + "B_mat": [ + [ 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, + "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 ], + "C_mat": [ + [ 1.0, 2.0, 3.0, 4.0 ], + [ 5.0, 6.0, 7.0, 8.0 ] + ], + "ldc": 2, + "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/ggemm/test/fixtures/ca_rb_cc_ta_ntb_sa1_sa2n.json b/lib/node_modules/@stdlib/blas/base/ggemm/test/fixtures/ca_rb_cc_ta_ntb_sa1_sa2n.json new file mode 100644 index 000000000000..6a4976218d6d --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ggemm/test/fixtures/ca_rb_cc_ta_ntb_sa1_sa2n.json @@ -0,0 +1,38 @@ +{ + "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 ], + "A_mat": [ + [ 1.0, 3.0, 5.0 ], + [ 2.0, 4.0, 6.0 ] + ], + "lda": 14, + "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 ], + "B_mat": [ + [ 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, + "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 ], + "C_mat": [ + [ 1.0, 2.0, 3.0, 4.0 ], + [ 5.0, 6.0, 7.0, 8.0 ] + ], + "ldc": 2, + "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/ggemm/test/fixtures/ca_rb_cc_ta_ntb_sa1n_sa2.json b/lib/node_modules/@stdlib/blas/base/ggemm/test/fixtures/ca_rb_cc_ta_ntb_sa1n_sa2.json new file mode 100644 index 000000000000..2083fea71101 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ggemm/test/fixtures/ca_rb_cc_ta_ntb_sa1n_sa2.json @@ -0,0 +1,38 @@ +{ + "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 ], + "A_mat": [ + [ 1.0, 3.0, 5.0 ], + [ 2.0, 4.0, 6.0 ] + ], + "lda": 14, + "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 ], + "B_mat": [ + [ 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, + "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 ], + "C_mat": [ + [ 1.0, 2.0, 3.0, 4.0 ], + [ 5.0, 6.0, 7.0, 8.0 ] + ], + "ldc": 2, + "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/ggemm/test/fixtures/ca_rb_cc_ta_ntb_sa1n_sa2n.json b/lib/node_modules/@stdlib/blas/base/ggemm/test/fixtures/ca_rb_cc_ta_ntb_sa1n_sa2n.json new file mode 100644 index 000000000000..5385f2764737 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ggemm/test/fixtures/ca_rb_cc_ta_ntb_sa1n_sa2n.json @@ -0,0 +1,38 @@ +{ + "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 ], + "A_mat": [ + [ 1.0, 3.0, 5.0 ], + [ 2.0, 4.0, 6.0 ] + ], + "lda": 14, + "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 ], + "B_mat": [ + [ 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, + "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 ], + "C_mat": [ + [ 1.0, 2.0, 3.0, 4.0 ], + [ 5.0, 6.0, 7.0, 8.0 ] + ], + "ldc": 2, + "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/ggemm/test/fixtures/ca_rb_cc_ta_tb.json b/lib/node_modules/@stdlib/blas/base/ggemm/test/fixtures/ca_rb_cc_ta_tb.json new file mode 100644 index 000000000000..8182a512b502 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ggemm/test/fixtures/ca_rb_cc_ta_tb.json @@ -0,0 +1,38 @@ +{ + "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 ], + "A_mat": [ + [ 1.0, 3.0, 5.0 ], + [ 2.0, 4.0, 6.0 ] + ], + "lda": 3, + "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 ], + "B_mat": [ + [ 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, + "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 ], + "C_mat": [ + [ 1.0, 2.0, 3.0, 4.0 ], + [ 5.0, 6.0, 7.0, 8.0 ] + ], + "ldc": 2, + "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/ggemm/test/fixtures/ca_rb_rc_nta_ntb.json b/lib/node_modules/@stdlib/blas/base/ggemm/test/fixtures/ca_rb_rc_nta_ntb.json new file mode 100644 index 000000000000..8663723c1140 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ggemm/test/fixtures/ca_rb_rc_nta_ntb.json @@ -0,0 +1,38 @@ +{ + "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 ], + "A_mat": [ + [ 1.0, 2.0, 3.0 ], + [ 4.0, 5.0, 6.0 ] + ], + "lda": 2, + "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 ], + "B_mat": [ + [ 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, + "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 ], + "C_mat": [ + [ 1.0, 2.0, 3.0, 4.0 ], + [ 5.0, 6.0, 7.0, 8.0 ] + ], + "ldc": 4, + "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/ggemm/test/fixtures/ca_rb_rc_nta_tb.json b/lib/node_modules/@stdlib/blas/base/ggemm/test/fixtures/ca_rb_rc_nta_tb.json new file mode 100644 index 000000000000..e9f5bbfc976e --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ggemm/test/fixtures/ca_rb_rc_nta_tb.json @@ -0,0 +1,38 @@ +{ + "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 ], + "A_mat": [ + [ 1.0, 2.0, 3.0 ], + [ 4.0, 5.0, 6.0 ] + ], + "lda": 2, + "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 ], + "B_mat": [ + [ 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, + "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 ], + "C_mat": [ + [ 1.0, 2.0, 3.0, 4.0 ], + [ 5.0, 6.0, 7.0, 8.0 ] + ], + "ldc": 4, + "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/ggemm/test/fixtures/ca_rb_rc_ta_ntb.json b/lib/node_modules/@stdlib/blas/base/ggemm/test/fixtures/ca_rb_rc_ta_ntb.json new file mode 100644 index 000000000000..d74b0cd2dcd3 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ggemm/test/fixtures/ca_rb_rc_ta_ntb.json @@ -0,0 +1,38 @@ +{ + "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 ], + "A_mat": [ + [ 1.0, 3.0, 5.0 ], + [ 2.0, 4.0, 6.0 ] + ], + "lda": 3, + "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 ], + "B_mat": [ + [ 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, + "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 ], + "C_mat": [ + [ 1.0, 2.0, 3.0, 4.0 ], + [ 5.0, 6.0, 7.0, 8.0 ] + ], + "ldc": 4, + "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/ggemm/test/fixtures/ca_rb_rc_ta_tb.json b/lib/node_modules/@stdlib/blas/base/ggemm/test/fixtures/ca_rb_rc_ta_tb.json new file mode 100644 index 000000000000..5a13f00442b7 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ggemm/test/fixtures/ca_rb_rc_ta_tb.json @@ -0,0 +1,38 @@ +{ + "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 ], + "A_mat": [ + [ 1.0, 3.0, 5.0 ], + [ 2.0, 4.0, 6.0 ] + ], + "lda": 3, + "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 ], + "B_mat": [ + [ 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, + "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 ], + "C_mat": [ + [ 1.0, 2.0, 3.0, 4.0 ], + [ 5.0, 6.0, 7.0, 8.0 ] + ], + "ldc": 4, + "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/ggemm/test/fixtures/column_major_nta_ntb.json b/lib/node_modules/@stdlib/blas/base/ggemm/test/fixtures/column_major_nta_ntb.json new file mode 100644 index 000000000000..7acd36706359 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ggemm/test/fixtures/column_major_nta_ntb.json @@ -0,0 +1,39 @@ +{ + "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 ], + "A_mat": [ + [ 1.0, 2.0, 3.0 ], + [ 4.0, 5.0, 6.0 ] + ], + "lda": 2, + "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 ], + "B_mat": [ + [ 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, + "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 ], + "C_mat": [ + [ 1.0, 2.0, 3.0, 4.0 ], + [ 5.0, 6.0, 7.0, 8.0 ] + ], + "ldc": 2, + "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/ggemm/test/fixtures/column_major_nta_tb.json b/lib/node_modules/@stdlib/blas/base/ggemm/test/fixtures/column_major_nta_tb.json new file mode 100644 index 000000000000..f2e20c58ac76 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ggemm/test/fixtures/column_major_nta_tb.json @@ -0,0 +1,35 @@ +{ + "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 ], + "A_mat": [ + [ 1.0, 2.0, 3.0 ], + [ 4.0, 5.0, 6.0 ] + ], + "lda": 2, + "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 ], + "B_mat": [ + [ 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, + "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 ], + "ldc": 2, + "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/ggemm/test/fixtures/column_major_ta_ntb.json b/lib/node_modules/@stdlib/blas/base/ggemm/test/fixtures/column_major_ta_ntb.json new file mode 100644 index 000000000000..9dc44a499276 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ggemm/test/fixtures/column_major_ta_ntb.json @@ -0,0 +1,39 @@ +{ + "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 ], + "A_mat": [ + [ 1.0, 3.0, 5.0 ], + [ 2.0, 4.0, 6.0 ] + ], + "lda": 3, + "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 ], + "B_mat": [ + [ 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, + "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 ], + "C_mat": [ + [ 1.0, 2.0, 3.0, 4.0 ], + [ 5.0, 6.0, 7.0, 8.0 ] + ], + "ldc": 2, + "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/ggemm/test/fixtures/column_major_ta_tb.json b/lib/node_modules/@stdlib/blas/base/ggemm/test/fixtures/column_major_ta_tb.json new file mode 100644 index 000000000000..7df2e9e18d22 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ggemm/test/fixtures/column_major_ta_tb.json @@ -0,0 +1,39 @@ +{ + "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 ], + "A_mat": [ + [ 1.0, 3.0, 5.0 ], + [ 2.0, 4.0, 6.0 ] + ], + "lda": 3, + "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 ], + "B_mat": [ + [ 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, + "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 ], + "C_mat": [ + [ 1.0, 2.0, 3.0, 4.0 ], + [ 5.0, 6.0, 7.0, 8.0 ] + ], + "ldc": 2, + "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/ggemm/test/fixtures/ra_cb_cc_nta_ntb.json b/lib/node_modules/@stdlib/blas/base/ggemm/test/fixtures/ra_cb_cc_nta_ntb.json new file mode 100644 index 000000000000..4e25d4ca571d --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ggemm/test/fixtures/ra_cb_cc_nta_ntb.json @@ -0,0 +1,38 @@ +{ + "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 ], + "A_mat": [ + [ 1.0, 2.0, 3.0 ], + [ 4.0, 5.0, 6.0 ] + ], + "lda": 3, + "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 ], + "B_mat": [ + [ 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, + "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 ], + "C_mat": [ + [ 1.0, 2.0, 3.0, 4.0 ], + [ 5.0, 6.0, 7.0, 8.0 ] + ], + "ldc": 2, + "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/ggemm/test/fixtures/ra_cb_cc_nta_tb.json b/lib/node_modules/@stdlib/blas/base/ggemm/test/fixtures/ra_cb_cc_nta_tb.json new file mode 100644 index 000000000000..b17d69aaf867 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ggemm/test/fixtures/ra_cb_cc_nta_tb.json @@ -0,0 +1,38 @@ +{ + "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 ], + "A_mat": [ + [ 1.0, 2.0, 3.0 ], + [ 4.0, 5.0, 6.0 ] + ], + "lda": 3, + "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 ], + "B_mat": [ + [ 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, + "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 ], + "C_mat": [ + [ 1.0, 2.0, 3.0, 4.0 ], + [ 5.0, 6.0, 7.0, 8.0 ] + ], + "ldc": 2, + "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/ggemm/test/fixtures/ra_cb_cc_ta_ntb.json b/lib/node_modules/@stdlib/blas/base/ggemm/test/fixtures/ra_cb_cc_ta_ntb.json new file mode 100644 index 000000000000..62a33d985454 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ggemm/test/fixtures/ra_cb_cc_ta_ntb.json @@ -0,0 +1,38 @@ +{ + "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 ], + "A_mat": [ + [ 1.0, 4.0, 2.0 ], + [ 5.0, 3.0, 6.0 ] + ], + "lda": 2, + "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 ], + "B_mat": [ + [ 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, + "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 ], + "C_mat": [ + [ 1.0, 2.0, 3.0, 4.0 ], + [ 5.0, 6.0, 7.0, 8.0 ] + ], + "ldc": 2, + "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/ggemm/test/fixtures/ra_cb_cc_ta_tb.json b/lib/node_modules/@stdlib/blas/base/ggemm/test/fixtures/ra_cb_cc_ta_tb.json new file mode 100644 index 000000000000..3dd5188b99cf --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ggemm/test/fixtures/ra_cb_cc_ta_tb.json @@ -0,0 +1,38 @@ +{ + "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 ], + "A_mat": [ + [ 1.0, 4.0, 2.0 ], + [ 5.0, 3.0, 6.0 ] + ], + "lda": 2, + "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 ], + "B_mat": [ + [ 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, + "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 ], + "C_mat": [ + [ 1.0, 2.0, 3.0, 4.0 ], + [ 5.0, 6.0, 7.0, 8.0 ] + ], + "ldc": 2, + "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/ggemm/test/fixtures/ra_cb_rc_nta_ntb.json b/lib/node_modules/@stdlib/blas/base/ggemm/test/fixtures/ra_cb_rc_nta_ntb.json new file mode 100644 index 000000000000..2673fff3e027 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ggemm/test/fixtures/ra_cb_rc_nta_ntb.json @@ -0,0 +1,38 @@ +{ + "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 ], + "A_mat": [ + [ 1.0, 2.0, 3.0 ], + [ 4.0, 5.0, 6.0 ] + ], + "lda": 3, + "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 ], + "B_mat": [ + [ 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, + "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 ], + "C_mat": [ + [ 1.0, 2.0, 3.0, 4.0 ], + [ 5.0, 6.0, 7.0, 8.0 ] + ], + "ldc": 4, + "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/ggemm/test/fixtures/ra_cb_rc_nta_tb.json b/lib/node_modules/@stdlib/blas/base/ggemm/test/fixtures/ra_cb_rc_nta_tb.json new file mode 100644 index 000000000000..a5e6ebaf9433 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ggemm/test/fixtures/ra_cb_rc_nta_tb.json @@ -0,0 +1,38 @@ +{ + "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 ], + "A_mat": [ + [ 1.0, 2.0, 3.0 ], + [ 4.0, 5.0, 6.0 ] + ], + "lda": 3, + "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 ], + "B_mat": [ + [ 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, + "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 ], + "C_mat": [ + [ 1.0, 2.0, 3.0, 4.0 ], + [ 5.0, 6.0, 7.0, 8.0 ] + ], + "ldc": 4, + "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/ggemm/test/fixtures/ra_cb_rc_nta_tb_sc1_sc2.json b/lib/node_modules/@stdlib/blas/base/ggemm/test/fixtures/ra_cb_rc_nta_tb_sc1_sc2.json new file mode 100644 index 000000000000..e2834eeac627 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ggemm/test/fixtures/ra_cb_rc_nta_tb_sc1_sc2.json @@ -0,0 +1,38 @@ +{ + "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 ], + "A_mat": [ + [ 1.0, 2.0, 3.0 ], + [ 4.0, 5.0, 6.0 ] + ], + "lda": 3, + "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 ], + "B_mat": [ + [ 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, + "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 ], + "C_mat": [ + [ 1.0, 2.0, 3.0, 4.0 ], + [ 5.0, 6.0, 7.0, 8.0 ] + ], + "ldc": 16, + "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/ggemm/test/fixtures/ra_cb_rc_nta_tb_sc1_sc2n.json b/lib/node_modules/@stdlib/blas/base/ggemm/test/fixtures/ra_cb_rc_nta_tb_sc1_sc2n.json new file mode 100644 index 000000000000..8bdf21d88abe --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ggemm/test/fixtures/ra_cb_rc_nta_tb_sc1_sc2n.json @@ -0,0 +1,38 @@ +{ + "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 ], + "A_mat": [ + [ 1.0, 2.0, 3.0 ], + [ 4.0, 5.0, 6.0 ] + ], + "lda": 3, + "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 ], + "B_mat": [ + [ 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, + "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 ], + "C_mat": [ + [ 1.0, 2.0, 3.0, 4.0 ], + [ 5.0, 6.0, 7.0, 8.0 ] + ], + "ldc": 18, + "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/ggemm/test/fixtures/ra_cb_rc_nta_tb_sc1n_sc2.json b/lib/node_modules/@stdlib/blas/base/ggemm/test/fixtures/ra_cb_rc_nta_tb_sc1n_sc2.json new file mode 100644 index 000000000000..c04d74d9efb4 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ggemm/test/fixtures/ra_cb_rc_nta_tb_sc1n_sc2.json @@ -0,0 +1,38 @@ +{ + "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 ], + "A_mat": [ + [ 1.0, 2.0, 3.0 ], + [ 4.0, 5.0, 6.0 ] + ], + "lda": 3, + "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 ], + "B_mat": [ + [ 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, + "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 ], + "C_mat": [ + [ 1.0, 2.0, 3.0, 4.0 ], + [ 5.0, 6.0, 7.0, 8.0 ] + ], + "ldc": 18, + "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/ggemm/test/fixtures/ra_cb_rc_nta_tb_sc1n_sc2n.json b/lib/node_modules/@stdlib/blas/base/ggemm/test/fixtures/ra_cb_rc_nta_tb_sc1n_sc2n.json new file mode 100644 index 000000000000..8b674e7e2570 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ggemm/test/fixtures/ra_cb_rc_nta_tb_sc1n_sc2n.json @@ -0,0 +1,38 @@ +{ + "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 ], + "A_mat": [ + [ 1.0, 2.0, 3.0 ], + [ 4.0, 5.0, 6.0 ] + ], + "lda": 3, + "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 ], + "B_mat": [ + [ 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, + "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 ], + "C_mat": [ + [ 1.0, 2.0, 3.0, 4.0 ], + [ 5.0, 6.0, 7.0, 8.0 ] + ], + "ldc": 18, + "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/ggemm/test/fixtures/ra_cb_rc_ta_ntb.json b/lib/node_modules/@stdlib/blas/base/ggemm/test/fixtures/ra_cb_rc_ta_ntb.json new file mode 100644 index 000000000000..b5ebc012f55c --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ggemm/test/fixtures/ra_cb_rc_ta_ntb.json @@ -0,0 +1,26 @@ +{ + "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 ], + "A_mat": [ + [ 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/ggemm/test/fixtures/ra_cb_rc_ta_tb.json b/lib/node_modules/@stdlib/blas/base/ggemm/test/fixtures/ra_cb_rc_ta_tb.json new file mode 100644 index 000000000000..f0f0ccde803b --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ggemm/test/fixtures/ra_cb_rc_ta_tb.json @@ -0,0 +1,38 @@ +{ + "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 ], + "A_mat": [ + [ 1.0, 4.0, 2.0 ], + [ 5.0, 3.0, 6.0 ] + ], + "lda": 2, + "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 ], + "B_mat": [ + [ 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, + "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 ], + "C_mat": [ + [ 1.0, 2.0, 3.0, 4.0 ], + [ 5.0, 6.0, 7.0, 8.0 ] + ], + "ldc": 4, + "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/ggemm/test/fixtures/ra_rb_cc_nta_ntb.json b/lib/node_modules/@stdlib/blas/base/ggemm/test/fixtures/ra_rb_cc_nta_ntb.json new file mode 100644 index 000000000000..c69285f27bce --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ggemm/test/fixtures/ra_rb_cc_nta_ntb.json @@ -0,0 +1,38 @@ +{ + "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 ], + "A_mat": [ + [ 1.0, 2.0, 3.0 ], + [ 4.0, 5.0, 6.0 ] + ], + "lda": 3, + "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 ], + "B_mat": [ + [ 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, + "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 ], + "C_mat": [ + [ 1.0, 2.0, 3.0, 4.0 ], + [ 5.0, 6.0, 7.0, 8.0 ] + ], + "ldc": 2, + "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/ggemm/test/fixtures/ra_rb_cc_nta_tb.json b/lib/node_modules/@stdlib/blas/base/ggemm/test/fixtures/ra_rb_cc_nta_tb.json new file mode 100644 index 000000000000..a151b70612c5 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ggemm/test/fixtures/ra_rb_cc_nta_tb.json @@ -0,0 +1,38 @@ +{ + "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 ], + "A_mat": [ + [ 1.0, 2.0, 3.0 ], + [ 4.0, 5.0, 6.0 ] + ], + "lda": 3, + "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 ], + "B_mat": [ + [ 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, + "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 ], + "C_mat": [ + [ 1.0, 2.0, 3.0, 4.0 ], + [ 5.0, 6.0, 7.0, 8.0 ] + ], + "ldc": 2, + "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/ggemm/test/fixtures/ra_rb_cc_ta_ntb.json b/lib/node_modules/@stdlib/blas/base/ggemm/test/fixtures/ra_rb_cc_ta_ntb.json new file mode 100644 index 000000000000..571d9f085d24 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ggemm/test/fixtures/ra_rb_cc_ta_ntb.json @@ -0,0 +1,38 @@ +{ + "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 ], + "A_mat": [ + [ 1.0, 4.0, 2.0 ], + [ 5.0, 3.0, 6.0 ] + ], + "lda": 2, + "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 ], + "B_mat": [ + [ 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, + "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 ], + "C_mat": [ + [ 1.0, 2.0, 3.0, 4.0 ], + [ 5.0, 6.0, 7.0, 8.0 ] + ], + "ldc": 2, + "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/ggemm/test/fixtures/ra_rb_cc_ta_ntb_sb1_sb2.json b/lib/node_modules/@stdlib/blas/base/ggemm/test/fixtures/ra_rb_cc_ta_ntb_sb1_sb2.json new file mode 100644 index 000000000000..4f3f26ef6a75 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ggemm/test/fixtures/ra_rb_cc_ta_ntb_sb1_sb2.json @@ -0,0 +1,38 @@ +{ + "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 ], + "A_mat": [ + [ 1.0, 4.0, 2.0 ], + [ 5.0, 3.0, 6.0 ] + ], + "lda": 2, + "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 ], + "B_mat": [ + [ 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": 16, + "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 ], + "C_mat": [ + [ 1.0, 2.0, 3.0, 4.0 ], + [ 5.0, 6.0, 7.0, 8.0 ] + ], + "ldc": 2, + "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/ggemm/test/fixtures/ra_rb_cc_ta_ntb_sb1_sb2n.json b/lib/node_modules/@stdlib/blas/base/ggemm/test/fixtures/ra_rb_cc_ta_ntb_sb1_sb2n.json new file mode 100644 index 000000000000..318036a603ba --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ggemm/test/fixtures/ra_rb_cc_ta_ntb_sb1_sb2n.json @@ -0,0 +1,38 @@ +{ + "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 ], + "A_mat": [ + [ 1.0, 4.0, 2.0 ], + [ 5.0, 3.0, 6.0 ] + ], + "lda": 2, + "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 ], + "B_mat": [ + [ 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": 18, + "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 ], + "C_mat": [ + [ 1.0, 2.0, 3.0, 4.0 ], + [ 5.0, 6.0, 7.0, 8.0 ] + ], + "ldc": 2, + "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/ggemm/test/fixtures/ra_rb_cc_ta_ntb_sb1n_sb2.json b/lib/node_modules/@stdlib/blas/base/ggemm/test/fixtures/ra_rb_cc_ta_ntb_sb1n_sb2.json new file mode 100644 index 000000000000..65f1e8af3edf --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ggemm/test/fixtures/ra_rb_cc_ta_ntb_sb1n_sb2.json @@ -0,0 +1,38 @@ +{ + "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 ], + "A_mat": [ + [ 1.0, 4.0, 2.0 ], + [ 5.0, 3.0, 6.0 ] + ], + "lda": 2, + "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 ], + "B_mat": [ + [ 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": 18, + "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 ], + "C_mat": [ + [ 1.0, 2.0, 3.0, 4.0 ], + [ 5.0, 6.0, 7.0, 8.0 ] + ], + "ldc": 2, + "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/ggemm/test/fixtures/ra_rb_cc_ta_ntb_sb1n_sb2n.json b/lib/node_modules/@stdlib/blas/base/ggemm/test/fixtures/ra_rb_cc_ta_ntb_sb1n_sb2n.json new file mode 100644 index 000000000000..ae7fb1b4aeb8 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ggemm/test/fixtures/ra_rb_cc_ta_ntb_sb1n_sb2n.json @@ -0,0 +1,38 @@ +{ + "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 ], + "A_mat": [ + [ 1.0, 4.0, 2.0 ], + [ 5.0, 3.0, 6.0 ] + ], + "lda": 2, + "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 ], + "B_mat": [ + [ 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": 18, + "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 ], + "C_mat": [ + [ 1.0, 2.0, 3.0, 4.0 ], + [ 5.0, 6.0, 7.0, 8.0 ] + ], + "ldc": 2, + "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/ggemm/test/fixtures/ra_rb_cc_ta_tb.json b/lib/node_modules/@stdlib/blas/base/ggemm/test/fixtures/ra_rb_cc_ta_tb.json new file mode 100644 index 000000000000..f3b3254d2144 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ggemm/test/fixtures/ra_rb_cc_ta_tb.json @@ -0,0 +1,38 @@ +{ + "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 ], + "A_mat": [ + [ 1.0, 4.0, 2.0 ], + [ 5.0, 3.0, 6.0 ] + ], + "lda": 2, + "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 ], + "B_mat": [ + [ 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, + "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 ], + "C_mat": [ + [ 1.0, 2.0, 3.0, 4.0 ], + [ 5.0, 6.0, 7.0, 8.0 ] + ], + "ldc": 2, + "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/ggemm/test/fixtures/ra_rb_rc_nta_ntb.json b/lib/node_modules/@stdlib/blas/base/ggemm/test/fixtures/ra_rb_rc_nta_ntb.json new file mode 100644 index 000000000000..3dfec4c13238 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ggemm/test/fixtures/ra_rb_rc_nta_ntb.json @@ -0,0 +1,38 @@ +{ + "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 ], + "A_mat": [ + [ 1.0, 2.0, 3.0 ], + [ 4.0, 5.0, 6.0 ] + ], + "lda": 3, + "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 ], + "B_mat": [ + [ 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, + "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 ], + "C_mat": [ + [ 1.0, 2.0, 3.0, 4.0 ], + [ 5.0, 6.0, 7.0, 8.0 ] + ], + "ldc": 4, + "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/ggemm/test/fixtures/ra_rb_rc_nta_ntb_complex_access_pattern.json b/lib/node_modules/@stdlib/blas/base/ggemm/test/fixtures/ra_rb_rc_nta_ntb_complex_access_pattern.json new file mode 100644 index 000000000000..02ee5e5ac204 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ggemm/test/fixtures/ra_rb_rc_nta_ntb_complex_access_pattern.json @@ -0,0 +1,38 @@ +{ + "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 ], + "A_mat": [ + [ 1.0, 2.0, 3.0 ], + [ 4.0, 5.0, 6.0 ] + ], + "lda": 6, + "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 ], + "B_mat": [ + [ 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": 16, + "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 ], + "C_mat": [ + [ 1.0, 2.0, 3.0, 4.0 ], + [ 5.0, 6.0, 7.0, 8.0 ] + ], + "ldc": 16, + "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/ggemm/test/fixtures/ra_rb_rc_nta_ntb_oa.json b/lib/node_modules/@stdlib/blas/base/ggemm/test/fixtures/ra_rb_rc_nta_ntb_oa.json new file mode 100644 index 000000000000..b62b7debf5db --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ggemm/test/fixtures/ra_rb_rc_nta_ntb_oa.json @@ -0,0 +1,38 @@ +{ + "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 ], + "A_mat": [ + [ 1.0, 2.0, 3.0 ], + [ 4.0, 5.0, 6.0 ] + ], + "lda": 3, + "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 ], + "B_mat": [ + [ 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, + "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 ], + "C_mat": [ + [ 1.0, 2.0, 3.0, 4.0 ], + [ 5.0, 6.0, 7.0, 8.0 ] + ], + "ldc": 4, + "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/ggemm/test/fixtures/ra_rb_rc_nta_ntb_ob.json b/lib/node_modules/@stdlib/blas/base/ggemm/test/fixtures/ra_rb_rc_nta_ntb_ob.json new file mode 100644 index 000000000000..4b991ca3a4a3 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ggemm/test/fixtures/ra_rb_rc_nta_ntb_ob.json @@ -0,0 +1,38 @@ +{ + "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 ], + "A_mat": [ + [ 1.0, 2.0, 3.0 ], + [ 4.0, 5.0, 6.0 ] + ], + "lda": 3, + "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 ], + "B_mat": [ + [ 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, + "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 ], + "C_mat": [ + [ 1.0, 2.0, 3.0, 4.0 ], + [ 5.0, 6.0, 7.0, 8.0 ] + ], + "ldc": 4, + "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/ggemm/test/fixtures/ra_rb_rc_nta_ntb_oc.json b/lib/node_modules/@stdlib/blas/base/ggemm/test/fixtures/ra_rb_rc_nta_ntb_oc.json new file mode 100644 index 000000000000..89a99e1b54e3 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ggemm/test/fixtures/ra_rb_rc_nta_ntb_oc.json @@ -0,0 +1,38 @@ +{ + "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 ], + "A_mat": [ + [ 1.0, 2.0, 3.0 ], + [ 4.0, 5.0, 6.0 ] + ], + "lda": 3, + "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 ], + "B_mat": [ + [ 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, + "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 ], + "C_mat": [ + [ 1.0, 2.0, 3.0, 4.0 ], + [ 5.0, 6.0, 7.0, 8.0 ] + ], + "ldc": 4, + "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/ggemm/test/fixtures/ra_rb_rc_nta_tb.json b/lib/node_modules/@stdlib/blas/base/ggemm/test/fixtures/ra_rb_rc_nta_tb.json new file mode 100644 index 000000000000..4bca295f827f --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ggemm/test/fixtures/ra_rb_rc_nta_tb.json @@ -0,0 +1,38 @@ +{ + "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 ], + "A_mat": [ + [ 1.0, 2.0, 3.0 ], + [ 4.0, 5.0, 6.0 ] + ], + "lda": 3, + "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 ], + "B_mat": [ + [ 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, + "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 ], + "C_mat": [ + [ 1.0, 2.0, 3.0, 4.0 ], + [ 5.0, 6.0, 7.0, 8.0 ] + ], + "ldc": 4, + "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/ggemm/test/fixtures/ra_rb_rc_ta_ntb.json b/lib/node_modules/@stdlib/blas/base/ggemm/test/fixtures/ra_rb_rc_ta_ntb.json new file mode 100644 index 000000000000..1846f13c05b2 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ggemm/test/fixtures/ra_rb_rc_ta_ntb.json @@ -0,0 +1,38 @@ +{ + "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 ], + "A_mat": [ + [ 1.0, 4.0, 2.0 ], + [ 5.0, 3.0, 6.0 ] + ], + "lda": 2, + "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 ], + "B_mat": [ + [ 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, + "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 ], + "C_mat": [ + [ 1.0, 2.0, 3.0, 4.0 ], + [ 5.0, 6.0, 7.0, 8.0 ] + ], + "ldc": 2, + "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/ggemm/test/fixtures/ra_rb_rc_ta_tb.json b/lib/node_modules/@stdlib/blas/base/ggemm/test/fixtures/ra_rb_rc_ta_tb.json new file mode 100644 index 000000000000..6fb9bbaf854c --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ggemm/test/fixtures/ra_rb_rc_ta_tb.json @@ -0,0 +1,38 @@ +{ + "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 ], + "A_mat": [ + [ 1.0, 4.0, 2.0 ], + [ 5.0, 3.0, 6.0 ] + ], + "lda": 2, + "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 ], + "B_mat": [ + [ 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, + "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 ], + "C_mat": [ + [ 1.0, 2.0, 3.0, 4.0 ], + [ 5.0, 6.0, 7.0, 8.0 ] + ], + "ldc": 4, + "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/ggemm/test/fixtures/row_major_nta_ntb.json b/lib/node_modules/@stdlib/blas/base/ggemm/test/fixtures/row_major_nta_ntb.json new file mode 100644 index 000000000000..bdca8658a5e9 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ggemm/test/fixtures/row_major_nta_ntb.json @@ -0,0 +1,39 @@ +{ + "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 ], + "A_mat": [ + [ 1.0, 2.0, 3.0 ], + [ 4.0, 5.0, 6.0 ] + ], + "lda": 3, + "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 ], + "B_mat": [ + [ 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, + "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 ], + "C_mat": [ + [ 1.0, 2.0, 3.0, 4.0 ], + [ 5.0, 6.0, 7.0, 8.0 ] + ], + "ldc": 4, + "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/ggemm/test/fixtures/row_major_nta_tb.json b/lib/node_modules/@stdlib/blas/base/ggemm/test/fixtures/row_major_nta_tb.json new file mode 100644 index 000000000000..c1236b2818fe --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ggemm/test/fixtures/row_major_nta_tb.json @@ -0,0 +1,39 @@ +{ + "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 ], + "A_mat": [ + [ 1.0, 2.0, 3.0 ], + [ 4.0, 5.0, 6.0 ] + ], + "lda": 3, + "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 ], + "B_mat": [ + [ 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, + "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 ], + "C_mat": [ + [ 1.0, 2.0, 3.0, 4.0 ], + [ 5.0, 6.0, 7.0, 8.0 ] + ], + "ldc": 4, + "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/ggemm/test/fixtures/row_major_ta_ntb.json b/lib/node_modules/@stdlib/blas/base/ggemm/test/fixtures/row_major_ta_ntb.json new file mode 100644 index 000000000000..afeefb32b91b --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ggemm/test/fixtures/row_major_ta_ntb.json @@ -0,0 +1,39 @@ +{ + "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 ], + "A_mat": [ + [ 1.0, 4.0, 2.0 ], + [ 5.0, 3.0, 6.0 ] + ], + "lda": 2, + "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 ], + "B_mat": [ + [ 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, + "strideB1": 1, + "strideB2": 1, + "offsetB": 0, + "beta": 1.0, + "C": [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ], + "C_mat": [ + [ 1.0, 2.0, 3.0, 4.0 ], + [ 5.0, 6.0, 7.0, 8.0 ] + ], + "ldc": 4, + "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/ggemm/test/fixtures/row_major_ta_tb.json b/lib/node_modules/@stdlib/blas/base/ggemm/test/fixtures/row_major_ta_tb.json new file mode 100644 index 000000000000..c7ff88e2545a --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ggemm/test/fixtures/row_major_ta_tb.json @@ -0,0 +1,39 @@ +{ + "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 ], + "A_mat": [ + [ 1.0, 4.0, 2.0 ], + [ 5.0, 3.0, 6.0 ] + ], + "lda": 2, + "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 ], + "B_mat": [ + [ 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, + "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 ], + "C_mat": [ + [ 1.0, 2.0, 3.0, 4.0 ], + [ 5.0, 6.0, 7.0, 8.0 ] + ], + "ldc": 4, + "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/ggemm/test/test.js b/lib/node_modules/@stdlib/blas/base/ggemm/test/test.js new file mode 100644 index 000000000000..3b1336d56e13 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ggemm/test/test.js @@ -0,0 +1,38 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var ggemm = require( './../lib' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof ggemm, '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 ggemm.ndarray, 'function', 'method is a function' ); + t.end(); +}); diff --git a/lib/node_modules/@stdlib/blas/base/ggemm/test/test.main.js b/lib/node_modules/@stdlib/blas/base/ggemm/test/test.main.js new file mode 100644 index 000000000000..0c44902095b7 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ggemm/test/test.main.js @@ -0,0 +1,1395 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable max-len */ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var gscal = require( '@stdlib/blas/base/gscal' ); +var gfill = require( '@stdlib/blas/ext/base/gfill' ); +var toAccessorArray = require( '@stdlib/array/base/to-accessor-array' ); +var copy = require( '@stdlib/array/base/copy' ); +var ggemm = require( './../lib/main.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' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof ggemm, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function has an arity of 14', function test( t ) { + t.strictEqual( ggemm.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() { + ggemm( value, data.transA, data.transB, data.M, data.N, data.K, data.alpha, data.A, data.lda, data.B, data.ldb, data.beta, data.C, data.ldc ); + }; + } +}); + +tape( 'the function throws an error if provided an invalid first argument (accessors)', 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() { + ggemm( value, data.transA, data.transB, data.M, data.N, data.K, data.alpha, toAccessorArray( data.A ), data.lda, toAccessorArray( data.B ), data.ldb, data.beta, toAccessorArray( 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() { + ggemm( data.order, value, data.transB, data.M, data.N, data.K, data.alpha, data.A, data.lda, data.B, data.ldb, data.beta, data.C, data.ldc ); + }; + } +}); + +tape( 'the function throws an error if provided an invalid second argument (accessors)', 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() { + ggemm( data.order, value, data.transB, data.M, data.N, data.K, data.alpha, toAccessorArray( data.A ), data.lda, toAccessorArray( data.B ), data.ldb, data.beta, toAccessorArray( 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() { + ggemm( data.order, data.transA, value, data.M, data.N, data.K, data.alpha, data.A, data.lda, data.B, data.ldb, data.beta, data.C, data.ldc ); + }; + } +}); + +tape( 'the function throws an error if provided an invalid third argument (accessors)', 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() { + ggemm( data.order, data.transA, value, data.M, data.N, data.K, data.alpha, toAccessorArray( data.A ), data.lda, toAccessorArray( data.B ), data.ldb, data.beta, toAccessorArray( 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() { + ggemm( data.order, data.transA, data.transB, value, data.N, data.K, data.alpha, data.A, data.lda, data.B, data.ldb, data.beta, data.C, data.ldc ); + }; + } +}); + +tape( 'the function throws an error if provided an invalid fourth argument (accessors)', 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() { + ggemm( data.order, data.transA, data.transB, value, data.N, data.K, data.alpha, toAccessorArray( data.A ), data.lda, toAccessorArray( data.B ), data.ldb, data.beta, toAccessorArray( 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() { + ggemm( data.order, data.transA, data.transB, data.M, value, data.K, data.alpha, data.A, data.lda, data.B, data.ldb, data.beta, data.C, data.ldc ); + }; + } +}); + +tape( 'the function throws an error if provided an invalid fifth argument (accessors)', 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() { + ggemm( data.order, data.transA, data.transB, data.M, value, data.K, data.alpha, toAccessorArray( data.A ), data.lda, toAccessorArray( data.B ), data.ldb, data.beta, toAccessorArray( 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() { + ggemm( data.order, data.transA, data.transB, data.M, data.N, value, data.alpha, data.A, data.lda, data.B, data.ldb, data.beta, data.C, data.ldc ); + }; + } +}); + +tape( 'the function throws an error if provided an invalid sixth argument (accessors)', 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() { + ggemm( data.order, data.transA, data.transB, data.M, data.N, value, data.alpha, toAccessorArray( data.A ), data.lda, toAccessorArray( data.B ), data.ldb, data.beta, toAccessorArray( 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() { + ggemm( data.order, data.transA, data.transB, data.M, data.N, data.K, data.alpha, data.A, value, data.B, data.ldb, data.beta, data.C, data.ldc ); + }; + } +}); + +tape( 'the function throws an error if provided an invalid ninth argument (accessors)', 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() { + ggemm( data.order, data.transA, data.transB, data.M, data.N, data.K, data.alpha, toAccessorArray( data.A ), value, toAccessorArray( data.B ), data.ldb, data.beta, toAccessorArray( 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() { + ggemm( data.order, data.transA, data.transB, data.M, data.N, data.K, data.alpha, data.A, data.lda, data.B, value, data.beta, data.C, data.ldc ); + }; + } +}); + +tape( 'the function throws an error if provided an invalid eleventh argument (accessors)', 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() { + ggemm( data.order, data.transA, data.transB, data.M, data.N, data.K, data.alpha, toAccessorArray( data.A ), data.lda, toAccessorArray( data.B ), value, data.beta, toAccessorArray( 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() { + ggemm( data.order, data.transA, data.transB, data.M, data.N, data.K, data.alpha, toAccessorArray( data.A ), data.lda, toAccessorArray( data.B ), data.ldb, data.beta, toAccessorArray( data.C ), value ); + }; + } +}); + +tape( 'the function throws an error if provided an invalid fourteenth argument (accessors)', 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() { + ggemm( data.order, data.transA, data.transB, data.M, data.N, data.K, data.alpha, toAccessorArray( data.A ), data.lda, toAccessorArray( data.B ), data.ldb, data.beta, toAccessorArray( data.C ), value ); + }; + } +}); + +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; + var a; + var b; + var c; + + data = rntantb; + + a = copy( data.A ); + b = copy( data.B ); + c = copy( data.C ); + + expected = data.C_out; + + out = ggemm( 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.deepEqual( out, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function performs the matrix-matrix operation `C = α*op(A)*op(B) + β*C` (row-major, no-transpose, no-transpose) (accessors)', function test( t ) { + var expected; + var cbuf; + var data; + var out; + var a; + var b; + var c; + + data = rntantb; + + a = toAccessorArray( copy( data.A ) ); + b = toAccessorArray( copy( data.B ) ); + cbuf = copy( data.C ); + c = toAccessorArray( cbuf ); + + expected = data.C_out; + + out = ggemm( 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.deepEqual( cbuf, expected, 'returns expected value' ); + t.end(); +}); + +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; + var a; + var b; + var c; + + data = cntantb; + + a = copy( data.A ); + b = copy( data.B ); + c = copy( data.C ); + + expected = data.C_out; + + out = ggemm( 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.deepEqual( out, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function performs the matrix-matrix operation `C = α*op(A)*op(B) + β*C` (column-major, no-transpose, no-transpose) (accessors)', function test( t ) { + var expected; + var cbuf; + var data; + var out; + var a; + var b; + var c; + + data = cntantb; + + a = toAccessorArray( copy( data.A ) ); + b = toAccessorArray( copy( data.B ) ); + cbuf = copy( data.C ); + c = toAccessorArray( cbuf ); + + expected = data.C_out; + + out = ggemm( 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.deepEqual( cbuf, expected, 'returns expected value' ); + t.end(); +}); + +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; + var a; + var b; + var c; + + data = rtantb; + + a = copy( data.A ); + b = copy( data.B ); + c = copy( data.C ); + + expected = data.C_out; + + out = ggemm( 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.deepEqual( out, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function performs the matrix-matrix operation `C = α*op(A)*op(B) + β*C` (row-major, transpose, no-transpose) (accessors)', function test( t ) { + var expected; + var cbuf; + var data; + var out; + var a; + var b; + var c; + + data = rtantb; + + a = toAccessorArray( copy( data.A ) ); + b = toAccessorArray( copy( data.B ) ); + cbuf = copy( data.C ); + c = toAccessorArray( cbuf ); + + expected = data.C_out; + + out = ggemm( 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.deepEqual( cbuf, expected, 'returns expected value' ); + t.end(); +}); + +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; + var a; + var b; + var c; + + data = ctantb; + + a = copy( data.A ); + b = copy( data.B ); + c = copy( data.C ); + + expected = data.C_out; + + out = ggemm( 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.deepEqual( out, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function performs the matrix-matrix operation `C = α*op(A)*op(B) + β*C` (column-major, transpose, no-transpose) (accessors)', function test( t ) { + var expected; + var cbuf; + var data; + var out; + var a; + var b; + var c; + + data = ctantb; + + a = toAccessorArray( copy( data.A ) ); + b = toAccessorArray( copy( data.B ) ); + cbuf = copy( data.C ); + c = toAccessorArray( cbuf ); + + expected = data.C_out; + + out = ggemm( 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.deepEqual( cbuf, expected, 'returns expected value' ); + t.end(); +}); + +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; + var a; + var b; + var c; + + data = rntatb; + + a = copy( data.A ); + b = copy( data.B ); + c = copy( data.C ); + + expected = data.C_out; + + out = ggemm( 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.deepEqual( out, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function performs the matrix-matrix operation `C = α*op(A)*op(B) + β*C` (row-major, no-transpose, transpose) (accessors)', function test( t ) { + var expected; + var cbuf; + var data; + var out; + var a; + var b; + var c; + + data = rntatb; + + a = toAccessorArray( copy( data.A ) ); + b = toAccessorArray( copy( data.B ) ); + cbuf = copy( data.C ); + c = toAccessorArray( cbuf ); + + expected = data.C_out; + + out = ggemm( 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.deepEqual( cbuf, expected, 'returns expected value' ); + t.end(); +}); + +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; + var a; + var b; + var c; + + data = cntatb; + + a = copy( data.A ); + b = copy( data.B ); + c = copy( data.C ); + + expected = data.C_out; + + out = ggemm( 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.deepEqual( out, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function performs the matrix-matrix operation `C = α*op(A)*op(B) + β*C` (column-major, no-transpose, transpose) (accessors)', function test( t ) { + var expected; + var cbuf; + var data; + var out; + var a; + var b; + var c; + + data = cntatb; + + a = toAccessorArray( copy( data.A ) ); + b = toAccessorArray( copy( data.B ) ); + cbuf = copy( data.C ); + c = toAccessorArray( cbuf ); + + expected = data.C_out; + + out = ggemm( 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.deepEqual( cbuf, expected, 'returns expected value' ); + t.end(); +}); + +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; + var a; + var b; + var c; + + data = rtatb; + + a = copy( data.A ); + b = copy( data.B ); + c = copy( data.C ); + + expected = data.C_out; + + out = ggemm( 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.deepEqual( out, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function performs the matrix-matrix operation `C = α*op(A)*op(B) + β*C` (row-major, transpose, transpose) (accessors)', function test( t ) { + var expected; + var cbuf; + var data; + var out; + var a; + var b; + var c; + + data = rtatb; + + a = toAccessorArray( copy( data.A ) ); + b = toAccessorArray( copy( data.B ) ); + cbuf = copy( data.C ); + c = toAccessorArray( cbuf ); + + expected = data.C_out; + + out = ggemm( 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.deepEqual( cbuf, expected, 'returns expected value' ); + t.end(); +}); + +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; + var a; + var b; + var c; + + data = ctatb; + + a = copy( data.A ); + b = copy( data.B ); + c = copy( data.C ); + + expected = data.C_out; + + out = ggemm( 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.deepEqual( out, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function performs the matrix-matrix operation `C = α*op(A)*op(B) + β*C` (column-major, transpose, transpose) (accessors)', function test( t ) { + var expected; + var cbuf; + var data; + var out; + var a; + var b; + var c; + + data = ctatb; + + a = toAccessorArray( copy( data.A ) ); + b = toAccessorArray( copy( data.B ) ); + cbuf = copy( data.C ); + c = toAccessorArray( cbuf ); + + expected = data.C_out; + + out = ggemm( 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.deepEqual( cbuf, expected, '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 = copy( data.A ); + b = copy( data.B ); + c = copy( data.C ); + + out = ggemm( 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 (row-major) (accessors)', function test( t ) { + var cbuf; + var data; + var out; + var a; + var b; + var c; + + data = rtatb; + + a = toAccessorArray( copy( data.A ) ); + b = toAccessorArray( copy( data.B ) ); + cbuf = copy( data.C ); + c = toAccessorArray( cbuf ); + + out = ggemm( 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 = copy( data.A ); + b = copy( data.B ); + c = copy( data.C ); + + out = ggemm( 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) (accessors)', function test( t ) { + var cbuf; + var data; + var out; + var a; + var b; + var c; + + data = ctatb; + + a = toAccessorArray( copy( data.A ) ); + b = toAccessorArray( copy( data.B ) ); + cbuf = copy( data.C ); + c = toAccessorArray( cbuf ); + + out = ggemm( 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 = copy( data.A ); + b = copy( data.B ); + c = copy( data.C ); + + expected = data.C; + + out = ggemm( 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 = ggemm( 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 (row-major) (accessors)', function test( t ) { + var expected; + var cbuf; + var data; + var out; + var a; + var b; + var c; + + data = rtatb; + + a = toAccessorArray( copy( data.A ) ); + b = toAccessorArray( copy( data.B ) ); + cbuf = copy( data.C ); + c = toAccessorArray( cbuf ); + + expected = data.C; + + out = ggemm( 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( cbuf, expected, 'returns expected value' ); + + out = ggemm( 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( cbuf, 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 = copy( data.A ); + b = copy( data.B ); + c = copy( data.C ); + + expected = data.C; + + out = ggemm( 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 = ggemm( 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) (accessors)', function test( t ) { + var expected; + var cbuf; + var data; + var out; + var a; + var b; + var c; + + data = ctatb; + + a = toAccessorArray( copy( data.A ) ); + b = toAccessorArray( copy( data.B ) ); + cbuf = copy( data.C ); + c = toAccessorArray( cbuf ); + + expected = data.C; + + out = ggemm( 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( cbuf, expected, 'returns expected value' ); + + out = ggemm( 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( cbuf, expected, 'returns expected value' ); + + t.end(); +}); + +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; + var a; + var b; + var c; + + data = rtatb; + + a = copy( data.A ); + b = copy( data.B ); + c = copy( data.C ); + + expected = data.C; + + out = ggemm( 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 = ggemm( 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 `α` or `K` is `0` and `β` is `1`, the function returns the third input matrix unchanged (row-major) (accessors)', function test( t ) { + var expected; + var cbuf; + var data; + var out; + var a; + var b; + var c; + + data = rtatb; + + a = toAccessorArray( copy( data.A ) ); + b = toAccessorArray( copy( data.B ) ); + cbuf = copy( data.C ); + c = toAccessorArray( cbuf ); + + expected = data.C; + + out = ggemm( 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( cbuf, expected, 'returns expected value' ); + + out = ggemm( 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( cbuf, expected, 'returns expected value' ); + + t.end(); +}); + +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; + var a; + var b; + var c; + + data = ctatb; + + a = copy( data.A ); + b = copy( data.B ); + c = copy( data.C ); + + expected = data.C; + + out = ggemm( 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 = ggemm( 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 `α` or `K` is `0` and `β` is `1`, the function returns the third input matrix unchanged (column-major) (accessors)', function test( t ) { + var expected; + var cbuf; + var data; + var out; + var a; + var b; + var c; + + data = ctatb; + + a = toAccessorArray( copy( data.A ) ); + b = toAccessorArray( copy( data.B ) ); + cbuf = copy( data.C ); + c = toAccessorArray( cbuf ); + + expected = data.C; + + out = ggemm( 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( cbuf, expected, 'returns expected value' ); + + out = ggemm( 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( cbuf, expected, 'returns expected value' ); + + 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 = copy( data.A ); + b = copy( data.B ); + c = copy( data.C ); + + expected = copy( c ); + gfill( c.length, 0.0, expected, 1 ); + + out = ggemm( 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 (row-major) (accessors)', function test( t ) { + var expected; + var cbuf; + var data; + var out; + var a; + var b; + var c; + + data = rtatb; + + a = toAccessorArray( copy( data.A ) ); + b = copy( data.B ); + cbuf = copy( data.C ); + c = toAccessorArray( cbuf ); + + expected = copy( c ); + gfill( c.length, 0.0, expected, 1 ); + + out = ggemm( 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( cbuf, 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 = copy( data.A ); + b = copy( data.B ); + c = copy( data.C ); + + expected = copy( c ); + gfill( c.length, 0.0, expected, 1 ); + + out = ggemm( 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) (accessors)', function test( t ) { + var expected; + var cbuf; + var data; + var out; + var a; + var b; + var c; + + data = ctatb; + + a = toAccessorArray( copy( data.A ) ); + b = copy( data.B ); + cbuf = copy( data.C ); + c = toAccessorArray( cbuf ); + + expected = copy( c ); + gfill( c.length, 0.0, expected, 1 ); + + out = ggemm( 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( cbuf, 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 = copy( data.A ); + b = copy( data.B ); + c = copy( data.C ); + + expected = gscal( c.length, 10.0, c, 1 ); + + out = ggemm( 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 `β` (row-major) (accessors)', function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = rtatb; + + a = toAccessorArray( copy( data.A ) ); + b = toAccessorArray( copy( data.B ) ); + c = toAccessorArray( copy( data.C ) ); + + expected = gscal( c.length, 10.0, c, 1 ); + + out = ggemm( 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( c, 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 = copy( data.A ); + b = copy( data.B ); + c = copy( data.C ); + + expected = gscal( c.length, 10.0, c, 1 ); + + out = ggemm( 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) (accessors)', function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = ctatb; + + a = toAccessorArray( copy( data.A ) ); + b = toAccessorArray( copy( data.B ) ); + c = toAccessorArray( copy( data.C ) ); + + expected = gscal( c.length, 10.0, c, 1 ); + + out = ggemm( 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( c, expected, 'returns expected value' ); + + t.end(); +}); diff --git a/lib/node_modules/@stdlib/blas/base/ggemm/test/test.ndarray.js b/lib/node_modules/@stdlib/blas/base/ggemm/test/test.ndarray.js new file mode 100644 index 000000000000..69dccc4d9e34 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/ggemm/test/test.ndarray.js @@ -0,0 +1,2947 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2025 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable max-len */ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var Float64Array = require( '@stdlib/array/float64' ); +var ones = require( '@stdlib/array/ones' ); +var filled = require( '@stdlib/array/filled' ); +var gscal = require( '@stdlib/blas/base/gscal' ); +var gfill = require( '@stdlib/blas/ext/base/gfill' ); +var toAccessorArray = require( '@stdlib/array/base/to-accessor-array' ); +var copy = require( '@stdlib/array/base/copy' ); +var ggemm = 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' ); + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof ggemm, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function has an arity of 19', function test( t ) { + t.strictEqual( ggemm.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() { + ggemm( value, data.transB, data.M, data.N, data.K, data.alpha, data.A, data.strideA1, data.strideA2, data.offsetA, data.B, data.strideB1, data.strideB2, data.offsetB, data.beta, data.C, data.strideC1, data.strideC2, data.offsetC ); + }; + } +}); + +tape( 'the function throws an error if provided an invalid first argument (accessors)', 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() { + ggemm( value, data.transB, data.M, data.N, data.K, data.alpha, toAccessorArray( data.A ), data.strideA1, data.strideA2, data.offsetA, toAccessorArray( data.B ), data.strideB1, data.strideB2, data.offsetB, data.beta, toAccessorArray( 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() { + ggemm( data.transA, value, data.M, data.N, data.K, data.alpha, data.A, data.strideA1, data.strideA2, data.offsetA, data.B, data.strideB1, data.strideB2, data.offsetB, data.beta, data.C, data.strideC1, data.strideC2, data.offsetC ); + }; + } +}); + +tape( 'the function throws an error if provided an invalid second argument (accessors)', 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() { + ggemm( data.transA, value, data.M, data.N, data.K, data.alpha, toAccessorArray( data.A ), data.strideA1, data.strideA2, data.offsetA, toAccessorArray( data.B ), data.strideB1, data.strideB2, data.offsetB, data.beta, toAccessorArray( 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() { + ggemm( data.transA, data.transB, value, data.N, data.K, data.alpha, data.A, data.strideA1, data.strideA2, data.offsetA, data.B, data.strideB1, data.strideB2, data.offsetB, data.beta, data.C, data.strideC1, data.strideC2, data.offsetC ); + }; + } +}); + +tape( 'the function throws an error if provided an invalid third argument (accessors)', 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() { + ggemm( data.transA, data.transB, value, data.N, data.K, data.alpha, toAccessorArray( data.A ), data.strideA1, data.strideA2, data.offsetA, toAccessorArray( data.B ), data.strideB1, data.strideB2, data.offsetB, data.beta, toAccessorArray( 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() { + ggemm( data.transA, data.transB, data.M, value, data.K, data.alpha, data.A, data.strideA1, data.strideA2, data.offsetA, data.B, data.strideB1, data.strideB2, data.offsetB, data.beta, data.C, data.strideC1, data.strideC2, data.offsetC ); + }; + } +}); + +tape( 'the function throws an error if provided an invalid fourth argument (accessors)', 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() { + ggemm( data.transA, data.transB, data.M, value, data.K, data.alpha, toAccessorArray( data.A ), data.strideA1, data.strideA2, data.offsetA, toAccessorArray( data.B ), data.strideB1, data.strideB2, data.offsetB, data.beta, toAccessorArray( 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() { + ggemm( data.transA, data.transB, data.M, data.N, value, data.alpha, data.A, data.strideA1, data.strideA2, data.offsetA, data.B, data.strideB1, data.strideB2, data.offsetB, data.beta, data.C, data.strideC1, data.strideC2, data.offsetC ); + }; + } +}); + +tape( 'the function throws an error if provided an invalid fifth argument (accessors)', 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() { + ggemm( data.transA, data.transB, data.M, data.N, value, data.alpha, toAccessorArray( data.A ), data.strideA1, data.strideA2, data.offsetA, toAccessorArray( data.B ), data.strideB1, data.strideB2, data.offsetB, data.beta, toAccessorArray( data.C ), data.strideC1, data.strideC2, data.offsetC ); + }; + } +}); + +tape( 'the function throws an error if provided an invalid seventeenth argument', function test( t ) { + var values; + var data; + var i; + + data = rarbrcntantb; + + values = [ + 0 + ]; + + 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() { + ggemm( data.transA, data.transB, data.M, data.N, data.K, data.alpha, data.A, data.strideA1, data.strideA2, data.offsetA, data.B, data.strideB1, data.strideB2, data.offsetB, data.beta, data.C, value, data.strideC2, data.offsetC ); + }; + } +}); + +tape( 'the function throws an error if provided an invalid seventeenth argument (accessors)', function test( t ) { + var values; + var data; + var i; + + data = rarbrcntantb; + + values = [ + 0 + ]; + + 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() { + ggemm( data.transA, data.transB, data.M, data.N, data.K, data.alpha, toAccessorArray( data.A ), data.strideA1, data.strideA2, data.offsetA, toAccessorArray( data.B ), data.strideB1, data.strideB2, data.offsetB, data.beta, toAccessorArray( data.C ), value, data.strideC2, data.offsetC ); + }; + } +}); + +tape( 'the function throws an error if provided an invalid eighteenth argument', function test( t ) { + var values; + var data; + var i; + + data = rarbrcntantb; + + values = [ + 0 + ]; + + 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() { + ggemm( data.transA, data.transB, data.M, data.N, data.K, data.alpha, data.A, data.strideA1, data.strideA2, data.offsetA, data.B, data.strideB1, data.strideB2, data.offsetB, data.beta, data.C, data.strideC1, value, data.offsetC ); + }; + } +}); + +tape( 'the function throws an error if provided an invalid eighteenth argument (accessors)', function test( t ) { + var values; + var data; + var i; + + data = rarbrcntantb; + + values = [ + 0 + ]; + + 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() { + ggemm( data.transA, data.transB, data.M, data.N, data.K, data.alpha, toAccessorArray( data.A ), data.strideA1, data.strideA2, data.offsetA, toAccessorArray( data.B ), data.strideB1, data.strideB2, data.offsetB, data.beta, toAccessorArray( data.C ), data.strideC1, value, data.offsetC ); + }; + } +}); + +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; + var a; + var b; + var c; + + data = cacbccntantb; + + a = copy( data.A ); + b = copy( data.B ); + c = copy( data.C ); + + expected = data.C_out; + + out = ggemm( 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.deepEqual( out, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function performs the matrix-matrix operation `C = α*op(A)*op(B) + β*C` (column_major, column_major, column_major, no-transpose, no-transpose) (accessors)', function test( t ) { + var expected; + var cbuf; + var data; + var out; + var a; + var b; + var c; + + data = cacbccntantb; + + a = toAccessorArray( copy( data.A ) ); + b = toAccessorArray( copy( data.B ) ); + cbuf = copy( data.C ); + c = toAccessorArray( cbuf ); + + expected = data.C_out; + + out = ggemm( 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.deepEqual( cbuf, expected, 'returns expected value' ); + t.end(); +}); + +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; + var a; + var b; + var c; + + data = cacbcctantb; + + a = copy( data.A ); + b = copy( data.B ); + c = copy( data.C ); + + expected = data.C_out; + + out = ggemm( 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.deepEqual( out, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function performs the matrix-matrix operation `C = α*op(A)*op(B) + β*C` (column_major, column_major, column_major, transpose, no-transpose) (accessors)', function test( t ) { + var expected; + var cbuf; + var data; + var out; + var a; + var b; + var c; + + data = cacbcctantb; + + a = toAccessorArray( copy( data.A ) ); + b = toAccessorArray( copy( data.B ) ); + cbuf = copy( data.C ); + c = toAccessorArray( cbuf ); + + expected = data.C_out; + + out = ggemm( 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.deepEqual( cbuf, expected, 'returns expected value' ); + t.end(); +}); + +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; + var a; + var b; + var c; + + data = cacbccntatb; + + a = copy( data.A ); + b = copy( data.B ); + c = copy( data.C ); + + expected = data.C_out; + + out = ggemm( 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.deepEqual( out, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function performs the matrix-matrix operation `C = α*op(A)*op(B) + β*C` (column_major, column_major, column_major, no-transpose, transpose) (accessors)', function test( t ) { + var expected; + var cbuf; + var data; + var out; + var a; + var b; + var c; + + data = cacbccntatb; + + a = toAccessorArray( copy( data.A ) ); + b = toAccessorArray( copy( data.B ) ); + cbuf = copy( data.C ); + c = toAccessorArray( cbuf ); + + expected = data.C_out; + + out = ggemm( 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.deepEqual( cbuf, expected, 'returns expected value' ); + t.end(); +}); + +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; + var a; + var b; + var c; + + data = cacbcctatb; + + a = copy( data.A ); + b = copy( data.B ); + c = copy( data.C ); + + expected = data.C_out; + + out = ggemm( 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.deepEqual( out, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function performs the matrix-matrix operation `C = α*op(A)*op(B) + β*C` (column_major, column_major, column_major, transpose, transpose) (accessors)', function test( t ) { + var expected; + var cbuf; + var data; + var out; + var a; + var b; + var c; + + data = cacbcctatb; + + a = toAccessorArray( copy( data.A ) ); + b = toAccessorArray( copy( data.B ) ); + cbuf = copy( data.C ); + c = toAccessorArray( cbuf ); + + expected = data.C_out; + + out = ggemm( 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.deepEqual( cbuf, expected, 'returns expected value' ); + t.end(); +}); + +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; + var a; + var b; + var c; + + data = cacbrcntantb; + + a = copy( data.A ); + b = copy( data.B ); + c = copy( data.C ); + + expected = data.C_out; + + out = ggemm( 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.deepEqual( out, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function performs the matrix-matrix operation `C = α*op(A)*op(B) + β*C` (column_major, column_major, row_major, no-transpose, no-transpose) (accessors)', function test( t ) { + var expected; + var cbuf; + var data; + var out; + var a; + var b; + var c; + + data = cacbrcntantb; + + a = toAccessorArray( copy( data.A ) ); + b = toAccessorArray( copy( data.B ) ); + cbuf = copy( data.C ); + c = toAccessorArray( cbuf ); + + expected = data.C_out; + + out = ggemm( 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.deepEqual( cbuf, expected, 'returns expected value' ); + t.end(); +}); + +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; + var a; + var b; + var c; + + data = cacbrctantb; + + a = copy( data.A ); + b = copy( data.B ); + c = copy( data.C ); + + expected = data.C_out; + + out = ggemm( 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.deepEqual( out, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function performs the matrix-matrix operation `C = α*op(A)*op(B) + β*C` (column_major, column_major, row_major, transpose, no-transpose) (accessors)', function test( t ) { + var expected; + var cbuf; + var data; + var out; + var a; + var b; + var c; + + data = cacbrctantb; + + a = toAccessorArray( copy( data.A ) ); + b = toAccessorArray( copy( data.B ) ); + cbuf = copy( data.C ); + c = toAccessorArray( cbuf ); + + expected = data.C_out; + + out = ggemm( 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.deepEqual( cbuf, expected, 'returns expected value' ); + t.end(); +}); + +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; + var a; + var b; + var c; + + data = cacbrcntatb; + + a = copy( data.A ); + b = copy( data.B ); + c = copy( data.C ); + + expected = data.C_out; + + out = ggemm( 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.deepEqual( out, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function performs the matrix-matrix operation `C = α*op(A)*op(B) + β*C` (column_major, column_major, row_major, no-transpose, transpose) (accessors)', function test( t ) { + var expected; + var cbuf; + var data; + var out; + var a; + var b; + var c; + + data = cacbrcntatb; + + a = toAccessorArray( copy( data.A ) ); + b = toAccessorArray( copy( data.B ) ); + cbuf = copy( data.C ); + c = toAccessorArray( cbuf ); + + expected = data.C_out; + + out = ggemm( 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.deepEqual( cbuf, expected, 'returns expected value' ); + t.end(); +}); + +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; + var a; + var b; + var c; + + data = cacbrctatb; + + a = copy( data.A ); + b = copy( data.B ); + c = copy( data.C ); + + expected = data.C_out; + + out = ggemm( 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.deepEqual( out, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function performs the matrix-matrix operation `C = α*op(A)*op(B) + β*C` (column_major, column_major, row_major, transpose, transpose) (accessors)', function test( t ) { + var expected; + var cbuf; + var data; + var out; + var a; + var b; + var c; + + data = cacbrctatb; + + a = toAccessorArray( copy( data.A ) ); + b = toAccessorArray( copy( data.B ) ); + cbuf = copy( data.C ); + c = toAccessorArray( cbuf ); + + expected = data.C_out; + + out = ggemm( 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.deepEqual( cbuf, expected, 'returns expected value' ); + t.end(); +}); + +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; + var a; + var b; + var c; + + data = carbccntantb; + + a = copy( data.A ); + b = copy( data.B ); + c = copy( data.C ); + + expected = data.C_out; + + out = ggemm( 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.deepEqual( out, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function performs the matrix-matrix operation `C = α*op(A)*op(B) + β*C` (column_major, row_major, column_major, no-transpose, no-transpose) (accessors)', function test( t ) { + var expected; + var cbuf; + var data; + var out; + var a; + var b; + var c; + + data = carbccntantb; + + a = toAccessorArray( copy( data.A ) ); + b = toAccessorArray( copy( data.B ) ); + cbuf = copy( data.C ); + c = toAccessorArray( cbuf ); + + expected = data.C_out; + + out = ggemm( 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.deepEqual( cbuf, expected, 'returns expected value' ); + t.end(); +}); + +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; + var a; + var b; + var c; + + data = carbcctantb; + + a = copy( data.A ); + b = copy( data.B ); + c = copy( data.C ); + + expected = data.C_out; + + out = ggemm( 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.deepEqual( out, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function performs the matrix-matrix operation `C = α*op(A)*op(B) + β*C` (column_major, row_major, column_major, transpose, no-transpose) (accessors)', function test( t ) { + var expected; + var cbuf; + var data; + var out; + var a; + var b; + var c; + + data = carbcctantb; + + a = toAccessorArray( copy( data.A ) ); + b = toAccessorArray( copy( data.B ) ); + cbuf = copy( data.C ); + c = toAccessorArray( cbuf ); + + expected = data.C_out; + + out = ggemm( 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.deepEqual( cbuf, expected, 'returns expected value' ); + t.end(); +}); + +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; + var a; + var b; + var c; + + data = carbccntatb; + + a = copy( data.A ); + b = copy( data.B ); + c = copy( data.C ); + + expected = data.C_out; + + out = ggemm( 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.deepEqual( out, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function performs the matrix-matrix operation `C = α*op(A)*op(B) + β*C` (column_major, row_major, column_major, no-transpose, transpose) (accessors)', function test( t ) { + var expected; + var cbuf; + var data; + var out; + var a; + var b; + var c; + + data = carbccntatb; + + a = toAccessorArray( copy( data.A ) ); + b = toAccessorArray( copy( data.B ) ); + cbuf = copy( data.C ); + c = toAccessorArray( cbuf ); + + expected = data.C_out; + + out = ggemm( 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.deepEqual( cbuf, expected, 'returns expected value' ); + t.end(); +}); + +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; + var a; + var b; + var c; + + data = carbcctatb; + + a = copy( data.A ); + b = copy( data.B ); + c = copy( data.C ); + + expected = data.C_out; + + out = ggemm( 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.deepEqual( out, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function performs the matrix-matrix operation `C = α*op(A)*op(B) + β*C` (column_major, row_major, column_major, transpose, transpose) (accessors)', function test( t ) { + var expected; + var cbuf; + var data; + var out; + var a; + var b; + var c; + + data = carbcctatb; + + a = toAccessorArray( copy( data.A ) ); + b = toAccessorArray( copy( data.B ) ); + cbuf = copy( data.C ); + c = toAccessorArray( cbuf ); + + expected = data.C_out; + + out = ggemm( 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.deepEqual( cbuf, expected, 'returns expected value' ); + t.end(); +}); + +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; + var a; + var b; + var c; + + data = carbrcntantb; + + a = copy( data.A ); + b = copy( data.B ); + c = copy( data.C ); + + expected = data.C_out; + + out = ggemm( 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.deepEqual( out, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function performs the matrix-matrix operation `C = α*op(A)*op(B) + β*C` (column_major, row_major, row_major, no-transpose, no-transpose) (accessors)', function test( t ) { + var expected; + var cbuf; + var data; + var out; + var a; + var b; + var c; + + data = carbrcntantb; + + a = toAccessorArray( copy( data.A ) ); + b = toAccessorArray( copy( data.B ) ); + cbuf = copy( data.C ); + c = toAccessorArray( cbuf ); + + expected = data.C_out; + + out = ggemm( 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.deepEqual( cbuf, expected, 'returns expected value' ); + t.end(); +}); + +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; + var a; + var b; + var c; + + data = carbrctantb; + + a = copy( data.A ); + b = copy( data.B ); + c = copy( data.C ); + + expected = data.C_out; + + out = ggemm( 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.deepEqual( out, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function performs the matrix-matrix operation `C = α*op(A)*op(B) + β*C` (column_major, row_major, row_major, transpose, no-transpose) (accessors)', function test( t ) { + var expected; + var cbuf; + var data; + var out; + var a; + var b; + var c; + + data = carbrctantb; + + a = toAccessorArray( copy( data.A ) ); + b = toAccessorArray( copy( data.B ) ); + cbuf = copy( data.C ); + c = toAccessorArray( cbuf ); + + expected = data.C_out; + + out = ggemm( 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.deepEqual( cbuf, expected, 'returns expected value' ); + t.end(); +}); + +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; + var a; + var b; + var c; + + data = carbrcntatb; + + a = copy( data.A ); + b = copy( data.B ); + c = copy( data.C ); + + expected = data.C_out; + + out = ggemm( 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.deepEqual( out, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function performs the matrix-matrix operation `C = α*op(A)*op(B) + β*C` (column_major, row_major, row_major, no-transpose, transpose) (accessors)', function test( t ) { + var expected; + var cbuf; + var data; + var out; + var a; + var b; + var c; + + data = carbrcntatb; + + a = toAccessorArray( copy( data.A ) ); + b = toAccessorArray( copy( data.B ) ); + cbuf = copy( data.C ); + c = toAccessorArray( cbuf ); + + expected = data.C_out; + + out = ggemm( 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.deepEqual( cbuf, expected, 'returns expected value' ); + t.end(); +}); + +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; + var a; + var b; + var c; + + data = carbrctatb; + + a = copy( data.A ); + b = copy( data.B ); + c = copy( data.C ); + + expected = data.C_out; + + out = ggemm( 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.deepEqual( out, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function performs the matrix-matrix operation `C = α*op(A)*op(B) + β*C` (column_major, row_major, row_major, transpose, transpose) (accessors)', function test( t ) { + var expected; + var cbuf; + var data; + var out; + var a; + var b; + var c; + + data = carbrctatb; + + a = toAccessorArray( copy( data.A ) ); + b = toAccessorArray( copy( data.B ) ); + cbuf = copy( data.C ); + c = toAccessorArray( cbuf ); + + expected = data.C_out; + + out = ggemm( 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.deepEqual( cbuf, expected, 'returns expected value' ); + t.end(); +}); + +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; + var a; + var b; + var c; + + data = racbccntantb; + + a = copy( data.A ); + b = copy( data.B ); + c = copy( data.C ); + + expected = data.C_out; + + out = ggemm( 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.deepEqual( out, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function performs the matrix-matrix operation `C = α*op(A)*op(B) + β*C` (row_major, column_major, column_major, no-transpose, no-transpose) (accessors)', function test( t ) { + var expected; + var cbuf; + var data; + var out; + var a; + var b; + var c; + + data = racbccntantb; + + a = toAccessorArray( copy( data.A ) ); + b = toAccessorArray( copy( data.B ) ); + cbuf = copy( data.C ); + c = toAccessorArray( cbuf ); + + expected = data.C_out; + + out = ggemm( 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.deepEqual( cbuf, expected, 'returns expected value' ); + t.end(); +}); + +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; + var a; + var b; + var c; + + data = racbcctantb; + + a = copy( data.A ); + b = copy( data.B ); + c = copy( data.C ); + + expected = data.C_out; + + out = ggemm( 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.deepEqual( out, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function performs the matrix-matrix operation `C = α*op(A)*op(B) + β*C` (row_major, column_major, column_major, transpose, no-transpose) (accessors)', function test( t ) { + var expected; + var cbuf; + var data; + var out; + var a; + var b; + var c; + + data = racbcctantb; + + a = toAccessorArray( copy( data.A ) ); + b = toAccessorArray( copy( data.B ) ); + cbuf = copy( data.C ); + c = toAccessorArray( cbuf ); + + expected = data.C_out; + + out = ggemm( 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.deepEqual( cbuf, expected, 'returns expected value' ); + t.end(); +}); + +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; + var a; + var b; + var c; + + data = racbccntatb; + + a = copy( data.A ); + b = copy( data.B ); + c = copy( data.C ); + + expected = data.C_out; + + out = ggemm( 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.deepEqual( out, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function performs the matrix-matrix operation `C = α*op(A)*op(B) + β*C` (row_major, column_major, column_major, no-transpose, transpose) (accessors)', function test( t ) { + var expected; + var cbuf; + var data; + var out; + var a; + var b; + var c; + + data = racbccntatb; + + a = toAccessorArray( copy( data.A ) ); + b = toAccessorArray( copy( data.B ) ); + cbuf = copy( data.C ); + c = toAccessorArray( cbuf ); + + expected = data.C_out; + + out = ggemm( 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.deepEqual( cbuf, expected, 'returns expected value' ); + t.end(); +}); + +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; + var a; + var b; + var c; + + data = racbcctatb; + + a = copy( data.A ); + b = copy( data.B ); + c = copy( data.C ); + + expected = data.C_out; + + out = ggemm( 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.deepEqual( out, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function performs the matrix-matrix operation `C = α*op(A)*op(B) + β*C` (row_major, column_major, column_major, transpose, transpose) (accessors)', function test( t ) { + var expected; + var cbuf; + var data; + var out; + var a; + var b; + var c; + + data = racbcctatb; + + a = toAccessorArray( copy( data.A ) ); + b = toAccessorArray( copy( data.B ) ); + cbuf = copy( data.C ); + c = toAccessorArray( cbuf ); + + expected = data.C_out; + + out = ggemm( 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.deepEqual( cbuf, expected, 'returns expected value' ); + t.end(); +}); + +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; + var a; + var b; + var c; + + data = racbrcntantb; + + a = copy( data.A ); + b = copy( data.B ); + c = copy( data.C ); + + expected = data.C_out; + + out = ggemm( 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.deepEqual( out, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function performs the matrix-matrix operation `C = α*op(A)*op(B) + β*C` (row_major, column_major, row_major, no-transpose, no-transpose) (accessors)', function test( t ) { + var expected; + var cbuf; + var data; + var out; + var a; + var b; + var c; + + data = racbrcntantb; + + a = toAccessorArray( copy( data.A ) ); + b = toAccessorArray( copy( data.B ) ); + cbuf = copy( data.C ); + c = toAccessorArray( cbuf ); + + expected = data.C_out; + + out = ggemm( 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.deepEqual( cbuf, expected, 'returns expected value' ); + t.end(); +}); + +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; + var a; + var b; + var c; + + data = racbrctantb; + + a = copy( data.A ); + b = copy( data.B ); + c = copy( data.C ); + + expected = data.C_out; + + out = ggemm( 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.deepEqual( out, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function performs the matrix-matrix operation `C = α*op(A)*op(B) + β*C` (row_major, column_major, row_major, transpose, no-transpose) (accessors)', function test( t ) { + var expected; + var cbuf; + var data; + var out; + var a; + var b; + var c; + + data = racbrctantb; + + a = toAccessorArray( copy( data.A ) ); + b = toAccessorArray( copy( data.B ) ); + cbuf = copy( data.C ); + c = toAccessorArray( cbuf ); + + expected = data.C_out; + + out = ggemm( 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.deepEqual( cbuf, expected, 'returns expected value' ); + t.end(); +}); + +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; + var a; + var b; + var c; + + data = racbrcntatb; + + a = copy( data.A ); + b = copy( data.B ); + c = copy( data.C ); + + expected = data.C_out; + + out = ggemm( 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.deepEqual( out, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function performs the matrix-matrix operation `C = α*op(A)*op(B) + β*C` (row_major, column_major, row_major, no-transpose, transpose) (accessors)', function test( t ) { + var expected; + var cbuf; + var data; + var out; + var a; + var b; + var c; + + data = racbrcntatb; + + a = toAccessorArray( copy( data.A ) ); + b = toAccessorArray( copy( data.B ) ); + cbuf = copy( data.C ); + c = toAccessorArray( cbuf ); + + expected = data.C_out; + + out = ggemm( 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.deepEqual( cbuf, expected, 'returns expected value' ); + t.end(); +}); + +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; + var a; + var b; + var c; + + data = racbrctatb; + + a = copy( data.A ); + b = copy( data.B ); + c = copy( data.C ); + + expected = data.C_out; + + out = ggemm( 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.deepEqual( out, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function performs the matrix-matrix operation `C = α*op(A)*op(B) + β*C` (row_major, column_major, row_major, transpose, transpose) (accessors)', function test( t ) { + var expected; + var cbuf; + var data; + var out; + var a; + var b; + var c; + + data = racbrctatb; + + a = toAccessorArray( copy( data.A ) ); + b = toAccessorArray( copy( data.B ) ); + cbuf = copy( data.C ); + c = toAccessorArray( cbuf ); + + expected = data.C_out; + + out = ggemm( 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.deepEqual( cbuf, expected, 'returns expected value' ); + t.end(); +}); + +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; + var a; + var b; + var c; + + data = rarbccntantb; + + a = copy( data.A ); + b = copy( data.B ); + c = copy( data.C ); + + expected = data.C_out; + + out = ggemm( 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.deepEqual( out, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function performs the matrix-matrix operation `C = α*op(A)*op(B) + β*C` (row_major, row_major, column_major, no-transpose, no-transpose) (accessors)', function test( t ) { + var expected; + var cbuf; + var data; + var out; + var a; + var b; + var c; + + data = rarbccntantb; + + a = toAccessorArray( copy( data.A ) ); + b = toAccessorArray( copy( data.B ) ); + cbuf = copy( data.C ); + c = toAccessorArray( cbuf ); + + expected = data.C_out; + + out = ggemm( 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.deepEqual( cbuf, expected, 'returns expected value' ); + t.end(); +}); + +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; + var a; + var b; + var c; + + data = rarbcctantb; + + a = copy( data.A ); + b = copy( data.B ); + c = copy( data.C ); + + expected = data.C_out; + + out = ggemm( 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.deepEqual( out, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function performs the matrix-matrix operation `C = α*op(A)*op(B) + β*C` (row_major, row_major, column_major, transpose, no-transpose) (accessors)', function test( t ) { + var expected; + var cbuf; + var data; + var out; + var a; + var b; + var c; + + data = rarbcctantb; + + a = toAccessorArray( copy( data.A ) ); + b = toAccessorArray( copy( data.B ) ); + cbuf = copy( data.C ); + c = toAccessorArray( cbuf ); + + expected = data.C_out; + + out = ggemm( 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.deepEqual( cbuf, expected, 'returns expected value' ); + t.end(); +}); + +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; + var a; + var b; + var c; + + data = rarbccntatb; + + a = copy( data.A ); + b = copy( data.B ); + c = copy( data.C ); + + expected = data.C_out; + + out = ggemm( 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.deepEqual( out, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function performs the matrix-matrix operation `C = α*op(A)*op(B) + β*C` (row_major, row_major, column_major, no-transpose, transpose) (accessors)', function test( t ) { + var expected; + var cbuf; + var data; + var out; + var a; + var b; + var c; + + data = rarbccntatb; + + a = toAccessorArray( copy( data.A ) ); + b = toAccessorArray( copy( data.B ) ); + cbuf = copy( data.C ); + c = toAccessorArray( cbuf ); + + expected = data.C_out; + + out = ggemm( 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.deepEqual( cbuf, expected, 'returns expected value' ); + t.end(); +}); + +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; + var a; + var b; + var c; + + data = rarbcctatb; + + a = copy( data.A ); + b = copy( data.B ); + c = copy( data.C ); + + expected = data.C_out; + + out = ggemm( 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.deepEqual( out, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function performs the matrix-matrix operation `C = α*op(A)*op(B) + β*C` (row_major, row_major, column_major, transpose, transpose) (accessors)', function test( t ) { + var expected; + var cbuf; + var data; + var out; + var a; + var b; + var c; + + data = rarbcctatb; + + a = toAccessorArray( copy( data.A ) ); + b = toAccessorArray( copy( data.B ) ); + cbuf = copy( data.C ); + c = toAccessorArray( cbuf ); + + expected = data.C_out; + + out = ggemm( 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.deepEqual( cbuf, expected, 'returns expected value' ); + t.end(); +}); + +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; + var a; + var b; + var c; + + data = rarbrcntantb; + + a = copy( data.A ); + b = copy( data.B ); + c = copy( data.C ); + + expected = data.C_out; + + out = ggemm( 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.deepEqual( out, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function performs the matrix-matrix operation `C = α*op(A)*op(B) + β*C` (row_major, row_major, row_major, no-transpose, no-transpose) (accessors)', function test( t ) { + var expected; + var cbuf; + var data; + var out; + var a; + var b; + var c; + + data = rarbrcntantb; + + a = toAccessorArray( copy( data.A ) ); + b = toAccessorArray( copy( data.B ) ); + cbuf = copy( data.C ); + c = toAccessorArray( cbuf ); + + expected = data.C_out; + + out = ggemm( 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.deepEqual( cbuf, expected, 'returns expected value' ); + t.end(); +}); + +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; + var a; + var b; + var c; + + data = rarbrctantb; + + a = copy( data.A ); + b = copy( data.B ); + c = copy( data.C ); + + expected = data.C_out; + + out = ggemm( 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.deepEqual( out, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function performs the matrix-matrix operation `C = α*op(A)*op(B) + β*C` (row_major, row_major, row_major, transpose, no-transpose) (accessors)', function test( t ) { + var expected; + var cbuf; + var data; + var out; + var a; + var b; + var c; + + data = rarbrctantb; + + a = toAccessorArray( copy( data.A ) ); + b = toAccessorArray( copy( data.B ) ); + cbuf = copy( data.C ); + c = toAccessorArray( cbuf ); + + expected = data.C_out; + + out = ggemm( 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.deepEqual( cbuf, expected, 'returns expected value' ); + t.end(); +}); + +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; + var a; + var b; + var c; + + data = rarbrcntatb; + + a = copy( data.A ); + b = copy( data.B ); + c = copy( data.C ); + + expected = data.C_out; + + out = ggemm( 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.deepEqual( out, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function performs the matrix-matrix operation `C = α*op(A)*op(B) + β*C` (row_major, row_major, row_major, no-transpose, transpose) (accessors)', function test( t ) { + var expected; + var cbuf; + var data; + var out; + var a; + var b; + var c; + + data = rarbrcntatb; + + a = toAccessorArray( copy( data.A ) ); + b = toAccessorArray( copy( data.B ) ); + cbuf = copy( data.C ); + c = toAccessorArray( cbuf ); + + expected = data.C_out; + + out = ggemm( 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.deepEqual( cbuf, expected, 'returns expected value' ); + t.end(); +}); + +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; + var a; + var b; + var c; + + data = rarbrctatb; + + a = copy( data.A ); + b = copy( data.B ); + c = copy( data.C ); + + expected = data.C_out; + + out = ggemm( 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.deepEqual( out, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function performs the matrix-matrix operation `C = α*op(A)*op(B) + β*C` (row_major, row_major, row_major, transpose, transpose) (accessors)', function test( t ) { + var expected; + var cbuf; + var data; + var out; + var a; + var b; + var c; + + data = rarbrctatb; + + a = toAccessorArray( copy( data.A ) ); + b = toAccessorArray( copy( data.B ) ); + cbuf = copy( data.C ); + c = toAccessorArray( cbuf ); + + expected = data.C_out; + + out = ggemm( 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.deepEqual( cbuf, expected, '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 = copy( data.A ); + b = copy( data.B ); + c = copy( data.C ); + + out = ggemm( 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( 'the function returns a reference to the third input matrix (accessors)', function test( t ) { + var cbuf; + var data; + var out; + var a; + var b; + var c; + + data = rarbrcntantb; + + a = toAccessorArray( copy( data.A ) ); + b = toAccessorArray( copy( data.B ) ); + cbuf = copy( data.C ); + c = toAccessorArray( cbuf ); + + out = ggemm( 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 = copy( data.A ); + b = copy( data.B ); + c = copy( data.C ); + + expected = data.C; + + out = ggemm( 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 = ggemm( 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 either `M` or `N` is `0`, the function returns the third input matrix unchanged (accessors)', function test( t ) { + var expected; + var cbuf; + var data; + var out; + var a; + var b; + var c; + + data = rarbrctatb; + + a = toAccessorArray( copy( data.A ) ); + b = toAccessorArray( copy( data.B ) ); + cbuf = copy( data.C ); + c = toAccessorArray( cbuf ); + + expected = data.C; + + out = ggemm( 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( cbuf, expected, 'returns expected value' ); + + out = ggemm( 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( cbuf, expected, 'returns expected value' ); + + t.end(); +}); + +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; + var a; + var b; + var c; + + data = rarbrctatb; + + a = copy( data.A ); + b = copy( data.B ); + c = copy( data.C ); + + expected = data.C; + + out = ggemm( 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 = ggemm( 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( 'if `α` or `K` is `0` and `β` is `1`, the function returns the third input matrix unchanged (accessors)', function test( t ) { + var expected; + var cbuf; + var data; + var out; + var a; + var b; + var c; + + data = rarbrctatb; + + a = toAccessorArray( copy( data.A ) ); + b = toAccessorArray( copy( data.B ) ); + cbuf = copy( data.C ); + c = toAccessorArray( cbuf ); + + expected = data.C; + + out = ggemm( 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( cbuf, expected, 'returns expected value' ); + + out = ggemm( 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( cbuf, expected, 'returns expected value' ); + + 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 = copy( data.A ); + b = copy( data.B ); + c = copy( data.C ); + + expected = copy( c ); + gfill( c.length, 0.0, expected, 1 ); + + out = ggemm( 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 `0`, the function returns the third input matrix filled with zeros (accessors)', function test( t ) { + var expected; + var cbuf; + var data; + var out; + var a; + var b; + var c; + + data = rarbrctatb; + + a = toAccessorArray( copy( data.A ) ); + b = toAccessorArray( copy( data.B ) ); + cbuf = copy( data.C ); + c = toAccessorArray( cbuf ); + + expected = copy( c ); + gfill( c.length, 0.0, expected, 1 ); + + out = ggemm( 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( cbuf, 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 = copy( data.A ); + b = copy( data.B ); + c = copy( data.C ); + + expected = gscal( c.length, 10.0, c, 1 ); + + out = ggemm( 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( 'if `α` is `0` and `β` is neither `0` nor `1`, the function returns the third input matrix scaled by `β` (accessors)', function test( t ) { + var expected; + var cbuf; + var data; + var out; + var a; + var b; + var c; + + data = rarbrctatb; + + a = toAccessorArray( copy( data.A ) ); + b = toAccessorArray( copy( data.B ) ); + cbuf = copy( data.C ); + c = toAccessorArray( cbuf ); + + expected = gscal( c.length, 10.0, c, 1 ); + + out = ggemm( 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( c, 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; + var out; + var a; + var b; + var c; + + data = carbcctantbsa1sa2; + + a = copy( data.A ); + b = copy( data.B ); + c = copy( data.C ); + + expected = data.C_out; + + out = ggemm( 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.deepEqual( out, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports specifying the strides of the first and second dimensions of `A` (accessors)', function test( t ) { + var expected; + var cbuf; + var data; + var out; + var a; + var b; + var c; + + data = carbcctantbsa1sa2; + + a = toAccessorArray( copy( data.A ) ); + b = toAccessorArray( copy( data.B ) ); + cbuf = copy( data.C ); + c = toAccessorArray( cbuf ); + + expected = data.C_out; + + out = ggemm( 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.deepEqual( cbuf, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports a negative stride for the first dimension of `A`', function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = carbcctantbsa1nsa2; + + a = copy( data.A ); + b = copy( data.B ); + c = copy( data.C ); + + expected = data.C_out; + + out = ggemm( 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.deepEqual( out, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports a negative stride for the first dimension of `A` (accessors)', function test( t ) { + var expected; + var cbuf; + var data; + var out; + var a; + var b; + var c; + + data = carbcctantbsa1nsa2; + + a = toAccessorArray( copy( data.A ) ); + b = toAccessorArray( copy( data.B ) ); + cbuf = copy( data.C ); + c = toAccessorArray( cbuf ); + + expected = data.C_out; + + out = ggemm( 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.deepEqual( cbuf, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports a negative stride for the second dimension of `A`', function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = carbcctantbsa1sa2n; + + a = copy( data.A ); + b = copy( data.B ); + c = copy( data.C ); + + expected = data.C_out; + + out = ggemm( 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.deepEqual( out, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports a negative stride for the second dimension of `A` (accessors)', function test( t ) { + var expected; + var cbuf; + var data; + var out; + var a; + var b; + var c; + + data = carbcctantbsa1sa2n; + + a = toAccessorArray( copy( data.A ) ); + b = toAccessorArray( copy( data.B ) ); + cbuf = copy( data.C ); + c = toAccessorArray( cbuf ); + + expected = data.C_out; + + out = ggemm( 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.deepEqual( cbuf, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports negative strides for `A`', function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = carbcctantbsa1nsa2n; + + a = copy( data.A ); + b = copy( data.B ); + c = copy( data.C ); + + expected = data.C_out; + + out = ggemm( 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.deepEqual( out, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports negative strides for `A` (accessors)', function test( t ) { + var expected; + var cbuf; + var data; + var out; + var a; + var b; + var c; + + data = carbcctantbsa1nsa2n; + + a = toAccessorArray( copy( data.A ) ); + b = toAccessorArray( copy( data.B ) ); + cbuf = copy( data.C ); + c = toAccessorArray( cbuf ); + + expected = data.C_out; + + out = ggemm( 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.deepEqual( cbuf, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports specifying an offset parameter for `A`', function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = rarbrcntantboa; + + a = copy( data.A ); + b = copy( data.B ); + c = copy( data.C ); + + expected = data.C_out; + + out = ggemm( 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.deepEqual( out, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports specifying an offset parameter for `A` (accessors)', function test( t ) { + var expected; + var cbuf; + var data; + var out; + var a; + var b; + var c; + + data = rarbrcntantboa; + + a = toAccessorArray( copy( data.A ) ); + b = toAccessorArray( copy( data.B ) ); + cbuf = copy( data.C ); + c = toAccessorArray( cbuf ); + + expected = data.C_out; + + out = ggemm( 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.deepEqual( cbuf, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports specifying the strides of the first and second dimensions of `B`', function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = rarbcctantbsb1sb2; + + a = copy( data.A ); + b = copy( data.B ); + c = copy( data.C ); + + expected = data.C_out; + + out = ggemm( 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.deepEqual( out, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports specifying the strides of the first and second dimensions of `B` (accessors)', function test( t ) { + var expected; + var cbuf; + var data; + var out; + var a; + var b; + var c; + + data = rarbcctantbsb1sb2; + + a = toAccessorArray( copy( data.A ) ); + b = toAccessorArray( copy( data.B ) ); + cbuf = copy( data.C ); + c = toAccessorArray( cbuf ); + + expected = data.C_out; + + out = ggemm( 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.deepEqual( cbuf, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports a negative stride for the first dimension of `B`', function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = rarbcctantbsb1nsb2; + + a = copy( data.A ); + b = copy( data.B ); + c = copy( data.C ); + + expected = data.C_out; + + out = ggemm( 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.deepEqual( out, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports a negative stride for the first dimension of `B` (accessors)', function test( t ) { + var expected; + var cbuf; + var data; + var out; + var a; + var b; + var c; + + data = rarbcctantbsb1nsb2; + + a = toAccessorArray( copy( data.A ) ); + b = toAccessorArray( copy( data.B ) ); + cbuf = copy( data.C ); + c = toAccessorArray( cbuf ); + + expected = data.C_out; + + out = ggemm( 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.deepEqual( cbuf, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports a negative stride for the second dimension of `B`', function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = rarbcctantbsb1sb2n; + + a = copy( data.A ); + b = copy( data.B ); + c = copy( data.C ); + + expected = data.C_out; + + out = ggemm( 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.deepEqual( out, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports a negative stride for the second dimension of `B` (accessors)', function test( t ) { + var expected; + var cbuf; + var data; + var out; + var a; + var b; + var c; + + data = rarbcctantbsb1sb2n; + + a = toAccessorArray( copy( data.A ) ); + b = toAccessorArray( copy( data.B ) ); + cbuf = copy( data.C ); + c = toAccessorArray( cbuf ); + + expected = data.C_out; + + out = ggemm( 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.deepEqual( cbuf, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports negative strides for `B`', function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = rarbcctantbsb1nsb2n; + + a = copy( data.A ); + b = copy( data.B ); + c = copy( data.C ); + + expected = data.C_out; + + out = ggemm( 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.deepEqual( out, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports negative strides for `B` (accessors)', function test( t ) { + var expected; + var cbuf; + var data; + var out; + var a; + var b; + var c; + + data = rarbcctantbsb1nsb2n; + + a = toAccessorArray( copy( data.A ) ); + b = toAccessorArray( copy( data.B ) ); + cbuf = copy( data.C ); + c = toAccessorArray( cbuf ); + + expected = data.C_out; + + out = ggemm( 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.deepEqual( cbuf, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports specifying an offset parameter for `B`', function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = rarbrcntantbob; + + a = copy( data.A ); + b = copy( data.B ); + c = copy( data.C ); + + expected = data.C_out; + + out = ggemm( 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.deepEqual( out, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports specifying an offset parameter for `B` (accessors)', function test( t ) { + var expected; + var cbuf; + var data; + var out; + var a; + var b; + var c; + + data = rarbrcntantbob; + + a = toAccessorArray( copy( data.A ) ); + b = toAccessorArray( copy( data.B ) ); + cbuf = copy( data.C ); + c = toAccessorArray( cbuf ); + + expected = data.C_out; + + out = ggemm( 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.deepEqual( cbuf, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports specifying the strides of the first and second dimensions of `C`', function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = racbrcntatbsc1sc2; + + a = copy( data.A ); + b = copy( data.B ); + c = copy( data.C ); + + expected = data.C_out; + + out = ggemm( 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.deepEqual( out, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports specifying the strides of the first and second dimensions of `C` (accessors)', function test( t ) { + var expected; + var cbuf; + var data; + var out; + var a; + var b; + var c; + + data = racbrcntatbsc1sc2; + + a = toAccessorArray( copy( data.A ) ); + b = toAccessorArray( copy( data.B ) ); + cbuf = copy( data.C ); + c = toAccessorArray( cbuf ); + + expected = data.C_out; + + out = ggemm( 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.deepEqual( cbuf, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports a negative stride for the first dimension of `C`', function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = racbrcntatbsc1nsc2; + + a = copy( data.A ); + b = copy( data.B ); + c = copy( data.C ); + + expected = data.C_out; + + out = ggemm( 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.deepEqual( out, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports a negative stride for the first dimension of `C` (accessors)', function test( t ) { + var expected; + var cbuf; + var data; + var out; + var a; + var b; + var c; + + data = racbrcntatbsc1nsc2; + + a = toAccessorArray( copy( data.A ) ); + b = toAccessorArray( copy( data.B ) ); + cbuf = copy( data.C ); + c = toAccessorArray( cbuf ); + + expected = data.C_out; + + out = ggemm( 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.deepEqual( cbuf, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports a negative stride for the second dimension of `C`', function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = racbrcntatbsc1sc2n; + + a = copy( data.A ); + b = copy( data.B ); + c = copy( data.C ); + + expected = data.C_out; + + out = ggemm( 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.deepEqual( out, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports a negative stride for the second dimension of `C` (accessors)', function test( t ) { + var expected; + var cbuf; + var data; + var out; + var a; + var b; + var c; + + data = racbrcntatbsc1sc2n; + + a = toAccessorArray( copy( data.A ) ); + b = toAccessorArray( copy( data.B ) ); + cbuf = copy( data.C ); + c = toAccessorArray( cbuf ); + + expected = data.C_out; + + out = ggemm( 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.deepEqual( cbuf, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports negative strides for `C`', function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = racbrcntatbsc1nsc2n; + + a = copy( data.A ); + b = copy( data.B ); + c = copy( data.C ); + + expected = data.C_out; + + out = ggemm( 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.deepEqual( out, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports negative strides for `C` (accessors)', function test( t ) { + var expected; + var cbuf; + var data; + var out; + var a; + var b; + var c; + + data = racbrcntatbsc1nsc2n; + + a = toAccessorArray( copy( data.A ) ); + b = toAccessorArray( copy( data.B ) ); + cbuf = copy( data.C ); + c = toAccessorArray( cbuf ); + + expected = data.C_out; + + out = ggemm( 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.deepEqual( cbuf, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports specifying an offset parameter for `C`', function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = rarbrcntantboc; + + a = copy( data.A ); + b = copy( data.B ); + c = copy( data.C ); + + expected = data.C_out; + + out = ggemm( 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.deepEqual( out, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports specifying an offset parameter for `C` (accessors)', function test( t ) { + var expected; + var cbuf; + var data; + var out; + var a; + var b; + var c; + + data = rarbrcntantboc; + + a = toAccessorArray( copy( data.A ) ); + b = toAccessorArray( copy( data.B ) ); + cbuf = copy( data.C ); + c = toAccessorArray( cbuf ); + + expected = data.C_out; + + out = ggemm( 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.deepEqual( cbuf, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports complex access patterns', function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = cap; + + a = copy( data.A ); + b = copy( data.B ); + c = copy( data.C ); + + expected = data.C_out; + + out = ggemm( 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.deepEqual( out, expected, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports complex access patterns (accessors)', function test( t ) { + var expected; + var cbuf; + var data; + var out; + var a; + var b; + var c; + + data = cap; + + a = toAccessorArray( copy( data.A ) ); + b = toAccessorArray( copy( data.B ) ); + cbuf = copy( data.C ); + c = toAccessorArray( cbuf ); + + expected = data.C_out; + + out = ggemm( 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.deepEqual( cbuf, expected, '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, 'float64' ); + b = ones( a.length, 'float64' ); + c = new Float64Array( a.length ); + + expected = filled( N, a.length, 'float64' ); + + out = ggemm( '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, 'float64' ); + b = ones( a.length, 'float64' ); + c = new Float64Array( a.length ); + + expected = filled( N, a.length, 'float64' ); + + out = ggemm( '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(); +});