diff --git a/lib/node_modules/@stdlib/blas/base/dgemm/README.md b/lib/node_modules/@stdlib/blas/base/dgemm/README.md index b8bd1feb27e0..c3f5d62eb58c 100644 --- a/lib/node_modules/@stdlib/blas/base/dgemm/README.md +++ b/lib/node_modules/@stdlib/blas/base/dgemm/README.md @@ -2,7 +2,7 @@ @license Apache-2.0 -Copyright (c) 2024 The Stdlib Authors. +Copyright (c) 2026 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. @@ -22,6 +22,12 @@ limitations under the License. > 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 @@ -62,7 +68,7 @@ The function has the following parameters: - **C**: third input matrix stored in linear memory as a [`Float64Array`][mdn-float64array]. - **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 +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 Float64Array = require( '@stdlib/array/float64' ); @@ -75,6 +81,27 @@ dgemm( 'row-major', 'no-transpose', 'no-transpose', 2, 2, 2, 1.0, A, 4, B, 4, 1. // C => [ 2.0, 5.0, 6.0, 11.0 ] ``` +Note that indexing is relative to the first index. To introduce an offset, use [`typed array`][mdn-typed-array] views. + + + +```javascript +var Float64Array = require( '@stdlib/array/float64' ); + +// Initial arrays (with extra leading element to be skipped): +var A0 = new Float64Array( [ 0.0, 1.0, 2.0, 3.0, 4.0 ] ); +var B0 = new Float64Array( [ 0.0, 1.0, 1.0, 0.0, 1.0 ] ); +var C0 = new Float64Array( [ 0.0, 1.0, 2.0, 3.0, 4.0 ] ); + +// Create offset views... +var A1 = new Float64Array( A0.buffer, A0.BYTES_PER_ELEMENT*1 ); // start at 2nd element +var B1 = new Float64Array( B0.buffer, B0.BYTES_PER_ELEMENT*1 ); // start at 2nd element +var C1 = new Float64Array( C0.buffer, C0.BYTES_PER_ELEMENT*1 ); // start at 2nd element + +dgemm( 'row-major', 'no-transpose', 'no-transpose', 2, 2, 2, 1.0, A1, 2, B1, 2, 1.0, C1, 2 ); +// C0 => [ 0.0, 2.0, 5.0, 6.0, 11.0 ] +``` + #### dgemm.ndarray( ta, tb, M, N, K, α, A, sa1, sa2, oa, B, sb1, sb2, ob, β, C, sc1, sc2, oc ) @@ -190,18 +217,99 @@ console.log( C ); #include "stdlib/blas/base/dgemm.h" ``` -#### TODO +#### c_dgemm( layout, transA, transB, M, N, K, alpha, \*A, LDA, \*B, LDB, beta, \*C, LDC ) -TODO. +Performs the matrix-matrix operation `C = alpha*op(A)*op(B) + beta*C`, where `op(X)` is either `op(X) = X` or `op(X) = X^T`, `alpha` and `beta` are scalars, and `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. ```c -TODO +#include "stdlib/blas/base/shared.h" + +double A[ 2*3 ] = { + 1.0, 2.0, 3.0, + 4.0, 5.0, 6.0 +}; +double B[ 3*2 ] = { + 7.0, 8.0, + 9.0, 10.0, + 11.0, 12.0 +}; +double C[ 2*2 ] = { + 0.0, 0.0, + 0.0, 0.0 +}; + +c_dgemm( CblasRowMajor, CblasNoTrans, CblasNoTrans, 2, 2, 3, 1.0, A, 3, B, 2, 0.0, C, 2 ); ``` -TODO +The function accepts the following arguments: + +- **layout**: `[in] CBLAS_LAYOUT` storage layout. +- **transA**: `[in] CBLAS_TRANSPOSE` specifies whether `A` should be transposed, conjugate-transposed, or not transposed. +- **transB**: `[in] CBLAS_TRANSPOSE` specifies whether `B` should be transposed, conjugate-transposed, or not transposed. +- **M**: `[in] CBLAS_INT` number of rows in the matrix `op(A)` and in the matrix `C`. +- **N**: `[in] CBLAS_INT` number of columns in the matrix `op(B)` and in the matrix `C`. +- **K**: `[in] CBLAS_INT` number of columns in the matrix `op(A)` and number of rows in the matrix `op(B)`. +- **alpha**: `[in] double` scalar constant. +- **A**: `[in] double*` first input matrix. +- **LDA**: `[in] CBLAS_INT` stride of the first dimension of `A` (a.k.a., leading dimension of the matrix `A`). +- **B**: `[in] double*` second input matrix. +- **LDB**: `[in] CBLAS_INT` stride of the first dimension of `B` (a.k.a., leading dimension of the matrix `B`). +- **beta**: `[in] double` scalar constant. +- **C**: `[inout] double*` result matrix. +- **LDC**: `[in] CBLAS_INT` stride of the first dimension of `C` (a.k.a., leading dimension of the matrix `C`). ```c -TODO +void c_dgemm( const CBLAS_LAYOUT layout, const CBLAS_TRANSPOSE transA, const CBLAS_TRANSPOSE transB, const CBLAS_INT M, const CBLAS_INT N, const CBLAS_INT K, const double alpha, const double *A, const CBLAS_INT LDA, const double *B, const CBLAS_INT LDB, const double beta, double *C, const CBLAS_INT LDC ); +``` + +#### c_dgemm_ndarray( transA, transB, M, N, K, alpha, \*A, sa1, sa2, oa, \*B, sb1, sb2, ob, beta, \*C, sc1, sc2, oc ) + +Performs the matrix-matrix operation `C = alpha*op(A)*op(B) + beta*C`, using alternative indexing semantics and where `op(X)` is either `op(X) = X` or `op(X) = X^T`, `alpha` and `beta` are scalars, and `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. + +```c +#include "stdlib/blas/base/shared.h" + +double A[ 2*3 ] = { + 1.0, 2.0, 3.0, + 4.0, 5.0, 6.0 +}; +double B[ 3*2 ] = { + 7.0, 8.0, + 9.0, 10.0, + 11.0, 12.0 +}; +double C[ 2*2 ] = { + 0.0, 0.0, + 0.0, 0.0 +}; + +c_dgemm_ndarray( CblasNoTrans, CblasNoTrans, 2, 2, 3, 1.0, A, 3, 1, 0, B, 2, 1, 0, 0.0, C, 2, 1, 0 ); +``` + +The function accepts the following arguments: + +- **transA**: `[in] CBLAS_TRANSPOSE` specifies whether `A` should be transposed, conjugate-transposed, or not transposed. +- **transB**: `[in] CBLAS_TRANSPOSE` specifies whether `B` should be transposed, conjugate-transposed, or not transposed. +- **M**: `[in] CBLAS_INT` number of rows in the matrix `op(A)` and in the matrix `C`. +- **N**: `[in] CBLAS_INT` number of columns in the matrix `op(B)` and in the matrix `C`. +- **K**: `[in] CBLAS_INT` number of columns in the matrix `op(A)` and number of rows in the matrix `op(B)`. +- **alpha**: `[in] double` scalar constant. +- **A**: `[in] double*` first input matrix. +- **sa1**: `[in] CBLAS_INT` stride of the first dimension of `A`. +- **sa2**: `[in] CBLAS_INT` stride of the second dimension of `A`. +- **oa**: `[in] CBLAS_INT` starting index for `A`. +- **B**: `[in] double*` second input matrix. +- **sb1**: `[in] CBLAS_INT` stride of the first dimension of `B`. +- **sb2**: `[in] CBLAS_INT` stride of the second dimension of `B`. +- **ob**: `[in] CBLAS_INT` starting index for `B`. +- **beta**: `[in] double` scalar constant. +- **C**: `[inout] double*` result matrix. +- **sc1**: `[in] CBLAS_INT` stride of the first dimension of `C`. +- **sc2**: `[in] CBLAS_INT` stride of the second dimension of `C`. +- **oc**: `[in] CBLAS_INT` starting index for `C`. + +```c +void c_dgemm_ndarray( const CBLAS_TRANSPOSE transA, const CBLAS_TRANSPOSE transB, const CBLAS_INT M, const CBLAS_INT N, const CBLAS_INT K, const double alpha, const double *A, const CBLAS_INT strideA1, const CBLAS_INT strideA2, const CBLAS_INT offsetA, const double *B, const CBLAS_INT strideB1, const CBLAS_INT strideB2, const CBLAS_INT offsetB, const double beta, double *C, const CBLAS_INT strideC1, const CBLAS_INT strideC2, const CBLAS_INT offsetC ); ```
@@ -223,7 +331,45 @@ TODO ### Examples ```c -TODO +#include "stdlib/blas/base/dgemm.h" +#include "stdlib/blas/base/shared.h" +#include + +int main( void ) { + // Define a 2x2 output matrix stored in row-major order: + double C[ 2*2 ] = { + 0.0, 0.0, + 0.0, 0.0 + }; + + // Define a 2x3 matrix `A` stored in row-major order: + const double A[ 2*3 ] = { + 1.0, 2.0, 3.0, + 4.0, 5.0, 6.0 + }; + + // Define a 3x2 matrix `B` stored in row-major order: + const double B[ 3*2 ] = { + 7.0, 8.0, + 9.0, 10.0, + 11.0, 12.0 + }; + + // Specify matrix dimensions: + const int M = 2; // rows of op(A) and C + const int N = 2; // columns of op(B) and C + const int K = 3; // columns of op(A) and rows of op(B) + + // Perform operation: C = 1.0*A*B + 0.0*C + c_dgemm( CblasRowMajor, CblasNoTrans, CblasNoTrans, M, N, K, 1.0, A, K, B, N, 0.0, C, N ); + + // Print the result: + for ( int i = 0; i < M; i++ ) { + for ( int j = 0; j < N; j++ ) { + printf( "C[%i,%i] = %lf\n", i, j, C[ (i*N)+j ] ); + } + } +} ``` diff --git a/lib/node_modules/@stdlib/blas/base/dgemm/benchmark/benchmark_ca_cb_cc_nta_ntb.ndarray.native.js b/lib/node_modules/@stdlib/blas/base/dgemm/benchmark/benchmark_ca_cb_cc_nta_ntb.ndarray.native.js new file mode 100644 index 000000000000..76cc3869c595 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dgemm/benchmark/benchmark_ca_cb_cc_nta_ntb.ndarray.native.js @@ -0,0 +1,111 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 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 resolve = require( 'path' ).resolve; +var bench = require( '@stdlib/bench' ); +var uniform = require( '@stdlib/random/array/uniform' ); +var format = require( '@stdlib/string/format' ); +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 tryRequire = require( '@stdlib/utils/try-require' ); +var pkg = require( './../package.json' ).name; + + +// VARIABLES // + +var dgemm = tryRequire( resolve( __dirname, './../lib/ndarray.native.js' ) ); +var opts = { + 'skip': ( dgemm instanceof Error ) +}; +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 = dgemm( '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 len; + var min; + var max; + var f; + var i; + + min = 1; // 10^min + max = 5; // 10^max + + for ( i = min; i <= max; i++ ) { + len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + f = createBenchmark( len ); + bench( format( '%s::native:ndarray:order(A)=column-major,order(B)=column-major,order(C)=column-major,trans(A)=false,trans(B)=false,size=%d', pkg, len*len ), opts, f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/dgemm/benchmark/benchmark_ca_cb_cc_nta_tb.ndarray.native.js b/lib/node_modules/@stdlib/blas/base/dgemm/benchmark/benchmark_ca_cb_cc_nta_tb.ndarray.native.js new file mode 100644 index 000000000000..0eee113b8ebf --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dgemm/benchmark/benchmark_ca_cb_cc_nta_tb.ndarray.native.js @@ -0,0 +1,111 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 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 resolve = require( 'path' ).resolve; +var bench = require( '@stdlib/bench' ); +var uniform = require( '@stdlib/random/array/uniform' ); +var format = require( '@stdlib/string/format' ); +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 tryRequire = require( '@stdlib/utils/try-require' ); +var pkg = require( './../package.json' ).name; + + +// VARIABLES // + +var dgemm = tryRequire( resolve( __dirname, './../lib/ndarray.native.js' ) ); +var opts = { + 'skip': ( dgemm instanceof Error ) +}; +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 = dgemm( '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 len; + var min; + var max; + var f; + var i; + + min = 1; // 10^min + max = 5; // 10^max + + for ( i = min; i <= max; i++ ) { + len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + f = createBenchmark( len ); + bench( format( '%s::native:ndarray:order(A)=column-major,order(B)=column-major,order(C)=column-major,trans(A)=false,trans(B)=true,size=%d', pkg, len*len ), opts, f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/dgemm/benchmark/benchmark_ca_cb_cc_ta_ntb.ndarray.native.js b/lib/node_modules/@stdlib/blas/base/dgemm/benchmark/benchmark_ca_cb_cc_ta_ntb.ndarray.native.js new file mode 100644 index 000000000000..69a5bc634913 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dgemm/benchmark/benchmark_ca_cb_cc_ta_ntb.ndarray.native.js @@ -0,0 +1,111 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 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 resolve = require( 'path' ).resolve; +var bench = require( '@stdlib/bench' ); +var uniform = require( '@stdlib/random/array/uniform' ); +var format = require( '@stdlib/string/format' ); +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 tryRequire = require( '@stdlib/utils/try-require' ); +var pkg = require( './../package.json' ).name; + + +// VARIABLES // + +var dgemm = tryRequire( resolve( __dirname, './../lib/ndarray.native.js' ) ); +var opts = { + 'skip': ( dgemm instanceof Error ) +}; +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 = dgemm( '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 len; + var min; + var max; + var f; + var i; + + min = 1; // 10^min + max = 5; // 10^max + + for ( i = min; i <= max; i++ ) { + len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + f = createBenchmark( len ); + bench( format( '%s::native:ndarray:order(A)=column-major,order(B)=column-major,order(C)=column-major,trans(A)=true,trans(B)=false,size=%d', pkg, len*len ), opts, f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/dgemm/benchmark/benchmark_ca_cb_cc_ta_tb.ndarray.native.js b/lib/node_modules/@stdlib/blas/base/dgemm/benchmark/benchmark_ca_cb_cc_ta_tb.ndarray.native.js new file mode 100644 index 000000000000..e0777cb6fb73 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dgemm/benchmark/benchmark_ca_cb_cc_ta_tb.ndarray.native.js @@ -0,0 +1,111 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 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 resolve = require( 'path' ).resolve; +var bench = require( '@stdlib/bench' ); +var uniform = require( '@stdlib/random/array/uniform' ); +var format = require( '@stdlib/string/format' ); +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 tryRequire = require( '@stdlib/utils/try-require' ); +var pkg = require( './../package.json' ).name; + + +// VARIABLES // + +var dgemm = tryRequire( resolve( __dirname, './../lib/ndarray.native.js' ) ); +var opts = { + 'skip': ( dgemm instanceof Error ) +}; +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 = dgemm( '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 len; + var min; + var max; + var f; + var i; + + min = 1; // 10^min + max = 5; // 10^max + + for ( i = min; i <= max; i++ ) { + len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + f = createBenchmark( len ); + bench( format( '%s::native:ndarray:order(A)=column-major,order(B)=column-major,order(C)=column-major,trans(A)=true,trans(B)=true,size=%d', pkg, len*len ), opts, f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/dgemm/benchmark/benchmark_ca_cb_rc_nta_ntb.ndarray.native.js b/lib/node_modules/@stdlib/blas/base/dgemm/benchmark/benchmark_ca_cb_rc_nta_ntb.ndarray.native.js new file mode 100644 index 000000000000..548b7c0d631b --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dgemm/benchmark/benchmark_ca_cb_rc_nta_ntb.ndarray.native.js @@ -0,0 +1,111 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 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 resolve = require( 'path' ).resolve; +var bench = require( '@stdlib/bench' ); +var uniform = require( '@stdlib/random/array/uniform' ); +var format = require( '@stdlib/string/format' ); +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 tryRequire = require( '@stdlib/utils/try-require' ); +var pkg = require( './../package.json' ).name; + + +// VARIABLES // + +var dgemm = tryRequire( resolve( __dirname, './../lib/ndarray.native.js' ) ); +var opts = { + 'skip': ( dgemm instanceof Error ) +}; +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 = dgemm( '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 len; + var min; + var max; + var f; + var i; + + min = 1; // 10^min + max = 5; // 10^max + + for ( i = min; i <= max; i++ ) { + len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + f = createBenchmark( len ); + bench( format( '%s::native:ndarray:order(A)=column-major,order(B)=column-major,order(C)=row-major,trans(A)=false,trans(B)=false,size=%d', pkg, len*len ), opts, f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/dgemm/benchmark/benchmark_ca_cb_rc_nta_tb.ndarray.native.js b/lib/node_modules/@stdlib/blas/base/dgemm/benchmark/benchmark_ca_cb_rc_nta_tb.ndarray.native.js new file mode 100644 index 000000000000..07b81cbe2d61 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dgemm/benchmark/benchmark_ca_cb_rc_nta_tb.ndarray.native.js @@ -0,0 +1,111 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 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 resolve = require( 'path' ).resolve; +var bench = require( '@stdlib/bench' ); +var uniform = require( '@stdlib/random/array/uniform' ); +var format = require( '@stdlib/string/format' ); +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 tryRequire = require( '@stdlib/utils/try-require' ); +var pkg = require( './../package.json' ).name; + + +// VARIABLES // + +var dgemm = tryRequire( resolve( __dirname, './../lib/ndarray.native.js' ) ); +var opts = { + 'skip': ( dgemm instanceof Error ) +}; +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 = dgemm( '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 len; + var min; + var max; + var f; + var i; + + min = 1; // 10^min + max = 5; // 10^max + + for ( i = min; i <= max; i++ ) { + len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + f = createBenchmark( len ); + bench( format( '%s::native:ndarray:order(A)=column-major,order(B)=column-major,order(C)=row-major,trans(A)=false,trans(B)=true,size=%d', pkg, len*len ), opts, f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/dgemm/benchmark/benchmark_ca_cb_rc_ta_ntb.ndarray.native.js b/lib/node_modules/@stdlib/blas/base/dgemm/benchmark/benchmark_ca_cb_rc_ta_ntb.ndarray.native.js new file mode 100644 index 000000000000..abd836a75c2a --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dgemm/benchmark/benchmark_ca_cb_rc_ta_ntb.ndarray.native.js @@ -0,0 +1,111 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 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 resolve = require( 'path' ).resolve; +var bench = require( '@stdlib/bench' ); +var uniform = require( '@stdlib/random/array/uniform' ); +var format = require( '@stdlib/string/format' ); +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 tryRequire = require( '@stdlib/utils/try-require' ); +var pkg = require( './../package.json' ).name; + + +// VARIABLES // + +var dgemm = tryRequire( resolve( __dirname, './../lib/ndarray.native.js' ) ); +var opts = { + 'skip': ( dgemm instanceof Error ) +}; +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 = dgemm( '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 len; + var min; + var max; + var f; + var i; + + min = 1; // 10^min + max = 5; // 10^max + + for ( i = min; i <= max; i++ ) { + len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + f = createBenchmark( len ); + bench( format( '%s::native:ndarray:order(A)=column-major,order(B)=column-major,order(C)=row-major,trans(A)=true,trans(B)=false,size=%d', pkg, len*len ), opts, f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/dgemm/benchmark/benchmark_ca_cb_rc_ta_tb.ndarray.native.js b/lib/node_modules/@stdlib/blas/base/dgemm/benchmark/benchmark_ca_cb_rc_ta_tb.ndarray.native.js new file mode 100644 index 000000000000..567a7c4f224e --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dgemm/benchmark/benchmark_ca_cb_rc_ta_tb.ndarray.native.js @@ -0,0 +1,111 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 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 resolve = require( 'path' ).resolve; +var bench = require( '@stdlib/bench' ); +var uniform = require( '@stdlib/random/array/uniform' ); +var format = require( '@stdlib/string/format' ); +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 tryRequire = require( '@stdlib/utils/try-require' ); +var pkg = require( './../package.json' ).name; + + +// VARIABLES // + +var dgemm = tryRequire( resolve( __dirname, './../lib/ndarray.native.js' ) ); +var opts = { + 'skip': ( dgemm instanceof Error ) +}; +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 = dgemm( '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 len; + var min; + var max; + var f; + var i; + + min = 1; // 10^min + max = 5; // 10^max + + for ( i = min; i <= max; i++ ) { + len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + f = createBenchmark( len ); + bench( format( '%s::native:ndarray:order(A)=column-major,order(B)=column-major,order(C)=row-major,trans(A)=true,trans(B)=true,size=%d', pkg, len*len ), opts, f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/dgemm/benchmark/benchmark_ca_rb_cc_nta_ntb.ndarray.native.js b/lib/node_modules/@stdlib/blas/base/dgemm/benchmark/benchmark_ca_rb_cc_nta_ntb.ndarray.native.js new file mode 100644 index 000000000000..24cd48c90e16 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dgemm/benchmark/benchmark_ca_rb_cc_nta_ntb.ndarray.native.js @@ -0,0 +1,111 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 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 resolve = require( 'path' ).resolve; +var bench = require( '@stdlib/bench' ); +var uniform = require( '@stdlib/random/array/uniform' ); +var format = require( '@stdlib/string/format' ); +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 tryRequire = require( '@stdlib/utils/try-require' ); +var pkg = require( './../package.json' ).name; + + +// VARIABLES // + +var dgemm = tryRequire( resolve( __dirname, './../lib/ndarray.native.js' ) ); +var opts = { + 'skip': ( dgemm instanceof Error ) +}; +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 = dgemm( '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 len; + var min; + var max; + var f; + var i; + + min = 1; // 10^min + max = 5; // 10^max + + for ( i = min; i <= max; i++ ) { + len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + f = createBenchmark( len ); + bench( format( '%s::native:ndarray:order(A)=column-major,order(B)=row-major,order(C)=column-major,trans(A)=false,trans(B)=false,size=%d', pkg, len*len ), opts, f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/dgemm/benchmark/benchmark_ca_rb_cc_nta_tb.ndarray.native.js b/lib/node_modules/@stdlib/blas/base/dgemm/benchmark/benchmark_ca_rb_cc_nta_tb.ndarray.native.js new file mode 100644 index 000000000000..699506839f1c --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dgemm/benchmark/benchmark_ca_rb_cc_nta_tb.ndarray.native.js @@ -0,0 +1,111 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 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 resolve = require( 'path' ).resolve; +var bench = require( '@stdlib/bench' ); +var uniform = require( '@stdlib/random/array/uniform' ); +var format = require( '@stdlib/string/format' ); +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 tryRequire = require( '@stdlib/utils/try-require' ); +var pkg = require( './../package.json' ).name; + + +// VARIABLES // + +var dgemm = tryRequire( resolve( __dirname, './../lib/ndarray.native.js' ) ); +var opts = { + 'skip': ( dgemm instanceof Error ) +}; +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 = dgemm( '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 len; + var min; + var max; + var f; + var i; + + min = 1; // 10^min + max = 5; // 10^max + + for ( i = min; i <= max; i++ ) { + len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + f = createBenchmark( len ); + bench( format( '%s::native:ndarray:order(A)=column-major,order(B)=row-major,order(C)=column-major,trans(A)=false,trans(B)=true,size=%d', pkg, len*len ), opts, f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/dgemm/benchmark/benchmark_ca_rb_cc_ta_ntb.ndarray.native.js b/lib/node_modules/@stdlib/blas/base/dgemm/benchmark/benchmark_ca_rb_cc_ta_ntb.ndarray.native.js new file mode 100644 index 000000000000..b935b7ac64f6 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dgemm/benchmark/benchmark_ca_rb_cc_ta_ntb.ndarray.native.js @@ -0,0 +1,111 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 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 resolve = require( 'path' ).resolve; +var bench = require( '@stdlib/bench' ); +var uniform = require( '@stdlib/random/array/uniform' ); +var format = require( '@stdlib/string/format' ); +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 tryRequire = require( '@stdlib/utils/try-require' ); +var pkg = require( './../package.json' ).name; + + +// VARIABLES // + +var dgemm = tryRequire( resolve( __dirname, './../lib/ndarray.native.js' ) ); +var opts = { + 'skip': ( dgemm instanceof Error ) +}; +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 = dgemm( '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 len; + var min; + var max; + var f; + var i; + + min = 1; // 10^min + max = 5; // 10^max + + for ( i = min; i <= max; i++ ) { + len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + f = createBenchmark( len ); + bench( format( '%s::native:ndarray:order(A)=column-major,order(B)=row-major,order(C)=column-major,trans(A)=true,trans(B)=false,size=%d', pkg, len*len ), opts, f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/dgemm/benchmark/benchmark_ca_rb_cc_ta_tb.ndarray.native.js b/lib/node_modules/@stdlib/blas/base/dgemm/benchmark/benchmark_ca_rb_cc_ta_tb.ndarray.native.js new file mode 100644 index 000000000000..dad1016bb6a7 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dgemm/benchmark/benchmark_ca_rb_cc_ta_tb.ndarray.native.js @@ -0,0 +1,111 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 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 resolve = require( 'path' ).resolve; +var bench = require( '@stdlib/bench' ); +var uniform = require( '@stdlib/random/array/uniform' ); +var format = require( '@stdlib/string/format' ); +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 tryRequire = require( '@stdlib/utils/try-require' ); +var pkg = require( './../package.json' ).name; + + +// VARIABLES // + +var dgemm = tryRequire( resolve( __dirname, './../lib/ndarray.native.js' ) ); +var opts = { + 'skip': ( dgemm instanceof Error ) +}; +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 = dgemm( '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 len; + var min; + var max; + var f; + var i; + + min = 1; // 10^min + max = 5; // 10^max + + for ( i = min; i <= max; i++ ) { + len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + f = createBenchmark( len ); + bench( format( '%s::native:ndarray:order(A)=column-major,order(B)=row-major,order(C)=column-major,trans(A)=true,trans(B)=true,size=%d', pkg, len*len ), opts, f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/dgemm/benchmark/benchmark_ca_rb_rc_nta_ntb.ndarray.native.js b/lib/node_modules/@stdlib/blas/base/dgemm/benchmark/benchmark_ca_rb_rc_nta_ntb.ndarray.native.js new file mode 100644 index 000000000000..544c846fa0df --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dgemm/benchmark/benchmark_ca_rb_rc_nta_ntb.ndarray.native.js @@ -0,0 +1,111 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 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 resolve = require( 'path' ).resolve; +var bench = require( '@stdlib/bench' ); +var uniform = require( '@stdlib/random/array/uniform' ); +var format = require( '@stdlib/string/format' ); +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 tryRequire = require( '@stdlib/utils/try-require' ); +var pkg = require( './../package.json' ).name; + + +// VARIABLES // + +var dgemm = tryRequire( resolve( __dirname, './../lib/ndarray.native.js' ) ); +var opts = { + 'skip': ( dgemm instanceof Error ) +}; +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 = dgemm( '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 len; + var min; + var max; + var f; + var i; + + min = 1; // 10^min + max = 5; // 10^max + + for ( i = min; i <= max; i++ ) { + len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + f = createBenchmark( len ); + bench( format( '%s::native:ndarray:order(A)=column-major,order(B)=row-major,order(C)=row-major,trans(A)=false,trans(B)=false,size=%d', pkg, len*len ), opts, f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/dgemm/benchmark/benchmark_ca_rb_rc_nta_tb.ndarray.native.js b/lib/node_modules/@stdlib/blas/base/dgemm/benchmark/benchmark_ca_rb_rc_nta_tb.ndarray.native.js new file mode 100644 index 000000000000..ca346a94530e --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dgemm/benchmark/benchmark_ca_rb_rc_nta_tb.ndarray.native.js @@ -0,0 +1,111 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 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 resolve = require( 'path' ).resolve; +var bench = require( '@stdlib/bench' ); +var uniform = require( '@stdlib/random/array/uniform' ); +var format = require( '@stdlib/string/format' ); +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 tryRequire = require( '@stdlib/utils/try-require' ); +var pkg = require( './../package.json' ).name; + + +// VARIABLES // + +var dgemm = tryRequire( resolve( __dirname, './../lib/ndarray.native.js' ) ); +var opts = { + 'skip': ( dgemm instanceof Error ) +}; +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 = dgemm( '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 len; + var min; + var max; + var f; + var i; + + min = 1; // 10^min + max = 5; // 10^max + + for ( i = min; i <= max; i++ ) { + len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + f = createBenchmark( len ); + bench( format( '%s::native:ndarray:order(A)=column-major,order(B)=row-major,order(C)=row-major,trans(A)=false,trans(B)=true,size=%d', pkg, len*len ), opts, f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/dgemm/benchmark/benchmark_ca_rb_rc_ta_ntb.ndarray.native.js b/lib/node_modules/@stdlib/blas/base/dgemm/benchmark/benchmark_ca_rb_rc_ta_ntb.ndarray.native.js new file mode 100644 index 000000000000..4853d412ca64 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dgemm/benchmark/benchmark_ca_rb_rc_ta_ntb.ndarray.native.js @@ -0,0 +1,111 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 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 resolve = require( 'path' ).resolve; +var bench = require( '@stdlib/bench' ); +var uniform = require( '@stdlib/random/array/uniform' ); +var format = require( '@stdlib/string/format' ); +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 tryRequire = require( '@stdlib/utils/try-require' ); +var pkg = require( './../package.json' ).name; + + +// VARIABLES // + +var dgemm = tryRequire( resolve( __dirname, './../lib/ndarray.native.js' ) ); +var opts = { + 'skip': ( dgemm instanceof Error ) +}; +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 = dgemm( '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 len; + var min; + var max; + var f; + var i; + + min = 1; // 10^min + max = 5; // 10^max + + for ( i = min; i <= max; i++ ) { + len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + f = createBenchmark( len ); + bench( format( '%s::native:ndarray:order(A)=column-major,order(B)=row-major,order(C)=row-major,trans(A)=true,trans(B)=false,size=%d', pkg, len*len ), opts, f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/dgemm/benchmark/benchmark_ca_rb_rc_ta_tb.ndarray.native.js b/lib/node_modules/@stdlib/blas/base/dgemm/benchmark/benchmark_ca_rb_rc_ta_tb.ndarray.native.js new file mode 100644 index 000000000000..51cc412d1ab4 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dgemm/benchmark/benchmark_ca_rb_rc_ta_tb.ndarray.native.js @@ -0,0 +1,111 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 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 resolve = require( 'path' ).resolve; +var bench = require( '@stdlib/bench' ); +var uniform = require( '@stdlib/random/array/uniform' ); +var format = require( '@stdlib/string/format' ); +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 tryRequire = require( '@stdlib/utils/try-require' ); +var pkg = require( './../package.json' ).name; + + +// VARIABLES // + +var dgemm = tryRequire( resolve( __dirname, './../lib/ndarray.native.js' ) ); +var opts = { + 'skip': ( dgemm instanceof Error ) +}; +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 = dgemm( '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 len; + var min; + var max; + var f; + var i; + + min = 1; // 10^min + max = 5; // 10^max + + for ( i = min; i <= max; i++ ) { + len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + f = createBenchmark( len ); + bench( format( '%s::native:ndarray:order(A)=column-major,order(B)=row-major,order(C)=row-major,trans(A)=true,trans(B)=true,size=%d', pkg, len*len ), opts, f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/dgemm/benchmark/benchmark_column_major_nta_ntb.native.js b/lib/node_modules/@stdlib/blas/base/dgemm/benchmark/benchmark_column_major_nta_ntb.native.js new file mode 100644 index 000000000000..06a072b05bd0 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dgemm/benchmark/benchmark_column_major_nta_ntb.native.js @@ -0,0 +1,111 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 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 resolve = require( 'path' ).resolve; +var bench = require( '@stdlib/bench' ); +var uniform = require( '@stdlib/random/array/uniform' ); +var format = require( '@stdlib/string/format' ); +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 tryRequire = require( '@stdlib/utils/try-require' ); +var pkg = require( './../package.json' ).name; + + +// VARIABLES // + +var dgemm = tryRequire( resolve( __dirname, './../lib/dgemm.native.js' ) ); +var opts = { + 'skip': ( dgemm instanceof Error ) +}; +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 = dgemm( '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 len; + var min; + var max; + var f; + var i; + + min = 1; // 10^min + max = 5; // 10^max + + for ( i = min; i <= max; i++ ) { + len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + f = createBenchmark( len ); + bench( format( '%s::native:order(A)=column-major,order(B)=column-major,order(C)=column-major,trans(A)=false,trans(B)=false,size=%d', pkg, len*len ), opts, f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/dgemm/benchmark/benchmark_column_major_nta_tb.native.js b/lib/node_modules/@stdlib/blas/base/dgemm/benchmark/benchmark_column_major_nta_tb.native.js new file mode 100644 index 000000000000..450976cd5587 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dgemm/benchmark/benchmark_column_major_nta_tb.native.js @@ -0,0 +1,111 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 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 resolve = require( 'path' ).resolve; +var bench = require( '@stdlib/bench' ); +var uniform = require( '@stdlib/random/array/uniform' ); +var format = require( '@stdlib/string/format' ); +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 tryRequire = require( '@stdlib/utils/try-require' ); +var pkg = require( './../package.json' ).name; + + +// VARIABLES // + +var dgemm = tryRequire( resolve( __dirname, './../lib/dgemm.native.js' ) ); +var opts = { + 'skip': ( dgemm instanceof Error ) +}; +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 = dgemm( '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 len; + var min; + var max; + var f; + var i; + + min = 1; // 10^min + max = 5; // 10^max + + for ( i = min; i <= max; i++ ) { + len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + f = createBenchmark( len ); + bench( format( '%s::native:order(A)=column-major,order(B)=column-major,order(C)=column-major,trans(A)=false,trans(B)=true,size=%d', pkg, len*len ), opts, f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/dgemm/benchmark/benchmark_column_major_ta_ntb.native.js b/lib/node_modules/@stdlib/blas/base/dgemm/benchmark/benchmark_column_major_ta_ntb.native.js new file mode 100644 index 000000000000..67c53cca1674 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dgemm/benchmark/benchmark_column_major_ta_ntb.native.js @@ -0,0 +1,111 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 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 resolve = require( 'path' ).resolve; +var bench = require( '@stdlib/bench' ); +var uniform = require( '@stdlib/random/array/uniform' ); +var format = require( '@stdlib/string/format' ); +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 tryRequire = require( '@stdlib/utils/try-require' ); +var pkg = require( './../package.json' ).name; + + +// VARIABLES // + +var dgemm = tryRequire( resolve( __dirname, './../lib/dgemm.native.js' ) ); +var opts = { + 'skip': ( dgemm instanceof Error ) +}; +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 = dgemm( '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 len; + var min; + var max; + var f; + var i; + + min = 1; // 10^min + max = 5; // 10^max + + for ( i = min; i <= max; i++ ) { + len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + f = createBenchmark( len ); + bench( format( '%s::native:order(A)=column-major,order(B)=column-major,order(C)=column-major,trans(A)=true,trans(B)=false,size=%d', pkg, len*len ), opts, f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/dgemm/benchmark/benchmark_column_major_ta_tb.native.js b/lib/node_modules/@stdlib/blas/base/dgemm/benchmark/benchmark_column_major_ta_tb.native.js new file mode 100644 index 000000000000..b68ac65b5947 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dgemm/benchmark/benchmark_column_major_ta_tb.native.js @@ -0,0 +1,111 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 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 resolve = require( 'path' ).resolve; +var bench = require( '@stdlib/bench' ); +var uniform = require( '@stdlib/random/array/uniform' ); +var format = require( '@stdlib/string/format' ); +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 tryRequire = require( '@stdlib/utils/try-require' ); +var pkg = require( './../package.json' ).name; + + +// VARIABLES // + +var dgemm = tryRequire( resolve( __dirname, './../lib/dgemm.native.js' ) ); +var opts = { + 'skip': ( dgemm instanceof Error ) +}; +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 = dgemm( '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 len; + var min; + var max; + var f; + var i; + + min = 1; // 10^min + max = 5; // 10^max + + for ( i = min; i <= max; i++ ) { + len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + f = createBenchmark( len ); + bench( format( '%s::native:order(A)=column-major,order(B)=column-major,order(C)=column-major,trans(A)=true,trans(B)=true,size=%d', pkg, len*len ), opts, f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/dgemm/benchmark/benchmark_ra_cb_cc_nta_ntb.ndarray.native.js b/lib/node_modules/@stdlib/blas/base/dgemm/benchmark/benchmark_ra_cb_cc_nta_ntb.ndarray.native.js new file mode 100644 index 000000000000..0fe637304cca --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dgemm/benchmark/benchmark_ra_cb_cc_nta_ntb.ndarray.native.js @@ -0,0 +1,111 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 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 resolve = require( 'path' ).resolve; +var bench = require( '@stdlib/bench' ); +var uniform = require( '@stdlib/random/array/uniform' ); +var format = require( '@stdlib/string/format' ); +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 tryRequire = require( '@stdlib/utils/try-require' ); +var pkg = require( './../package.json' ).name; + + +// VARIABLES // + +var dgemm = tryRequire( resolve( __dirname, './../lib/ndarray.native.js' ) ); +var opts = { + 'skip': ( dgemm instanceof Error ) +}; +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 = dgemm( '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 len; + var min; + var max; + var f; + var i; + + min = 1; // 10^min + max = 5; // 10^max + + for ( i = min; i <= max; i++ ) { + len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + f = createBenchmark( len ); + bench( format( '%s::native:ndarray:order(A)=row-major,order(B)=column-major,order(C)=column-major,trans(A)=false,trans(B)=false,size=%d', pkg, len*len ), opts, f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/dgemm/benchmark/benchmark_ra_cb_cc_nta_tb.ndarray.native.js b/lib/node_modules/@stdlib/blas/base/dgemm/benchmark/benchmark_ra_cb_cc_nta_tb.ndarray.native.js new file mode 100644 index 000000000000..6f8852fad924 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dgemm/benchmark/benchmark_ra_cb_cc_nta_tb.ndarray.native.js @@ -0,0 +1,111 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 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 resolve = require( 'path' ).resolve; +var bench = require( '@stdlib/bench' ); +var uniform = require( '@stdlib/random/array/uniform' ); +var format = require( '@stdlib/string/format' ); +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 tryRequire = require( '@stdlib/utils/try-require' ); +var pkg = require( './../package.json' ).name; + + +// VARIABLES // + +var dgemm = tryRequire( resolve( __dirname, './../lib/ndarray.native.js' ) ); +var opts = { + 'skip': ( dgemm instanceof Error ) +}; +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 = dgemm( '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 len; + var min; + var max; + var f; + var i; + + min = 1; // 10^min + max = 5; // 10^max + + for ( i = min; i <= max; i++ ) { + len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + f = createBenchmark( len ); + bench( format( '%s::native:ndarray:order(A)=row-major,order(B)=column-major,order(C)=column-major,trans(A)=false,trans(B)=true,size=%d', pkg, len*len ), opts, f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/dgemm/benchmark/benchmark_ra_cb_cc_ta_ntb.ndarray.native.js b/lib/node_modules/@stdlib/blas/base/dgemm/benchmark/benchmark_ra_cb_cc_ta_ntb.ndarray.native.js new file mode 100644 index 000000000000..1317ec58d647 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dgemm/benchmark/benchmark_ra_cb_cc_ta_ntb.ndarray.native.js @@ -0,0 +1,111 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 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 resolve = require( 'path' ).resolve; +var bench = require( '@stdlib/bench' ); +var uniform = require( '@stdlib/random/array/uniform' ); +var format = require( '@stdlib/string/format' ); +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 tryRequire = require( '@stdlib/utils/try-require' ); +var pkg = require( './../package.json' ).name; + + +// VARIABLES // + +var dgemm = tryRequire( resolve( __dirname, './../lib/ndarray.native.js' ) ); +var opts = { + 'skip': ( dgemm instanceof Error ) +}; +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 = dgemm( '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 len; + var min; + var max; + var f; + var i; + + min = 1; // 10^min + max = 5; // 10^max + + for ( i = min; i <= max; i++ ) { + len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + f = createBenchmark( len ); + bench( format( '%s::native:ndarray:order(A)=row-major,order(B)=column-major,order(C)=column-major,trans(A)=true,trans(B)=false,size=%d', pkg, len*len ), opts, f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/dgemm/benchmark/benchmark_ra_cb_cc_ta_tb.ndarray.native.js b/lib/node_modules/@stdlib/blas/base/dgemm/benchmark/benchmark_ra_cb_cc_ta_tb.ndarray.native.js new file mode 100644 index 000000000000..0ebc1ab30ed2 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dgemm/benchmark/benchmark_ra_cb_cc_ta_tb.ndarray.native.js @@ -0,0 +1,111 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 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 resolve = require( 'path' ).resolve; +var bench = require( '@stdlib/bench' ); +var uniform = require( '@stdlib/random/array/uniform' ); +var format = require( '@stdlib/string/format' ); +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 tryRequire = require( '@stdlib/utils/try-require' ); +var pkg = require( './../package.json' ).name; + + +// VARIABLES // + +var dgemm = tryRequire( resolve( __dirname, './../lib/ndarray.native.js' ) ); +var opts = { + 'skip': ( dgemm instanceof Error ) +}; +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 = dgemm( '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 len; + var min; + var max; + var f; + var i; + + min = 1; // 10^min + max = 5; // 10^max + + for ( i = min; i <= max; i++ ) { + len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + f = createBenchmark( len ); + bench( format( '%s::native:ndarray:order(A)=row-major,order(B)=column-major,order(C)=column-major,trans(A)=true,trans(B)=true,size=%d', pkg, len*len ), opts, f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/dgemm/benchmark/benchmark_ra_cb_rc_nta_ntb.ndarray.native.js b/lib/node_modules/@stdlib/blas/base/dgemm/benchmark/benchmark_ra_cb_rc_nta_ntb.ndarray.native.js new file mode 100644 index 000000000000..91197d2f6915 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dgemm/benchmark/benchmark_ra_cb_rc_nta_ntb.ndarray.native.js @@ -0,0 +1,111 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 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 resolve = require( 'path' ).resolve; +var bench = require( '@stdlib/bench' ); +var uniform = require( '@stdlib/random/array/uniform' ); +var format = require( '@stdlib/string/format' ); +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 tryRequire = require( '@stdlib/utils/try-require' ); +var pkg = require( './../package.json' ).name; + + +// VARIABLES // + +var dgemm = tryRequire( resolve( __dirname, './../lib/ndarray.native.js' ) ); +var opts = { + 'skip': ( dgemm instanceof Error ) +}; +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 = dgemm( '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 len; + var min; + var max; + var f; + var i; + + min = 1; // 10^min + max = 5; // 10^max + + for ( i = min; i <= max; i++ ) { + len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + f = createBenchmark( len ); + bench( format( '%s::native:ndarray:order(A)=row-major,order(B)=column-major,order(C)=row-major,trans(A)=false,trans(B)=false,size=%d', pkg, len*len ), opts, f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/dgemm/benchmark/benchmark_ra_cb_rc_nta_tb.ndarray.native.js b/lib/node_modules/@stdlib/blas/base/dgemm/benchmark/benchmark_ra_cb_rc_nta_tb.ndarray.native.js new file mode 100644 index 000000000000..becda939b3e6 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dgemm/benchmark/benchmark_ra_cb_rc_nta_tb.ndarray.native.js @@ -0,0 +1,111 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 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 resolve = require( 'path' ).resolve; +var bench = require( '@stdlib/bench' ); +var uniform = require( '@stdlib/random/array/uniform' ); +var format = require( '@stdlib/string/format' ); +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 tryRequire = require( '@stdlib/utils/try-require' ); +var pkg = require( './../package.json' ).name; + + +// VARIABLES // + +var dgemm = tryRequire( resolve( __dirname, './../lib/ndarray.native.js' ) ); +var opts = { + 'skip': ( dgemm instanceof Error ) +}; +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 = dgemm( '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 len; + var min; + var max; + var f; + var i; + + min = 1; // 10^min + max = 5; // 10^max + + for ( i = min; i <= max; i++ ) { + len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + f = createBenchmark( len ); + bench( format( '%s::native:ndarray:order(A)=row-major,order(B)=column-major,order(C)=row-major,trans(A)=false,trans(B)=true,size=%d', pkg, len*len ), opts, f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/dgemm/benchmark/benchmark_ra_cb_rc_ta_ntb.ndarray.native.js b/lib/node_modules/@stdlib/blas/base/dgemm/benchmark/benchmark_ra_cb_rc_ta_ntb.ndarray.native.js new file mode 100644 index 000000000000..733f29338034 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dgemm/benchmark/benchmark_ra_cb_rc_ta_ntb.ndarray.native.js @@ -0,0 +1,111 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 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 resolve = require( 'path' ).resolve; +var bench = require( '@stdlib/bench' ); +var uniform = require( '@stdlib/random/array/uniform' ); +var format = require( '@stdlib/string/format' ); +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 tryRequire = require( '@stdlib/utils/try-require' ); +var pkg = require( './../package.json' ).name; + + +// VARIABLES // + +var dgemm = tryRequire( resolve( __dirname, './../lib/ndarray.native.js' ) ); +var opts = { + 'skip': ( dgemm instanceof Error ) +}; +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 = dgemm( '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 len; + var min; + var max; + var f; + var i; + + min = 1; // 10^min + max = 5; // 10^max + + for ( i = min; i <= max; i++ ) { + len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + f = createBenchmark( len ); + bench( format( '%s::native:ndarray:order(A)=row-major,order(B)=column-major,order(C)=row-major,trans(A)=true,trans(B)=false,size=%d', pkg, len*len ), opts, f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/dgemm/benchmark/benchmark_ra_cb_rc_ta_tb.ndarray.native.js b/lib/node_modules/@stdlib/blas/base/dgemm/benchmark/benchmark_ra_cb_rc_ta_tb.ndarray.native.js new file mode 100644 index 000000000000..3fef53a74c19 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dgemm/benchmark/benchmark_ra_cb_rc_ta_tb.ndarray.native.js @@ -0,0 +1,111 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 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 resolve = require( 'path' ).resolve; +var bench = require( '@stdlib/bench' ); +var uniform = require( '@stdlib/random/array/uniform' ); +var format = require( '@stdlib/string/format' ); +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 tryRequire = require( '@stdlib/utils/try-require' ); +var pkg = require( './../package.json' ).name; + + +// VARIABLES // + +var dgemm = tryRequire( resolve( __dirname, './../lib/ndarray.native.js' ) ); +var opts = { + 'skip': ( dgemm instanceof Error ) +}; +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 = dgemm( '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 len; + var min; + var max; + var f; + var i; + + min = 1; // 10^min + max = 5; // 10^max + + for ( i = min; i <= max; i++ ) { + len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + f = createBenchmark( len ); + bench( format( '%s::native:ndarray:order(A)=row-major,order(B)=column-major,order(C)=row-major,trans(A)=true,trans(B)=true,size=%d', pkg, len*len ), opts, f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/dgemm/benchmark/benchmark_ra_rb_cc_nta_ntb.ndarray.native.js b/lib/node_modules/@stdlib/blas/base/dgemm/benchmark/benchmark_ra_rb_cc_nta_ntb.ndarray.native.js new file mode 100644 index 000000000000..6a7ef24f8123 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dgemm/benchmark/benchmark_ra_rb_cc_nta_ntb.ndarray.native.js @@ -0,0 +1,111 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 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 resolve = require( 'path' ).resolve; +var bench = require( '@stdlib/bench' ); +var uniform = require( '@stdlib/random/array/uniform' ); +var format = require( '@stdlib/string/format' ); +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 tryRequire = require( '@stdlib/utils/try-require' ); +var pkg = require( './../package.json' ).name; + + +// VARIABLES // + +var dgemm = tryRequire( resolve( __dirname, './../lib/ndarray.native.js' ) ); +var opts = { + 'skip': ( dgemm instanceof Error ) +}; +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 = dgemm( '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 len; + var min; + var max; + var f; + var i; + + min = 1; // 10^min + max = 5; // 10^max + + for ( i = min; i <= max; i++ ) { + len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + f = createBenchmark( len ); + bench( format( '%s::native:ndarray:order(A)=row-major,order(B)=row-major,order(C)=column-major,trans(A)=false,trans(B)=false,size=%d', pkg, len*len ), opts, f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/dgemm/benchmark/benchmark_ra_rb_cc_nta_tb.ndarray.native.js b/lib/node_modules/@stdlib/blas/base/dgemm/benchmark/benchmark_ra_rb_cc_nta_tb.ndarray.native.js new file mode 100644 index 000000000000..a87458bd51c0 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dgemm/benchmark/benchmark_ra_rb_cc_nta_tb.ndarray.native.js @@ -0,0 +1,111 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 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 resolve = require( 'path' ).resolve; +var bench = require( '@stdlib/bench' ); +var uniform = require( '@stdlib/random/array/uniform' ); +var format = require( '@stdlib/string/format' ); +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 tryRequire = require( '@stdlib/utils/try-require' ); +var pkg = require( './../package.json' ).name; + + +// VARIABLES // + +var dgemm = tryRequire( resolve( __dirname, './../lib/ndarray.native.js' ) ); +var opts = { + 'skip': ( dgemm instanceof Error ) +}; +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 = dgemm( '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 len; + var min; + var max; + var f; + var i; + + min = 1; // 10^min + max = 5; // 10^max + + for ( i = min; i <= max; i++ ) { + len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + f = createBenchmark( len ); + bench( format( '%s::native:ndarray:order(A)=row-major,order(B)=row-major,order(C)=column-major,trans(A)=false,trans(B)=true,size=%d', pkg, len*len ), opts, f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/dgemm/benchmark/benchmark_ra_rb_cc_ta_ntb.ndarray.native.js b/lib/node_modules/@stdlib/blas/base/dgemm/benchmark/benchmark_ra_rb_cc_ta_ntb.ndarray.native.js new file mode 100644 index 000000000000..ba99fff9084b --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dgemm/benchmark/benchmark_ra_rb_cc_ta_ntb.ndarray.native.js @@ -0,0 +1,111 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 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 resolve = require( 'path' ).resolve; +var bench = require( '@stdlib/bench' ); +var uniform = require( '@stdlib/random/array/uniform' ); +var format = require( '@stdlib/string/format' ); +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 tryRequire = require( '@stdlib/utils/try-require' ); +var pkg = require( './../package.json' ).name; + + +// VARIABLES // + +var dgemm = tryRequire( resolve( __dirname, './../lib/ndarray.native.js' ) ); +var opts = { + 'skip': ( dgemm instanceof Error ) +}; +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 = dgemm( '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 len; + var min; + var max; + var f; + var i; + + min = 1; // 10^min + max = 5; // 10^max + + for ( i = min; i <= max; i++ ) { + len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + f = createBenchmark( len ); + bench( format( '%s::native:ndarray:order(A)=row-major,order(B)=row-major,order(C)=column-major,trans(A)=true,trans(B)=false,size=%d', pkg, len*len ), opts, f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/dgemm/benchmark/benchmark_ra_rb_cc_ta_tb.ndarray.native.js b/lib/node_modules/@stdlib/blas/base/dgemm/benchmark/benchmark_ra_rb_cc_ta_tb.ndarray.native.js new file mode 100644 index 000000000000..c06b0f843acb --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dgemm/benchmark/benchmark_ra_rb_cc_ta_tb.ndarray.native.js @@ -0,0 +1,111 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 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 resolve = require( 'path' ).resolve; +var bench = require( '@stdlib/bench' ); +var uniform = require( '@stdlib/random/array/uniform' ); +var format = require( '@stdlib/string/format' ); +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 tryRequire = require( '@stdlib/utils/try-require' ); +var pkg = require( './../package.json' ).name; + + +// VARIABLES // + +var dgemm = tryRequire( resolve( __dirname, './../lib/ndarray.native.js' ) ); +var opts = { + 'skip': ( dgemm instanceof Error ) +}; +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 = dgemm( '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 len; + var min; + var max; + var f; + var i; + + min = 1; // 10^min + max = 5; // 10^max + + for ( i = min; i <= max; i++ ) { + len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + f = createBenchmark( len ); + bench( format( '%s::native:ndarray:order(A)=row-major,order(B)=row-major,order(C)=column-major,trans(A)=true,trans(B)=true,size=%d', pkg, len*len ), opts, f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/dgemm/benchmark/benchmark_ra_rb_rc_nta_ntb.ndarray.native.js b/lib/node_modules/@stdlib/blas/base/dgemm/benchmark/benchmark_ra_rb_rc_nta_ntb.ndarray.native.js new file mode 100644 index 000000000000..105fea33e2f9 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dgemm/benchmark/benchmark_ra_rb_rc_nta_ntb.ndarray.native.js @@ -0,0 +1,111 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 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 resolve = require( 'path' ).resolve; +var bench = require( '@stdlib/bench' ); +var uniform = require( '@stdlib/random/array/uniform' ); +var format = require( '@stdlib/string/format' ); +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 tryRequire = require( '@stdlib/utils/try-require' ); +var pkg = require( './../package.json' ).name; + + +// VARIABLES // + +var dgemm = tryRequire( resolve( __dirname, './../lib/ndarray.native.js' ) ); +var opts = { + 'skip': ( dgemm instanceof Error ) +}; +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 = dgemm( '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 len; + var min; + var max; + var f; + var i; + + min = 1; // 10^min + max = 5; // 10^max + + for ( i = min; i <= max; i++ ) { + len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + f = createBenchmark( len ); + bench( format( '%s::native:ndarray:order(A)=row-major,order(B)=row-major,order(C)=row-major,trans(A)=false,trans(B)=false,size=%d', pkg, len*len ), opts, f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/dgemm/benchmark/benchmark_ra_rb_rc_nta_tb.ndarray.native.js b/lib/node_modules/@stdlib/blas/base/dgemm/benchmark/benchmark_ra_rb_rc_nta_tb.ndarray.native.js new file mode 100644 index 000000000000..629249c03e7f --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dgemm/benchmark/benchmark_ra_rb_rc_nta_tb.ndarray.native.js @@ -0,0 +1,111 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 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 resolve = require( 'path' ).resolve; +var bench = require( '@stdlib/bench' ); +var uniform = require( '@stdlib/random/array/uniform' ); +var format = require( '@stdlib/string/format' ); +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 tryRequire = require( '@stdlib/utils/try-require' ); +var pkg = require( './../package.json' ).name; + + +// VARIABLES // + +var dgemm = tryRequire( resolve( __dirname, './../lib/ndarray.native.js' ) ); +var opts = { + 'skip': ( dgemm instanceof Error ) +}; +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 = dgemm( '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 len; + var min; + var max; + var f; + var i; + + min = 1; // 10^min + max = 5; // 10^max + + for ( i = min; i <= max; i++ ) { + len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + f = createBenchmark( len ); + bench( format( '%s::native:ndarray:order(A)=row-major,order(B)=row-major,order(C)=row-major,trans(A)=false,trans(B)=true,size=%d', pkg, len*len ), opts, f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/dgemm/benchmark/benchmark_ra_rb_rc_ta_ntb.ndarray.native.js b/lib/node_modules/@stdlib/blas/base/dgemm/benchmark/benchmark_ra_rb_rc_ta_ntb.ndarray.native.js new file mode 100644 index 000000000000..dd85fa72158b --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dgemm/benchmark/benchmark_ra_rb_rc_ta_ntb.ndarray.native.js @@ -0,0 +1,111 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 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 resolve = require( 'path' ).resolve; +var bench = require( '@stdlib/bench' ); +var uniform = require( '@stdlib/random/array/uniform' ); +var format = require( '@stdlib/string/format' ); +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 tryRequire = require( '@stdlib/utils/try-require' ); +var pkg = require( './../package.json' ).name; + + +// VARIABLES // + +var dgemm = tryRequire( resolve( __dirname, './../lib/ndarray.native.js' ) ); +var opts = { + 'skip': ( dgemm instanceof Error ) +}; +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 = dgemm( '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 len; + var min; + var max; + var f; + var i; + + min = 1; // 10^min + max = 5; // 10^max + + for ( i = min; i <= max; i++ ) { + len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + f = createBenchmark( len ); + bench( format( '%s::native:ndarray:order(A)=row-major,order(B)=row-major,order(C)=row-major,trans(A)=true,trans(B)=false,size=%d', pkg, len*len ), opts, f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/dgemm/benchmark/benchmark_ra_rb_rc_ta_tb.ndarray.native.js b/lib/node_modules/@stdlib/blas/base/dgemm/benchmark/benchmark_ra_rb_rc_ta_tb.ndarray.native.js new file mode 100644 index 000000000000..c65989099807 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dgemm/benchmark/benchmark_ra_rb_rc_ta_tb.ndarray.native.js @@ -0,0 +1,111 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 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 resolve = require( 'path' ).resolve; +var bench = require( '@stdlib/bench' ); +var uniform = require( '@stdlib/random/array/uniform' ); +var format = require( '@stdlib/string/format' ); +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 tryRequire = require( '@stdlib/utils/try-require' ); +var pkg = require( './../package.json' ).name; + + +// VARIABLES // + +var dgemm = tryRequire( resolve( __dirname, './../lib/ndarray.native.js' ) ); +var opts = { + 'skip': ( dgemm instanceof Error ) +}; +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 = dgemm( '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 len; + var min; + var max; + var f; + var i; + + min = 1; // 10^min + max = 5; // 10^max + + for ( i = min; i <= max; i++ ) { + len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + f = createBenchmark( len ); + bench( format( '%s::native:ndarray:order(A)=row-major,order(B)=row-major,order(C)=row-major,trans(A)=true,trans(B)=true,size=%d', pkg, len*len ), opts, f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/dgemm/benchmark/benchmark_row_major_nta_ntb.native.js b/lib/node_modules/@stdlib/blas/base/dgemm/benchmark/benchmark_row_major_nta_ntb.native.js new file mode 100644 index 000000000000..a76531379bbe --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dgemm/benchmark/benchmark_row_major_nta_ntb.native.js @@ -0,0 +1,111 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 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 resolve = require( 'path' ).resolve; +var bench = require( '@stdlib/bench' ); +var uniform = require( '@stdlib/random/array/uniform' ); +var format = require( '@stdlib/string/format' ); +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 tryRequire = require( '@stdlib/utils/try-require' ); +var pkg = require( './../package.json' ).name; + + +// VARIABLES // + +var dgemm = tryRequire( resolve( __dirname, './../lib/dgemm.native.js' ) ); +var opts = { + 'skip': ( dgemm instanceof Error ) +}; +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 = dgemm( '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 len; + var min; + var max; + var f; + var i; + + min = 1; // 10^min + max = 5; // 10^max + + for ( i = min; i <= max; i++ ) { + len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + f = createBenchmark( len ); + bench( format( '%s::native:order(A)=row-major,order(B)=row-major,order(C)=row-major,trans(A)=false,trans(B)=false,size=%d', pkg, len*len ), opts, f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/dgemm/benchmark/benchmark_row_major_nta_tb.native.js b/lib/node_modules/@stdlib/blas/base/dgemm/benchmark/benchmark_row_major_nta_tb.native.js new file mode 100644 index 000000000000..360fd5aee84d --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dgemm/benchmark/benchmark_row_major_nta_tb.native.js @@ -0,0 +1,111 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 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 resolve = require( 'path' ).resolve; +var bench = require( '@stdlib/bench' ); +var uniform = require( '@stdlib/random/array/uniform' ); +var format = require( '@stdlib/string/format' ); +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 tryRequire = require( '@stdlib/utils/try-require' ); +var pkg = require( './../package.json' ).name; + + +// VARIABLES // + +var dgemm = tryRequire( resolve( __dirname, './../lib/dgemm.native.js' ) ); +var opts = { + 'skip': ( dgemm instanceof Error ) +}; +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 = dgemm( '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 len; + var min; + var max; + var f; + var i; + + min = 1; // 10^min + max = 5; // 10^max + + for ( i = min; i <= max; i++ ) { + len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + f = createBenchmark( len ); + bench( format( '%s::native:order(A)=row-major,order(B)=row-major,order(C)=row-major,trans(A)=false,trans(B)=true,size=%d', pkg, len*len ), opts, f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/dgemm/benchmark/benchmark_row_major_ta_ntb.native.js b/lib/node_modules/@stdlib/blas/base/dgemm/benchmark/benchmark_row_major_ta_ntb.native.js new file mode 100644 index 000000000000..e2f059d53987 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dgemm/benchmark/benchmark_row_major_ta_ntb.native.js @@ -0,0 +1,111 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 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 resolve = require( 'path' ).resolve; +var bench = require( '@stdlib/bench' ); +var uniform = require( '@stdlib/random/array/uniform' ); +var format = require( '@stdlib/string/format' ); +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 tryRequire = require( '@stdlib/utils/try-require' ); +var pkg = require( './../package.json' ).name; + + +// VARIABLES // + +var dgemm = tryRequire( resolve( __dirname, './../lib/dgemm.native.js' ) ); +var opts = { + 'skip': ( dgemm instanceof Error ) +}; +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 = dgemm( '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 len; + var min; + var max; + var f; + var i; + + min = 1; // 10^min + max = 5; // 10^max + + for ( i = min; i <= max; i++ ) { + len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + f = createBenchmark( len ); + bench( format( '%s::native:order(A)=row-major,order(B)=row-major,order(C)=row-major,trans(A)=true,trans(B)=false,size=%d', pkg, len*len ), opts, f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/dgemm/benchmark/benchmark_row_major_ta_tb.native.js b/lib/node_modules/@stdlib/blas/base/dgemm/benchmark/benchmark_row_major_ta_tb.native.js new file mode 100644 index 000000000000..cfe6e1031d04 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dgemm/benchmark/benchmark_row_major_ta_tb.native.js @@ -0,0 +1,111 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 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 resolve = require( 'path' ).resolve; +var bench = require( '@stdlib/bench' ); +var uniform = require( '@stdlib/random/array/uniform' ); +var format = require( '@stdlib/string/format' ); +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 tryRequire = require( '@stdlib/utils/try-require' ); +var pkg = require( './../package.json' ).name; + + +// VARIABLES // + +var dgemm = tryRequire( resolve( __dirname, './../lib/dgemm.native.js' ) ); +var opts = { + 'skip': ( dgemm instanceof Error ) +}; +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 = dgemm( '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 len; + var min; + var max; + var f; + var i; + + min = 1; // 10^min + max = 5; // 10^max + + for ( i = min; i <= max; i++ ) { + len = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + f = createBenchmark( len ); + bench( format( '%s::native:order(A)=row-major,order(B)=row-major,order(C)=row-major,trans(A)=true,trans(B)=true,size=%d', pkg, len*len ), opts, f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/base/dgemm/benchmark/c/Makefile b/lib/node_modules/@stdlib/blas/base/dgemm/benchmark/c/Makefile new file mode 100644 index 000000000000..0756dc7da20a --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dgemm/benchmark/c/Makefile @@ -0,0 +1,146 @@ +#/ +# @license Apache-2.0 +# +# Copyright (c) 2026 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. +#/ + +# VARIABLES # + +ifndef VERBOSE + QUIET := @ +else + QUIET := +endif + +# Determine the OS ([1][1], [2][2]). +# +# [1]: https://en.wikipedia.org/wiki/Uname#Examples +# [2]: http://stackoverflow.com/a/27776822/2225624 +OS ?= $(shell uname) +ifneq (, $(findstring MINGW,$(OS))) + OS := WINNT +else +ifneq (, $(findstring MSYS,$(OS))) + OS := WINNT +else +ifneq (, $(findstring CYGWIN,$(OS))) + OS := WINNT +else +ifneq (, $(findstring Windows_NT,$(OS))) + OS := WINNT +endif +endif +endif +endif + +# Define the program used for compiling C source files: +ifdef C_COMPILER + CC := $(C_COMPILER) +else + CC := gcc +endif + +# Define the command-line options when compiling C files: +CFLAGS ?= \ + -std=c99 \ + -O3 \ + -Wall \ + -pedantic + +# Determine whether to generate position independent code ([1][1], [2][2]). +# +# [1]: https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#Code-Gen-Options +# [2]: http://stackoverflow.com/questions/5311515/gcc-fpic-option +ifeq ($(OS), WINNT) + fPIC ?= +else + fPIC ?= -fPIC +endif + +# List of includes (e.g., `-I /foo/bar -I /beep/boop/include`): +INCLUDE ?= + +# List of source files: +SOURCE_FILES ?= + +# List of libraries (e.g., `-lopenblas -lpthread`): +LIBRARIES ?= + +# List of library paths (e.g., `-L /foo/bar -L /beep/boop`): +LIBPATH ?= + +# List of C targets: +c_targets := benchmark.length.out + + +# RULES # + +#/ +# Compiles source files. +# +# @param {string} [C_COMPILER] - C compiler (e.g., `gcc`) +# @param {string} [CFLAGS] - C compiler options +# @param {(string|void)} [fPIC] - compiler flag determining whether to generate position independent code (e.g., `-fPIC`) +# @param {string} [INCLUDE] - list of includes (e.g., `-I /foo/bar -I /beep/boop/include`) +# @param {string} [SOURCE_FILES] - list of source files +# @param {string} [LIBPATH] - list of library paths (e.g., `-L /foo/bar -L /beep/boop`) +# @param {string} [LIBRARIES] - list of libraries (e.g., `-lopenblas -lpthread`) +# +# @example +# make +# +# @example +# make all +#/ +all: $(c_targets) + +.PHONY: all + +#/ +# Compiles C source files. +# +# @private +# @param {string} CC - C compiler (e.g., `gcc`) +# @param {string} CFLAGS - C compiler options +# @param {(string|void)} fPIC - compiler flag determining whether to generate position independent code (e.g., `-fPIC`) +# @param {string} INCLUDE - list of includes (e.g., `-I /foo/bar`) +# @param {string} SOURCE_FILES - list of source files +# @param {string} LIBPATH - list of library paths (e.g., `-L /foo/bar`) +# @param {string} LIBRARIES - list of libraries (e.g., `-lopenblas`) +#/ +$(c_targets): %.out: %.c + $(QUIET) $(CC) $(CFLAGS) $(fPIC) $(INCLUDE) -o $@ $(SOURCE_FILES) $< $(LIBPATH) -lm $(LIBRARIES) + +#/ +# Runs compiled benchmarks. +# +# @example +# make run +#/ +run: $(c_targets) + $(QUIET) ./$< + +.PHONY: run + +#/ +# Removes generated files. +# +# @example +# make clean +#/ +clean: + $(QUIET) -rm -f *.o *.out + +.PHONY: clean diff --git a/lib/node_modules/@stdlib/blas/base/dgemm/benchmark/c/benchmark.length.c b/lib/node_modules/@stdlib/blas/base/dgemm/benchmark/c/benchmark.length.c new file mode 100644 index 000000000000..7b7602ea7132 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dgemm/benchmark/c/benchmark.length.c @@ -0,0 +1,234 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 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. +*/ + +#include "stdlib/blas/base/dgemm.h" +#include "stdlib/blas/base/shared.h" +#include +#include +#include +#include +#include + +#define NAME "dgemm" +#define ITERATIONS 1000000 +#define REPEATS 3 +#define MIN 1 +#define MAX 6 + +/** +* Prints the TAP version. +*/ +static void print_version( void ) { + printf( "TAP version 13\n" ); +} + +/** +* Prints the TAP summary. +* +* @param total total number of tests +* @param passing total number of passing tests +*/ +static void print_summary( int total, int passing ) { + printf( "#\n" ); + printf( "1..%d\n", total ); // TAP plan + printf( "# total %d\n", total ); + printf( "# pass %d\n", passing ); + printf( "#\n" ); + printf( "# ok\n" ); +} + +/** +* Prints benchmarks results. +* +* @param iterations number of iterations +* @param elapsed elapsed time in seconds +*/ +static void print_results( int iterations, double elapsed ) { + double rate = (double)iterations / elapsed; + printf( " ---\n" ); + printf( " iterations: %d\n", iterations ); + printf( " elapsed: %0.9f\n", elapsed ); + printf( " rate: %0.9f\n", rate ); + printf( " ...\n" ); +} + +/** +* Returns a clock time. +* +* @return clock time +*/ +static double tic( void ) { + struct timeval now; + gettimeofday( &now, NULL ); + return (double)now.tv_sec + (double)now.tv_usec/1.0e6; +} + +/** +* Generates a random number on the interval [0,1). +* +* @return random number +*/ +static double rand_double( void ) { + int r = rand(); + return (double)r / ( (double)RAND_MAX + 1.0 ); +} + +/** +* Runs a benchmark for the row-major interface. +* +* @param iterations number of iterations +* @param N array dimension size +* @return elapsed time in seconds +*/ +static double benchmark1( int iterations, int N ) { + double elapsed; + double *A; + double *B; + double *C; + double t; + int i; + int j; + + A = (double *)malloc( N*N * sizeof(double) ); + B = (double *)malloc( N*N * sizeof(double) ); + C = (double *)malloc( N*N * sizeof(double) ); + if ( A == NULL || B == NULL || C == NULL ) { + printf( "# Error: failed to allocate memory\n" ); + free( A ); + free( B ); + free( C ); + return 0.0; + } + for ( i = 0; i < N; i++ ) { + for ( j = 0; j < N; j++ ) { + A[ (i*N)+j ] = ( rand_double()*20.0 ) - 10.0; + B[ (i*N)+j ] = ( rand_double()*20.0 ) - 10.0; + C[ (i*N)+j ] = ( rand_double()*20.0 ) - 10.0; + } + } + t = tic(); + for ( i = 0; i < iterations; i++ ) { + // cppcheck-suppress uninitvar + c_dgemm( CblasRowMajor, CblasNoTrans, CblasNoTrans, N, N, N, 1.0, A, N, B, N, 0.0, C, N ); + if ( C[ i%(N*2) ] != C[ i%(N*2) ] ) { + printf( "should not return NaN\n" ); + break; + } + } + elapsed = tic() - t; + if ( C[ i%(N*2) ] != C[ i%(N*2) ] ) { + printf( "should not return NaN\n" ); + } + free( A ); + free( B ); + free( C ); + return elapsed; +} + +/** +* Runs a benchmark for the ndarray interface. +* +* @param iterations number of iterations +* @param N array dimension size +* @return elapsed time in seconds +*/ +static double benchmark2( int iterations, int N ) { + double elapsed; + double *A; + double *B; + double *C; + double t; + int i; + int j; + + A = (double *)malloc( N*N * sizeof(double) ); + B = (double *)malloc( N*N * sizeof(double) ); + C = (double *)malloc( N*N * sizeof(double) ); + if ( A == NULL || B == NULL || C == NULL ) { + printf( "# Error: failed to allocate memory\n" ); + free( A ); + free( B ); + free( C ); + return 0.0; + } + for ( i = 0; i < N; i++ ) { + for ( j = 0; j < N; j++ ) { + A[ (i*N)+j ] = ( rand_double()*20.0 ) - 10.0; + B[ (i*N)+j ] = ( rand_double()*20.0 ) - 10.0; + C[ (i*N)+j ] = ( rand_double()*20.0 ) - 10.0; + } + } + t = tic(); + for ( i = 0; i < iterations; i++ ) { + // cppcheck-suppress uninitvar + c_dgemm_ndarray( CblasNoTrans, CblasNoTrans, N, N, N, 1.0, A, N, 1, 0, B, N, 1, 0, 0.0, C, N, 1, 0 ); + if ( C[ i%(N*2) ] != C[ i%(N*2) ] ) { + printf( "should not return NaN\n" ); + break; + } + } + elapsed = tic() - t; + if ( C[ i%(N*2) ] != C[ i%(N*2) ] ) { + printf( "should not return NaN\n" ); + } + free( A ); + free( B ); + free( C ); + return elapsed; +} + +/** +* Main execution sequence. +*/ +int main( void ) { + double elapsed; + int count; + int iter; + int N; + int i; + int j; + + // Use the current time to seed the random number generator: + srand( time( NULL ) ); + + print_version(); + count = 0; + for ( i = MIN; i <= MAX; i++ ) { + N = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + iter = ITERATIONS / pow( 10, i-1 ); + for ( j = 0; j < REPEATS; j++ ) { + count += 1; + printf( "# c::%s:size=%d\n", NAME, N*N ); + elapsed = benchmark1( iter, N ); + print_results( iter, elapsed ); + printf( "ok %d benchmark finished\n", count ); + } + } + for ( i = MIN; i <= MAX; i++ ) { + N = floor( pow( pow( 10, i ), 1.0/2.0 ) ); + iter = ITERATIONS / pow( 10, i-1 ); + for ( j = 0; j < REPEATS; j++ ) { + count += 1; + printf( "# c::%s:ndarray:size=%d\n", NAME, N*N ); + elapsed = benchmark2( iter, N ); + print_results( iter, elapsed ); + printf( "ok %d benchmark finished\n", count ); + } + } + print_summary( count, count ); +} diff --git a/lib/node_modules/@stdlib/blas/base/dgemm/benchmark/fortran/Makefile b/lib/node_modules/@stdlib/blas/base/dgemm/benchmark/fortran/Makefile new file mode 100644 index 000000000000..c004ec67dc9c --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dgemm/benchmark/fortran/Makefile @@ -0,0 +1,141 @@ +#/ +# @license Apache-2.0 +# +# Copyright (c) 2026 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. +#/ + +# VARIABLES # + +ifndef VERBOSE + QUIET := @ +else + QUIET := +endif + +# Determine the OS ([1][1], [2][2]). +# +# [1]: https://en.wikipedia.org/wiki/Uname#Examples +# [2]: http://stackoverflow.com/a/27776822/2225624 +OS ?= $(shell uname) +ifneq (, $(findstring MINGW,$(OS))) + OS := WINNT +else +ifneq (, $(findstring MSYS,$(OS))) + OS := WINNT +else +ifneq (, $(findstring CYGWIN,$(OS))) + OS := WINNT +else +ifneq (, $(findstring Windows_NT,$(OS))) + OS := WINNT +endif +endif +endif +endif + +# Define the program used for compiling Fortran source files: +ifdef FORTRAN_COMPILER + FC := $(FORTRAN_COMPILER) +else + FC := gfortran +endif + +# Define the command-line options when compiling Fortran files: +FFLAGS ?= \ + -std=f95 \ + -ffree-form \ + -O3 \ + -Wall \ + -Wextra \ + -Wno-compare-reals \ + -Wimplicit-interface \ + -fno-underscoring \ + -pedantic + +# Determine whether to generate position independent code ([1][1], [2][2]). +# +# [1]: https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#Code-Gen-Options +# [2]: http://stackoverflow.com/questions/5311515/gcc-fpic-option +ifeq ($(OS), WINNT) + fPIC ?= +else + fPIC ?= -fPIC +endif + +# List of includes (e.g., `-I /foo/bar -I /beep/boop`): +INCLUDE ?= + +# List of Fortran source files: +SOURCE_FILES ?= ../../src/dgemm.f ../../../xerbla/src/xerbla.f + +# List of Fortran targets: +f_targets := benchmark.length.out + + +# RULES # + +#/ +# Compiles Fortran source files. +# +# @param {string} SOURCE_FILES - list of Fortran source files +# @param {string} [INCLUDE] - list of includes (e.g., `-I /foo/bar -I /beep/boop`) +# @param {string} [FORTRAN_COMPILER] - Fortran compiler +# @param {string} [FFLAGS] - Fortran compiler flags +# @param {(string|void)} [fPIC] - compiler flag indicating whether to generate position independent code +# +# @example +# make +# +# @example +# make all +#/ +all: $(f_targets) + +.PHONY: all + +#/ +# Compiles Fortran source files. +# +# @private +# @param {string} SOURCE_FILES - list of Fortran source files +# @param {(string|void)} INCLUDE - list of includes (e.g., `-I /foo/bar -I /beep/boop`) +# @param {string} FC - Fortran compiler +# @param {string} FFLAGS - Fortran compiler flags +# @param {(string|void)} fPIC - compiler flag indicating whether to generate position independent code +#/ +$(f_targets): %.out: %.f + $(QUIET) $(FC) $(FFLAGS) $(fPIC) $(INCLUDE) -o $@ $(SOURCE_FILES) $< + +#/ +# Runs compiled benchmarks. +# +# @example +# make run +#/ +run: $(f_targets) + $(QUIET) ./$< + +.PHONY: run + +#/ +# Removes generated files. +# +# @example +# make clean +#/ +clean: + $(QUIET) -rm -f *.o *.out + +.PHONY: clean diff --git a/lib/node_modules/@stdlib/blas/base/dgemm/benchmark/fortran/benchmark.length.f b/lib/node_modules/@stdlib/blas/base/dgemm/benchmark/fortran/benchmark.length.f new file mode 100644 index 000000000000..974123696c2a --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dgemm/benchmark/fortran/benchmark.length.f @@ -0,0 +1,218 @@ +!> +! @license Apache-2.0 +! +! Copyright (c) 2026 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. +!< + +program bench + implicit none + ! .. + ! Local constants: + character(5), parameter :: name = 'dgemm' ! if changed, be sure to adjust length + integer, parameter :: iterations = 1000000 + integer, parameter :: repeats = 3 + integer, parameter :: min = 1 + integer, parameter :: max = 6 + ! .. + ! Run the benchmarks: + call main() + ! .. + ! Functions: +contains + ! .. + ! Prints the TAP version. + ! .. + subroutine print_version() + print '(A)', 'TAP version 13' + end subroutine print_version + ! .. + ! Prints the TAP summary. + ! + ! @param {integer} total - total number of tests + ! @param {integer} passing - total number of passing tests + ! .. + subroutine print_summary( total, passing ) + ! .. + ! Scalar arguments: + integer, intent(in) :: total, passing + ! .. + ! Local variables: + character(len=999) :: str, tmp + ! .. + ! Intrinsic functions: + intrinsic adjustl, trim + ! .. + print '(A)', '#' + ! .. + write (str, '(I15)') total ! TAP plan + tmp = adjustl( str ) + print '(A,A)', '1..', trim( tmp ) + ! .. + print '(A,A)', '# total ', trim( tmp ) + ! .. + write (str, '(I15)') passing + tmp = adjustl( str ) + print '(A,A)', '# pass ', trim( tmp ) + ! .. + print '(A)', '#' + print '(A)', '# ok' + end subroutine print_summary + ! .. + ! Prints benchmarks results. + ! + ! @param {integer} iterations - number of iterations + ! @param {double} elapsed - elapsed time in seconds + ! .. + subroutine print_results( iterations, elapsed ) + ! .. + ! Scalar arguments: + double precision, intent(in) :: elapsed + integer, intent(in) :: iterations + ! .. + ! Local variables: + double precision :: rate + character(len=999) :: str, tmp + ! .. + ! Intrinsic functions: + intrinsic dble, adjustl, trim + ! .. + rate = dble( iterations ) / elapsed + ! .. + print '(A)', ' ---' + ! .. + write (str, '(I15)') iterations + tmp = adjustl( str ) + print '(A,A)', ' iterations: ', trim( tmp ) + ! .. + write (str, '(f100.9)') elapsed + tmp = adjustl( str ) + print '(A,A)', ' elapsed: ', trim( tmp ) + ! .. + write( str, '(f100.9)') rate + tmp = adjustl( str ) + print '(A,A)', ' rate: ', trim( tmp ) + ! .. + print '(A)', ' ...' + end subroutine print_results + ! .. + ! Runs a benchmark. + ! + ! @param {integer} iterations - number of iterations + ! @param {integer} N - array dimension size + ! @return {double} elapsed time in seconds + ! .. + double precision function benchmark( iterations, N ) + ! .. + ! External functions: + interface + subroutine dgemm( transA, transB, M, N, K, alpha, A, LDA, B, LDB, beta, C, LDC ) + character(len=1) :: transA, transB + integer :: M, N, K, LDA, LDB, LDC + double precision :: A(LDA,*), B(LDB,*), C(LDC,*) + double precision :: alpha, beta + end subroutine dgemm + end interface + ! .. + ! Scalar arguments: + integer, intent(in) :: iterations, N + ! .. + ! Local scalars: + double precision :: elapsed, r + double precision :: t1, t2 + integer :: i, j + ! .. + ! Local arrays: + double precision, allocatable :: A(:,:), B(:,:), C(:,:) + ! .. + ! Intrinsic functions: + intrinsic random_number, cpu_time, mod + ! .. + ! Allocate arrays: + allocate( A(N,N), B(N,N), C(N,N) ) + ! .. + do i = 1, N + do j = 1, N + call random_number( r ) + A(i, j) = ( r*20.0 ) - 10.0 + call random_number( r ) + B(i, j) = ( r*20.0 ) - 10.0 + call random_number( r ) + C(i, j) = ( r*20.0 ) - 10.0 + end do + end do + ! .. + call cpu_time( t1 ) + ! .. + j = 1 + do i = 1, iterations + call dgemm( 'N', 'N', N, N, N, 1.0d0, A, N, B, N, 0.0d0, C, N ) + j = mod( i, N ) + 1 + if ( C( j, j ) /= C( j, j ) ) then + print '(A)', 'should not return NaN' + exit + end if + end do + ! .. + call cpu_time( t2 ) + ! .. + elapsed = t2 - t1 + ! .. + if ( C( j, j ) /= C( j, j ) ) then + print '(A)', 'should not return NaN' + end if + ! .. + ! Deallocate arrays: + deallocate( A, B, C ) + ! .. + benchmark = elapsed + return + end function benchmark + ! .. + ! Main execution sequence. + ! .. + subroutine main() + ! .. + ! Local variables: + character(len=999) :: str, tmp + double precision :: elapsed + integer :: i, j, N, count, iter + ! .. + ! Intrinsic functions: + intrinsic adjustl, trim, floor, sqrt + ! .. + call print_version() + count = 0 + do i = min, max + N = floor( ( 10**i )**(1.0/2.0) ) + iter = iterations / 10**(i-1) + do j = 1, repeats + count = count + 1 + ! .. + write (str, '(I15)') N*N + tmp = adjustl( str ) + print '(A,A,A,A)', '# fortran::', name, ':size=', trim(tmp) + ! .. + elapsed = benchmark( iter, N ) + ! .. + call print_results( iter, elapsed ) + ! .. + write (str, '(I15)') count + tmp = adjustl( str ) + print '(A,A,A)', 'ok ', trim( tmp ), ' benchmark finished' + end do + end do + call print_summary( count, count ) + end subroutine main +end program bench diff --git a/lib/node_modules/@stdlib/blas/base/dgemm/binding.gyp b/lib/node_modules/@stdlib/blas/base/dgemm/binding.gyp new file mode 100644 index 000000000000..60dce9d0b31a --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dgemm/binding.gyp @@ -0,0 +1,265 @@ +# @license Apache-2.0 +# +# Copyright (c) 2026 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. + +# A `.gyp` file for building a Node.js native add-on. +# +# [1]: https://gyp.gsrc.io/docs/InputFormatReference.md +# [2]: https://gyp.gsrc.io/docs/UserDocumentation.md +{ + # List of files to include in this file: + 'includes': [ + './include.gypi', + ], + + # Define variables to be used throughout the configuration for all targets: + 'variables': { + # Target name should match the add-on export name: + 'addon_target_name%': 'addon', + + # Fortran compiler (to override -Dfortran_compiler=): + 'fortran_compiler%': 'gfortran', + + # Fortran compiler flags: + 'fflags': [ + # Specify the Fortran standard to which a program is expected to conform: + '-std=f95', + + # Indicate that the layout is free-form source code: + '-ffree-form', + + # Aggressive optimization: + '-O3', + + # Enable commonly used warning options: + '-Wall', + + # Warn if source code contains problematic language features: + '-Wextra', + + # Warn if a procedure is called without an explicit interface: + '-Wimplicit-interface', + + # Do not transform names of entities specified in Fortran source files by appending underscores (i.e., don't mangle names, thus allowing easier usage in C wrappers): + '-fno-underscoring', + + # Warn if source code contains Fortran 95 extensions and C-language constructs: + '-pedantic', + + # Compile but do not link (output is an object file): + '-c', + ], + + # Set variables based on the host OS: + 'conditions': [ + [ + 'OS=="win"', + { + # Define the object file suffix: + 'obj': 'obj', + }, + { + # Define the object file suffix: + 'obj': 'o', + } + ], # end condition (OS=="win") + ], # end conditions + }, # end variables + + # Define compile targets: + 'targets': [ + + # Target to generate an add-on: + { + # The target name should match the add-on export name: + 'target_name': '<(addon_target_name)', + + # Define dependencies: + 'dependencies': [], + + # Define directories which contain relevant include headers: + 'include_dirs': [ + # Local include directory: + '<@(include_dirs)', + ], + + # List of source files: + 'sources': [ + '<@(src_files)', + ], + + # Settings which should be applied when a target's object files are used as linker input: + 'link_settings': { + # Define libraries: + 'libraries': [ + '<@(libraries)', + ], + + # Define library directories: + 'library_dirs': [ + '<@(library_dirs)', + ], + }, + + # C/C++ compiler flags: + 'cflags': [ + # Enable commonly used warning options: + '-Wall', + + # Aggressive optimization: + '-O3', + ], + + # C specific compiler flags: + 'cflags_c': [ + # Specify the C standard to which a program is expected to conform: + '-std=c99', + ], + + # C++ specific compiler flags: + 'cflags_cpp': [ + # Specify the C++ standard to which a program is expected to conform: + '-std=c++11', + ], + + # Linker flags: + 'ldflags': [], + + # Apply conditions based on the host OS: + 'conditions': [ + [ + 'OS=="mac"', + { + # Linker flags: + 'ldflags': [ + '-undefined dynamic_lookup', + '-Wl,-no-pie', + '-Wl,-search_paths_first', + ], + }, + ], # end condition (OS=="mac") + [ + 'OS!="win"', + { + # C/C++ flags: + 'cflags': [ + # Generate platform-independent code: + '-fPIC', + ], + }, + ], # end condition (OS!="win") + ], # end conditions + + # Define custom build actions for particular inputs: + 'rules': [ + { + # Define a rule for processing Fortran files: + 'extension': 'f', + + # Define the pathnames to be used as inputs when performing processing: + 'inputs': [ + # Full path of the current input: + '<(RULE_INPUT_PATH)' + ], + + # Define the outputs produced during processing: + 'outputs': [ + # Store an output object file in a directory for placing intermediate results (only accessible within a single target): + '<(INTERMEDIATE_DIR)/<(RULE_INPUT_ROOT).<(obj)' + ], + + # Define the rule for compiling Fortran based on the host OS: + 'conditions': [ + [ + 'OS=="win"', + + # Rule to compile Fortran on Windows: + { + 'rule_name': 'compile_fortran_windows', + 'message': 'Compiling Fortran file <(RULE_INPUT_PATH) on Windows...', + + 'process_outputs_as_sources': 0, + + # Define the command-line invocation: + 'action': [ + '<(fortran_compiler)', + '<@(fflags)', + '<@(_inputs)', + '-o', + '<@(_outputs)', + ], + }, + + # Rule to compile Fortran on non-Windows: + { + 'rule_name': 'compile_fortran_linux', + 'message': 'Compiling Fortran file <(RULE_INPUT_PATH) on Linux...', + + 'process_outputs_as_sources': 1, + + # Define the command-line invocation: + 'action': [ + '<(fortran_compiler)', + '<@(fflags)', + '-fPIC', # generate platform-independent code + '<@(_inputs)', + '-o', + '<@(_outputs)', + ], + } + ], # end condition (OS=="win") + ], # end conditions + }, # end rule (extension=="f") + ], # end rules + }, # end target <(addon_target_name) + + # Target to copy a generated add-on to a standard location: + { + 'target_name': 'copy_addon', + + # Declare that the output of this target is not linked: + 'type': 'none', + + # Define dependencies: + 'dependencies': [ + # Require that the add-on be generated before building this target: + '<(addon_target_name)', + ], + + # Define a list of actions: + 'actions': [ + { + 'action_name': 'copy_addon', + 'message': 'Copying addon...', + + # Explicitly list the inputs in the command-line invocation below: + 'inputs': [], + + # Declare the expected outputs: + 'outputs': [ + '<(addon_output_dir)/<(addon_target_name).node', + ], + + # Define the command-line invocation: + 'action': [ + 'cp', + '<(PRODUCT_DIR)/<(addon_target_name).node', + '<(addon_output_dir)/<(addon_target_name).node', + ], + }, + ], # end actions + }, # end target copy_addon + ], # end targets +} diff --git a/lib/node_modules/@stdlib/blas/base/dgemm/examples/c/Makefile b/lib/node_modules/@stdlib/blas/base/dgemm/examples/c/Makefile new file mode 100644 index 000000000000..c8f8e9a1517b --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dgemm/examples/c/Makefile @@ -0,0 +1,146 @@ +#/ +# @license Apache-2.0 +# +# Copyright (c) 2026 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. +#/ + +# VARIABLES # + +ifndef VERBOSE + QUIET := @ +else + QUIET := +endif + +# Determine the OS ([1][1], [2][2]). +# +# [1]: https://en.wikipedia.org/wiki/Uname#Examples +# [2]: http://stackoverflow.com/a/27776822/2225624 +OS ?= $(shell uname) +ifneq (, $(findstring MINGW,$(OS))) + OS := WINNT +else +ifneq (, $(findstring MSYS,$(OS))) + OS := WINNT +else +ifneq (, $(findstring CYGWIN,$(OS))) + OS := WINNT +else +ifneq (, $(findstring Windows_NT,$(OS))) + OS := WINNT +endif +endif +endif +endif + +# Define the program used for compiling C source files: +ifdef C_COMPILER + CC := $(C_COMPILER) +else + CC := gcc +endif + +# Define the command-line options when compiling C files: +CFLAGS ?= \ + -std=c99 \ + -O3 \ + -Wall \ + -pedantic + +# Determine whether to generate position independent code ([1][1], [2][2]). +# +# [1]: https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#Code-Gen-Options +# [2]: http://stackoverflow.com/questions/5311515/gcc-fpic-option +ifeq ($(OS), WINNT) + fPIC ?= +else + fPIC ?= -fPIC +endif + +# List of includes (e.g., `-I /foo/bar -I /beep/boop/include`): +INCLUDE ?= + +# List of source files: +SOURCE_FILES ?= + +# List of libraries (e.g., `-lopenblas -lpthread`): +LIBRARIES ?= + +# List of library paths (e.g., `-L /foo/bar -L /beep/boop`): +LIBPATH ?= + +# List of C targets: +c_targets := example.out + + +# RULES # + +#/ +# Compiles source files. +# +# @param {string} [C_COMPILER] - C compiler (e.g., `gcc`) +# @param {string} [CFLAGS] - C compiler options +# @param {(string|void)} [fPIC] - compiler flag determining whether to generate position independent code (e.g., `-fPIC`) +# @param {string} [INCLUDE] - list of includes (e.g., `-I /foo/bar -I /beep/boop/include`) +# @param {string} [SOURCE_FILES] - list of source files +# @param {string} [LIBPATH] - list of library paths (e.g., `-L /foo/bar -L /beep/boop`) +# @param {string} [LIBRARIES] - list of libraries (e.g., `-lopenblas -lpthread`) +# +# @example +# make +# +# @example +# make all +#/ +all: $(c_targets) + +.PHONY: all + +#/ +# Compiles C source files. +# +# @private +# @param {string} CC - C compiler (e.g., `gcc`) +# @param {string} CFLAGS - C compiler options +# @param {(string|void)} fPIC - compiler flag determining whether to generate position independent code (e.g., `-fPIC`) +# @param {string} INCLUDE - list of includes (e.g., `-I /foo/bar`) +# @param {string} SOURCE_FILES - list of source files +# @param {string} LIBPATH - list of library paths (e.g., `-L /foo/bar`) +# @param {string} LIBRARIES - list of libraries (e.g., `-lopenblas`) +#/ +$(c_targets): %.out: %.c + $(QUIET) $(CC) $(CFLAGS) $(fPIC) $(INCLUDE) -o $@ $(SOURCE_FILES) $< $(LIBPATH) -lm $(LIBRARIES) + +#/ +# Runs compiled examples. +# +# @example +# make run +#/ +run: $(c_targets) + $(QUIET) ./$< + +.PHONY: run + +#/ +# Removes generated files. +# +# @example +# make clean +#/ +clean: + $(QUIET) -rm -f *.o *.out + +.PHONY: clean diff --git a/lib/node_modules/@stdlib/blas/base/dgemm/examples/c/example.c b/lib/node_modules/@stdlib/blas/base/dgemm/examples/c/example.c new file mode 100644 index 000000000000..9067b950779a --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dgemm/examples/c/example.c @@ -0,0 +1,57 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 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. +*/ + +#include "stdlib/blas/base/dgemm.h" +#include "stdlib/blas/base/shared.h" +#include + +int main( void ) { + // Define a 2x2 output matrix stored in row-major order: + double C[ 2*2 ] = { + 0.0, 0.0, + 0.0, 0.0 + }; + + // Define a 2x3 matrix `A` stored in row-major order: + const double A[ 2*3 ] = { + 1.0, 2.0, 3.0, + 4.0, 5.0, 6.0 + }; + + // Define a 3x2 matrix `B` stored in row-major order: + const double B[ 3*2 ] = { + 7.0, 8.0, + 9.0, 10.0, + 11.0, 12.0 + }; + + // Specify matrix dimensions: + const int M = 2; // rows of op(A) and C + const int N = 2; // columns of op(B) and C + const int K = 3; // columns of op(A) and rows of op(B) + + // Perform operation: C = 1.0*A*B + 0.0*C + c_dgemm( CblasRowMajor, CblasNoTrans, CblasNoTrans, M, N, K, 1.0, A, K, B, N, 0.0, C, N ); + + // Print the result: + for ( int i = 0; i < M; i++ ) { + for ( int j = 0; j < N; j++ ) { + printf( "C[%i,%i] = %lf\n", i, j, C[ (i*N)+j ] ); + } + } +} diff --git a/lib/node_modules/@stdlib/blas/base/dgemm/include.gypi b/lib/node_modules/@stdlib/blas/base/dgemm/include.gypi new file mode 100644 index 000000000000..dcb556d250e8 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dgemm/include.gypi @@ -0,0 +1,70 @@ +# @license Apache-2.0 +# +# Copyright (c) 2026 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. + +# A GYP include file for building a Node.js native add-on. +# +# Note that nesting variables is required due to how GYP processes a configuration. Any variables defined within a nested 'variables' section is defined in the outer scope. Thus, conditions in the outer variable scope are free to use these variables without running into "variable undefined" errors. +# +# Main documentation: +# +# [1]: https://gyp.gsrc.io/docs/InputFormatReference.md +# [2]: https://gyp.gsrc.io/docs/UserDocumentation.md +# +# Variable nesting hacks: +# +# [3]: https://chromium.googlesource.com/external/skia/gyp/+/master/common_variables.gypi +# [4]: https://src.chromium.org/viewvc/chrome/trunk/src/build/common.gypi?revision=127004 +{ + # Define variables to be used throughout the configuration for all targets: + 'variables': { + 'variables': { + # Host BLAS library (to override -Dblas=): + 'blas%': '', + + # Path to BLAS library (to override -Dblas_dir=): + 'blas_dir%': '', + }, # end variables + + # Source directory: + 'src_dir': './src', + + # Include directories: + 'include_dirs': [ + '<@(blas_dir)', + ' [ 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 isrm; + var valc; + 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`.', N ) ); + } + if ( K < 0 ) { + throw new RangeError( format( 'invalid argument. Sixth argument must be a nonnegative integer. Value: `%d`.', K ) ); + } + isrm = isRowMajor( order ); + if ( + ( isrm && transA === 'no-transpose' ) || + ( !isrm && transA !== 'no-transpose' ) + ) { + nrowsa = K; + } else { + nrowsa = M; + } + if ( + ( isrm && transB === 'no-transpose' ) || + ( !isrm && transB !== 'no-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 ) ); + } + addon( resolveOrder( order ), resolveTrans( transA ), resolveTrans( transB ), M, N, K, alpha, A, LDA, B, LDB, beta, C, LDC ); + return C; +} + + +// EXPORTS // + +module.exports = dgemm; diff --git a/lib/node_modules/@stdlib/blas/base/dgemm/lib/native.js b/lib/node_modules/@stdlib/blas/base/dgemm/lib/native.js new file mode 100644 index 000000000000..19e46d42238e --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dgemm/lib/native.js @@ -0,0 +1,35 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var setReadOnly = require( '@stdlib/utils/define-nonenumerable-read-only-property' ); +var dgemm = require( './dgemm.native.js' ); +var ndarray = require( './ndarray.native.js' ); + + +// MAIN // + +setReadOnly( dgemm, 'ndarray', ndarray ); + + +// EXPORTS // + +module.exports = dgemm; diff --git a/lib/node_modules/@stdlib/blas/base/dgemm/lib/ndarray.native.js b/lib/node_modules/@stdlib/blas/base/dgemm/lib/ndarray.native.js new file mode 100644 index 000000000000..ce8b6a6907ae --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dgemm/lib/ndarray.native.js @@ -0,0 +1,99 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 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 resolveTrans = require( '@stdlib/blas/base/transpose-operation-resolve-enum' ); +var format = require( '@stdlib/string/format' ); +var addon = require( './../src/addon.node' ); + + +// MAIN // + +/** +* 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, and `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 `op(A)` and `C` +* @param {NonNegativeInteger} N - number of columns in `op(B)` and `C` +* @param {NonNegativeInteger} K - number of columns in `op(A)` and rows in `op(B)` +* @param {number} alpha - scalar constant +* @param {Float64Array} 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 {Float64Array} 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 {Float64Array} C - result matrix +* @param {integer} strideC1 - stride of the first dimension of `C` +* @param {integer} strideC2 - stride of the second dimension of `C` +* @param {NonNegativeInteger} offsetC - starting index for `C` +* @throws {TypeError} first argument must be a valid transpose operation +* @throws {TypeError} second argument must be a valid transpose operation +* @throws {RangeError} third argument must be a nonnegative integer +* @throws {RangeError} fourth argument must be a nonnegative integer +* @throws {RangeError} fifth argument must be a nonnegative integer +* @returns {Float64Array} `C` +* +* @example +* var Float64Array = require( '@stdlib/array/float64' ); +* +* var A = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); +* var B = new Float64Array( [ 1.0, 1.0, 0.0, 1.0 ] ); +* var C = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); +* +* dgemm( '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 dgemm( 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`.', N ) ); + } + 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 nonzero. Value: `%d`.', strideC1 ) ); + } + if ( strideC2 === 0 ) { + throw new RangeError( format( 'invalid argument. Eighteenth argument must be nonzero. Value: `%d`.', strideC2 ) ); + } + addon.ndarray( resolveTrans( transA ), resolveTrans( transB ), M, N, K, alpha, A, strideA1, strideA2, offsetA, B, strideB1, strideB2, offsetB, beta, C, strideC1, strideC2, offsetC ); // eslint-disable-line max-len + return C; +} + + +// EXPORTS // + +module.exports = dgemm; diff --git a/lib/node_modules/@stdlib/blas/base/dgemm/manifest.json b/lib/node_modules/@stdlib/blas/base/dgemm/manifest.json new file mode 100644 index 000000000000..5dffff776f6c --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dgemm/manifest.json @@ -0,0 +1,458 @@ +{ + "options": { + "task": "build", + "os": "linux", + "blas": "", + "wasm": false + }, + "fields": [ + { + "field": "src", + "resolve": true, + "relative": true + }, + { + "field": "include", + "resolve": true, + "relative": true + }, + { + "field": "libraries", + "resolve": false, + "relative": false + }, + { + "field": "libpath", + "resolve": true, + "relative": false + } + ], + "confs": [ + { + "task": "build", + "os": "linux", + "blas": "", + "wasm": false, + "src": [ + "./src/dgemm.f", + "./src/dgemm_f.c", + "./src/dgemm_ndarray.c" + ], + "include": [ + "./include" + ], + "libraries": [], + "libpath": [], + "dependencies": [ + "@stdlib/blas/base/shared", + "@stdlib/blas/base/xerbla", + "@stdlib/napi/export", + "@stdlib/napi/argv", + "@stdlib/napi/argv-int64", + "@stdlib/napi/argv-int32", + "@stdlib/napi/argv-strided-float64array", + "@stdlib/napi/argv-strided-float64array2d", + "@stdlib/napi/argv-double" + ] + }, + { + "task": "benchmark", + "os": "linux", + "blas": "", + "wasm": false, + "src": [ + "./src/dgemm.c", + "./src/dgemm_ndarray.c" + ], + "include": [ + "./include" + ], + "libraries": [], + "libpath": [], + "dependencies": [ + "@stdlib/blas/base/shared", + "@stdlib/blas/base/xerbla" + ] + }, + { + "task": "examples", + "os": "linux", + "blas": "", + "wasm": false, + "src": [ + "./src/dgemm.c", + "./src/dgemm_ndarray.c" + ], + "include": [ + "./include" + ], + "libraries": [], + "libpath": [], + "dependencies": [ + "@stdlib/blas/base/shared", + "@stdlib/blas/base/xerbla" + ] + }, + + { + "task": "build", + "os": "linux", + "blas": "openblas", + "wasm": false, + "src": [ + "./src/dgemm_cblas.c", + "./src/dgemm_ndarray.c" + ], + "include": [ + "./include" + ], + "libraries": [ + "-lopenblas", + "-lpthread" + ], + "libpath": [], + "dependencies": [ + "@stdlib/blas/base/shared", + "@stdlib/napi/export", + "@stdlib/napi/argv", + "@stdlib/napi/argv-int64", + "@stdlib/napi/argv-int32", + "@stdlib/napi/argv-strided-float64array", + "@stdlib/napi/argv-strided-float64array2d", + "@stdlib/napi/argv-double" + ] + }, + { + "task": "benchmark", + "os": "linux", + "blas": "openblas", + "wasm": false, + "src": [ + "./src/dgemm_cblas.c", + "./src/dgemm_ndarray.c" + ], + "include": [ + "./include" + ], + "libraries": [ + "-lopenblas", + "-lpthread" + ], + "libpath": [], + "dependencies": [ + "@stdlib/blas/base/shared" + ] + }, + { + "task": "examples", + "os": "linux", + "blas": "openblas", + "wasm": false, + "src": [ + "./src/dgemm_cblas.c", + "./src/dgemm_ndarray.c" + ], + "include": [ + "./include" + ], + "libraries": [ + "-lopenblas", + "-lpthread" + ], + "libpath": [], + "dependencies": [ + "@stdlib/blas/base/shared" + ] + }, + + { + "task": "build", + "os": "mac", + "blas": "", + "wasm": false, + "src": [ + "./src/dgemm.f", + "./src/dgemm_f.c", + "./src/dgemm_ndarray.c" + ], + "include": [ + "./include" + ], + "libraries": [], + "libpath": [], + "dependencies": [ + "@stdlib/blas/base/shared", + "@stdlib/blas/base/xerbla", + "@stdlib/napi/export", + "@stdlib/napi/argv", + "@stdlib/napi/argv-int64", + "@stdlib/napi/argv-int32", + "@stdlib/napi/argv-strided-float64array", + "@stdlib/napi/argv-strided-float64array2d", + "@stdlib/napi/argv-double" + ] + }, + { + "task": "benchmark", + "os": "mac", + "blas": "", + "wasm": false, + "src": [ + "./src/dgemm.c", + "./src/dgemm_ndarray.c" + ], + "include": [ + "./include" + ], + "libraries": [], + "libpath": [], + "dependencies": [ + "@stdlib/blas/base/shared", + "@stdlib/blas/base/xerbla" + ] + }, + { + "task": "examples", + "os": "mac", + "blas": "", + "wasm": false, + "src": [ + "./src/dgemm.c", + "./src/dgemm_ndarray.c" + ], + "include": [ + "./include" + ], + "libraries": [], + "libpath": [], + "dependencies": [ + "@stdlib/blas/base/shared", + "@stdlib/blas/base/xerbla" + ] + }, + + { + "task": "build", + "os": "mac", + "blas": "apple_accelerate_framework", + "wasm": false, + "src": [ + "./src/dgemm_cblas.c", + "./src/dgemm_ndarray.c" + ], + "include": [ + "./include" + ], + "libraries": [ + "-lblas" + ], + "libpath": [], + "dependencies": [ + "@stdlib/blas/base/shared", + "@stdlib/napi/export", + "@stdlib/napi/argv", + "@stdlib/napi/argv-int64", + "@stdlib/napi/argv-int32", + "@stdlib/napi/argv-strided-float64array", + "@stdlib/napi/argv-strided-float64array2d", + "@stdlib/napi/argv-double" + ] + }, + { + "task": "benchmark", + "os": "mac", + "blas": "apple_accelerate_framework", + "wasm": false, + "src": [ + "./src/dgemm_cblas.c", + "./src/dgemm_ndarray.c" + ], + "include": [ + "./include" + ], + "libraries": [ + "-lblas" + ], + "libpath": [], + "dependencies": [ + "@stdlib/blas/base/shared" + ] + }, + { + "task": "examples", + "os": "mac", + "blas": "apple_accelerate_framework", + "wasm": false, + "src": [ + "./src/dgemm_cblas.c", + "./src/dgemm_ndarray.c" + ], + "include": [ + "./include" + ], + "libraries": [ + "-lblas" + ], + "libpath": [], + "dependencies": [ + "@stdlib/blas/base/shared" + ] + }, + + { + "task": "build", + "os": "mac", + "blas": "openblas", + "wasm": false, + "src": [ + "./src/dgemm_cblas.c", + "./src/dgemm_ndarray.c" + ], + "include": [ + "./include" + ], + "libraries": [ + "-lopenblas", + "-lpthread" + ], + "libpath": [], + "dependencies": [ + "@stdlib/blas/base/shared", + "@stdlib/napi/export", + "@stdlib/napi/argv", + "@stdlib/napi/argv-int64", + "@stdlib/napi/argv-int32", + "@stdlib/napi/argv-strided-float64array", + "@stdlib/napi/argv-strided-float64array2d", + "@stdlib/napi/argv-double" + ] + }, + { + "task": "benchmark", + "os": "mac", + "blas": "openblas", + "wasm": false, + "src": [ + "./src/dgemm_cblas.c", + "./src/dgemm_ndarray.c" + ], + "include": [ + "./include" + ], + "libraries": [ + "-lopenblas", + "-lpthread" + ], + "libpath": [], + "dependencies": [ + "@stdlib/blas/base/shared" + ] + }, + { + "task": "examples", + "os": "mac", + "blas": "openblas", + "wasm": false, + "src": [ + "./src/dgemm_cblas.c", + "./src/dgemm_ndarray.c" + ], + "include": [ + "./include" + ], + "libraries": [ + "-lopenblas", + "-lpthread" + ], + "libpath": [], + "dependencies": [ + "@stdlib/blas/base/shared" + ] + }, + + { + "task": "build", + "os": "win", + "blas": "", + "wasm": false, + "src": [ + "./src/dgemm_f.c", + "./src/dgemm_ndarray.c" + ], + "include": [ + "./include" + ], + "libraries": [], + "libpath": [], + "dependencies": [ + "@stdlib/blas/base/shared", + "@stdlib/blas/base/xerbla", + "@stdlib/napi/export", + "@stdlib/napi/argv", + "@stdlib/napi/argv-int64", + "@stdlib/napi/argv-int32", + "@stdlib/napi/argv-strided-float64array", + "@stdlib/napi/argv-strided-float64array2d", + "@stdlib/napi/argv-double" + ] + }, + { + "task": "benchmark", + "os": "win", + "blas": "", + "wasm": false, + "src": [ + "./src/dgemm.c", + "./src/dgemm_ndarray.c" + ], + "include": [ + "./include" + ], + "libraries": [], + "libpath": [], + "dependencies": [ + "@stdlib/blas/base/shared", + "@stdlib/blas/base/xerbla" + ] + }, + { + "task": "examples", + "os": "win", + "blas": "", + "wasm": false, + "src": [ + "./src/dgemm.c", + "./src/dgemm_ndarray.c" + ], + "include": [ + "./include" + ], + "libraries": [], + "libpath": [], + "dependencies": [ + "@stdlib/blas/base/shared", + "@stdlib/blas/base/xerbla" + ] + }, + + { + "task": "build", + "os": "", + "blas": "", + "wasm": true, + "src": [ + "./src/dgemm.c", + "./src/dgemm_ndarray.c" + ], + "include": [ + "./include" + ], + "libraries": [], + "libpath": [], + "dependencies": [ + "@stdlib/blas/base/shared", + "@stdlib/blas/base/xerbla" + ] + } + ] +} diff --git a/lib/node_modules/@stdlib/blas/base/dgemm/package.json b/lib/node_modules/@stdlib/blas/base/dgemm/package.json index af13a574a7be..8deecae50c78 100644 --- a/lib/node_modules/@stdlib/blas/base/dgemm/package.json +++ b/lib/node_modules/@stdlib/blas/base/dgemm/package.json @@ -14,11 +14,14 @@ } ], "main": "./lib", + "gypfile": true, "directories": { "benchmark": "./benchmark", "doc": "./docs", "example": "./examples", + "include": "./include", "lib": "./lib", + "src": "./src", "test": "./test" }, "types": "./docs/types", diff --git a/lib/node_modules/@stdlib/blas/base/dgemm/src/Makefile b/lib/node_modules/@stdlib/blas/base/dgemm/src/Makefile new file mode 100644 index 000000000000..2caf905cedbe --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dgemm/src/Makefile @@ -0,0 +1,70 @@ +#/ +# @license Apache-2.0 +# +# Copyright (c) 2026 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. +#/ + +# VARIABLES # + +ifndef VERBOSE + QUIET := @ +else + QUIET := +endif + +# Determine the OS ([1][1], [2][2]). +# +# [1]: https://en.wikipedia.org/wiki/Uname#Examples +# [2]: http://stackoverflow.com/a/27776822/2225624 +OS ?= $(shell uname) +ifneq (, $(findstring MINGW,$(OS))) + OS := WINNT +else +ifneq (, $(findstring MSYS,$(OS))) + OS := WINNT +else +ifneq (, $(findstring CYGWIN,$(OS))) + OS := WINNT +else +ifneq (, $(findstring Windows_NT,$(OS))) + OS := WINNT +endif +endif +endif +endif + + +# RULES # + +#/ +# Removes generated files for building an add-on. +# +# @example +# make clean-addon +#/ +clean-addon: + $(QUIET) -rm -f *.o *.node + +.PHONY: clean-addon + +#/ +# Removes generated files. +# +# @example +# make clean +#/ +clean: clean-addon + +.PHONY: clean diff --git a/lib/node_modules/@stdlib/blas/base/dgemm/src/addon.c b/lib/node_modules/@stdlib/blas/base/dgemm/src/addon.c new file mode 100644 index 000000000000..aca42632a8c8 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dgemm/src/addon.c @@ -0,0 +1,210 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 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. +*/ + +#include "stdlib/blas/base/dgemm.h" +#include "stdlib/blas/base/shared.h" +#include "stdlib/napi/export.h" +#include "stdlib/napi/argv.h" +#include "stdlib/napi/argv_int64.h" +#include "stdlib/napi/argv_int32.h" +#include "stdlib/napi/argv_double.h" +#include "stdlib/napi/argv_strided_float64array.h" +#include "stdlib/napi/argv_strided_float64array2d.h" +#include + +/** +* Receives JavaScript callback invocation data. +* +* ## Notes +* +* Arguments (14 total): +* +* - argv[0]: layout (int32) +* - argv[1]: transA (int32 enum) +* - argv[2]: transB (int32 enum) +* - argv[3]: M (int64) +* - argv[4]: N (int64) +* - argv[5]: K (int64) +* - argv[6]: alpha (double) +* - argv[7]: A (Float64Array) +* - argv[8]: LDA (int64) +* - argv[9]: B (Float64Array) +* - argv[10]: LDB (int64) +* - argv[11]: beta (double) +* - argv[12]: C (Float64Array) +* - argv[13]: LDC (int64) +* +* @param env environment under which the function is invoked +* @param info callback data +* @return Node-API value +*/ +static napi_value addon( napi_env env, napi_callback_info info ) { + CBLAS_INT sa1; + CBLAS_INT sa2; + CBLAS_INT sb1; + CBLAS_INT sb2; + CBLAS_INT sc1; + CBLAS_INT sc2; + CBLAS_INT nrowa; + CBLAS_INT ncola; + CBLAS_INT nrowb; + CBLAS_INT ncolb; + + STDLIB_NAPI_ARGV( env, info, argv, argc, 14 ); + + STDLIB_NAPI_ARGV_INT32( env, layout, argv, 0 ); + STDLIB_NAPI_ARGV_INT32( env, transA, argv, 1 ); + STDLIB_NAPI_ARGV_INT32( env, transB, argv, 2 ); + + STDLIB_NAPI_ARGV_INT64( env, M, argv, 3 ); + STDLIB_NAPI_ARGV_INT64( env, N, argv, 4 ); + STDLIB_NAPI_ARGV_INT64( env, K, argv, 5 ); + + STDLIB_NAPI_ARGV_DOUBLE( env, alpha, argv, 6 ); + STDLIB_NAPI_ARGV_DOUBLE( env, beta, argv, 11 ); + + STDLIB_NAPI_ARGV_INT64( env, LDA, argv, 8 ); + STDLIB_NAPI_ARGV_INT64( env, LDB, argv, 10 ); + STDLIB_NAPI_ARGV_INT64( env, LDC, argv, 13 ); + + // Compute dimensions of op(A) and op(B) based on transpose flags... + if ( transA == CblasNoTrans ) { + nrowa = M; + ncola = K; + } else { + nrowa = K; + ncola = M; + } + if ( transB == CblasNoTrans ) { + nrowb = K; + ncolb = N; + } else { + nrowb = N; + ncolb = K; + } + // Compute strides for 2D array validation based on layout... + if ( layout == CblasColMajor ) { + sa1 = 1; + sa2 = LDA; + sb1 = 1; + sb2 = LDB; + sc1 = 1; + sc2 = LDC; + } else { // CblasRowMajor + sa1 = LDA; + sa2 = 1; + sb1 = LDB; + sb2 = 1; + sc1 = LDC; + sc2 = 1; + } + STDLIB_NAPI_ARGV_STRIDED_FLOAT64ARRAY2D( env, A, nrowa, ncola, sa1, sa2, argv, 7 ); + STDLIB_NAPI_ARGV_STRIDED_FLOAT64ARRAY2D( env, B, nrowb, ncolb, sb1, sb2, argv, 9 ); + STDLIB_NAPI_ARGV_STRIDED_FLOAT64ARRAY2D( env, C, M, N, sc1, sc2, argv, 12 ); + + API_SUFFIX(c_dgemm)( layout, transA, transB, M, N, K, alpha, A, LDA, B, LDB, beta, C, LDC ); + + return NULL; +} + +/** +* Receives JavaScript callback invocation data. +* +* ## Notes +* +* Arguments (19 total): +* +* - argv[0]: transA (int32 enum) +* - argv[1]: transB (int32 enum) +* - argv[2]: M (int64) +* - argv[3]: N (int64) +* - argv[4]: K (int64) +* - argv[5]: alpha (double) +* - argv[6]: A (Float64Array) +* - argv[7]: strideA1 (int64) +* - argv[8]: strideA2 (int64) +* - argv[9]: offsetA (int64) +* - argv[10]: B (Float64Array) +* - argv[11]: strideB1 (int64) +* - argv[12]: strideB2 (int64) +* - argv[13]: offsetB (int64) +* - argv[14]: beta (double) +* - argv[15]: C (Float64Array) +* - argv[16]: strideC1 (int64) +* - argv[17]: strideC2 (int64) +* - argv[18]: offsetC (int64) +* +* @param env environment under which the function is invoked +* @param info callback data +* @return Node-API value +*/ +static napi_value addon_method( napi_env env, napi_callback_info info ) { + CBLAS_INT nrowa; + CBLAS_INT ncola; + CBLAS_INT nrowb; + CBLAS_INT ncolb; + + STDLIB_NAPI_ARGV( env, info, argv, argc, 19 ); + + STDLIB_NAPI_ARGV_INT32( env, transA, argv, 0 ); + STDLIB_NAPI_ARGV_INT32( env, transB, argv, 1 ); + + STDLIB_NAPI_ARGV_INT64( env, M, argv, 2 ); + STDLIB_NAPI_ARGV_INT64( env, N, argv, 3 ); + STDLIB_NAPI_ARGV_INT64( env, K, argv, 4 ); + + STDLIB_NAPI_ARGV_DOUBLE( env, alpha, argv, 5 ); + STDLIB_NAPI_ARGV_DOUBLE( env, beta, argv, 14 ); + + STDLIB_NAPI_ARGV_INT64( env, strideA1, argv, 7 ); + STDLIB_NAPI_ARGV_INT64( env, strideA2, argv, 8 ); + STDLIB_NAPI_ARGV_INT64( env, offsetA, argv, 9 ); + + STDLIB_NAPI_ARGV_INT64( env, strideB1, argv, 11 ); + STDLIB_NAPI_ARGV_INT64( env, strideB2, argv, 12 ); + STDLIB_NAPI_ARGV_INT64( env, offsetB, argv, 13 ); + + STDLIB_NAPI_ARGV_INT64( env, strideC1, argv, 16 ); + STDLIB_NAPI_ARGV_INT64( env, strideC2, argv, 17 ); + STDLIB_NAPI_ARGV_INT64( env, offsetC, argv, 18 ); + + // Compute dimensions of op(A) and op(B) for array length validation... + if ( transA == CblasNoTrans ) { + nrowa = M; + ncola = K; + } else { + nrowa = K; + ncola = M; + } + if ( transB == CblasNoTrans ) { + nrowb = K; + ncolb = N; + } else { + nrowb = N; + ncolb = K; + } + STDLIB_NAPI_ARGV_STRIDED_FLOAT64ARRAY2D( env, A, nrowa, ncola, strideA1, strideA2, argv, 6 ); + STDLIB_NAPI_ARGV_STRIDED_FLOAT64ARRAY2D( env, B, nrowb, ncolb, strideB1, strideB2, argv, 10 ); + STDLIB_NAPI_ARGV_STRIDED_FLOAT64ARRAY2D( env, C, M, N, strideC1, strideC2, argv, 15 ); + + API_SUFFIX(c_dgemm_ndarray)( transA, transB, M, N, K, alpha, A, strideA1, strideA2, offsetA, B, strideB1, strideB2, offsetB, beta, C, strideC1, strideC2, offsetC ); + + return NULL; +} + +STDLIB_NAPI_MODULE_EXPORT_FCN_WITH_METHOD( addon, "ndarray", addon_method ) diff --git a/lib/node_modules/@stdlib/blas/base/dgemm/src/dgemm.c b/lib/node_modules/@stdlib/blas/base/dgemm/src/dgemm.c new file mode 100644 index 000000000000..8126b1ca4498 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dgemm/src/dgemm.c @@ -0,0 +1,132 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 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. +*/ + +#include "stdlib/blas/base/dgemm.h" +#include "stdlib/blas/base/shared.h" +#include "stdlib/blas/base/xerbla.h" + +/** +* Performs the matrix-matrix operation `C = alpha*op(A)*op(B) + beta*C`, where `op(X)` is either `op(X) = X` or `op(X) = X^T`, `alpha` and `beta` are scalars, and `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 layout 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 `op(A)` and `C` +* @param N number of columns in `op(B)` and `C` +* @param K number of columns in `op(A)` and rows in `op(B)` +* @param alpha scalar constant +* @param A first matrix +* @param LDA leading dimension of `A` +* @param B second matrix +* @param LDB leading dimension of `B` +* @param beta scalar constant +* @param C result matrix +* @param LDC leading dimension of `C` +*/ +void API_SUFFIX(c_dgemm)( const CBLAS_LAYOUT layout, const CBLAS_TRANSPOSE transA, const CBLAS_TRANSPOSE transB, const CBLAS_INT M, const CBLAS_INT N, const CBLAS_INT K, const double alpha, const double *A, const CBLAS_INT LDA, const double *B, const CBLAS_INT LDB, const double beta, double *C, const CBLAS_INT LDC ) { + CBLAS_INT strideA1; + CBLAS_INT strideA2; + CBLAS_INT strideB1; + CBLAS_INT strideB2; + CBLAS_INT strideC1; + CBLAS_INT strideC2; + CBLAS_INT minLDA; + CBLAS_INT minLDB; + CBLAS_INT minLDC; + + // Perform input argument validation... + if ( layout != CblasRowMajor && layout != CblasColMajor ) { + c_xerbla( 1, "c_dgemm", "Error: invalid argument. First argument must be a valid storage layout. Value: `%d`.", layout ); + return; + } + if ( transA != CblasNoTrans && transA != CblasTrans && transA != CblasConjTrans ) { + c_xerbla( 2, "c_dgemm", "Error: invalid argument. Second argument must be a valid transpose operation. Value: `%d`.", transA ); + return; + } + if ( transB != CblasNoTrans && transB != CblasTrans && transB != CblasConjTrans ) { + c_xerbla( 3, "c_dgemm", "Error: invalid argument. Third argument must be a valid transpose operation. Value: `%d`.", transB ); + return; + } + if ( M < 0 ) { + c_xerbla( 4, "c_dgemm", "Error: invalid argument. Fourth argument must be a nonnegative integer. Value: `%d`.", M ); + return; + } + if ( N < 0 ) { + c_xerbla( 5, "c_dgemm", "Error: invalid argument. Fifth argument must be a nonnegative integer. Value: `%d`.", N ); + return; + } + if ( K < 0 ) { + c_xerbla( 6, "c_dgemm", "Error: invalid argument. Sixth argument must be a nonnegative integer. Value: `%d`.", K ); + return; + } + // Compute the minimum required leading dimensions based on storage layout... + if ( layout == CblasColMajor ) { + // For column-major, the leading dimension equals the number of rows of the stored matrix: + minLDA = ( transA == CblasNoTrans ) ? M : K; + minLDB = ( transB == CblasNoTrans ) ? K : N; + minLDC = M; + } else { + // For row-major, the leading dimension equals the number of columns of the stored matrix: + minLDA = ( transA == CblasNoTrans ) ? K : M; + minLDB = ( transB == CblasNoTrans ) ? N : K; + minLDC = N; + } + if ( minLDA < 1 ) { + minLDA = 1; + } + if ( LDA < minLDA ) { + c_xerbla( 9, "c_dgemm", "Error: invalid argument. Ninth argument must be greater than or equal to max(1,%d). Value: `%d`.", minLDA, LDA ); + return; + } + if ( minLDB < 1 ) { + minLDB = 1; + } + if ( LDB < minLDB ) { + c_xerbla( 11, "c_dgemm", "Error: invalid argument. Eleventh argument must be greater than or equal to max(1,%d). Value: `%d`.", minLDB, LDB ); + return; + } + if ( minLDC < 1 ) { + minLDC = 1; + } + if ( LDC < minLDC ) { + c_xerbla( 14, "c_dgemm", "Error: invalid argument. Fourteenth argument must be greater than or equal to max(1,%d). Value: `%d`.", minLDC, LDC ); + return; + } + // Check whether we can avoid computation altogether... + if ( M == 0 || N == 0 || ( ( alpha == 0.0 || K == 0 ) && beta == 1.0 ) ) { + return; + } + // Compute strides based on storage layout... + if ( layout == CblasColMajor ) { + strideA1 = 1; + strideA2 = LDA; + strideB1 = 1; + strideB2 = LDB; + strideC1 = 1; + strideC2 = LDC; + } else { // layout == CblasRowMajor + strideA1 = LDA; + strideA2 = 1; + strideB1 = LDB; + strideB2 = 1; + strideC1 = LDC; + strideC2 = 1; + } + API_SUFFIX(c_dgemm_ndarray)( transA, transB, M, N, K, alpha, A, strideA1, strideA2, 0, B, strideB1, strideB2, 0, beta, C, strideC1, strideC2, 0 ); + return; +} diff --git a/lib/node_modules/@stdlib/blas/base/dgemm/src/dgemm.f b/lib/node_modules/@stdlib/blas/base/dgemm/src/dgemm.f new file mode 100644 index 000000000000..062e56ef1551 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dgemm/src/dgemm.f @@ -0,0 +1,239 @@ +!> +! @license Apache-2.0 +! +! Copyright (c) 2026 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. +!< + +!> Performs the matrix-matrix operation `C = alpha*op(A)*op(B) + beta*C`, where `op(X)` is either `op(X) = X` or `op(X) = X^T`, `alpha` and `beta` 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. +! +! ## Notes +! +! * Modified version of reference BLAS routine (version 3.12.0). Updated to "free form" Fortran 95. +! +! ## Authors +! +! * Univ. of Tennessee +! * Univ. of California Berkeley +! * Univ. of Colorado Denver +! * NAG Ltd. +! +! ## History +! +! * Written on 8-February-1989. +! +! - Jack Dongarra, Argonne National Lab. +! - Iain Duff, AERE Harwell. +! - Jeremy Du Croz, Numerical Algorithms Group Ltd. +! - Sven Hammarling, Numerical Algorithms Group Ltd. +! +! ## License +! +! From : +! +! > The reference BLAS is a freely-available software package. It is available from netlib via anonymous ftp and the World Wide Web. Thus, it can be included in commercial software packages (and has been). We only ask that proper credit be given to the authors. +! > +! > Like all software, it is copyrighted. It is not trademarked, but we do ask the following: +! > +! > * If you modify the source for these routines we ask that you change the name of the routine and comment the changes made to the original. +! > +! > * We will gladly answer any questions regarding the software. If a modification is done, however, it is the responsibility of the person who modified the routine to provide support. +! +! @param {character} transA - specifies whether `A` is transposed (`T` or `C`) or not transposed (`N`) +! @param {character} transB - specifies whether `B` is transposed (`T` or `C`) or not transposed (`N`) +! @param {integer} M - number of rows in `op(A)` and `C` +! @param {integer} N - number of columns in `op(B)` and `C` +! @param {integer} K - number of columns in `op(A)` and rows in `op(B)` +! @param {double} alpha - scalar constant +! @param {Array} A - first matrix +! @param {integer} LDA - leading dimension of `A` +! @param {Array} B - second matrix +! @param {integer} LDB - leading dimension of `B` +! @param {double} beta - scalar constant +! @param {Array} C - result matrix +! @param {integer} LDC - leading dimension of `C` +!< +subroutine dgemm( transA, transB, M, N, K, alpha, A, LDA, B, LDB, beta, C, LDC ) + implicit none + ! .. + ! Internal parameters: + integer, parameter :: dp = kind(0.0d0) ! double-precision + ! .. + ! Scalar arguments: + character(len=1) :: transA, transB + real(dp) :: alpha, beta + integer :: M, N, K, LDA, LDB, LDC + ! .. + ! Array arguments: + real(dp) :: A(LDA,*), B(LDB,*), C(LDC,*) + ! .. + ! Local scalars: + real(dp) :: temp + integer :: i, info, j, l, nrowa, nrowb + logical :: nota, notb + ! .. + ! External functions: + interface + subroutine xerbla( srname, info ) + character*(*) :: srname + integer :: info + end subroutine xerbla + end interface + ! .. + ! Intrinsic functions: + intrinsic max + ! .. + ! Test whether `op(A)` is transposed... + nota = ( transA == 'N' .OR. transA == 'n' ) + ! .. + ! Test whether `op(B)` is transposed... + notb = ( transB == 'N' .OR. transB == 'n' ) + ! .. + ! Set `nrowa` to the number of rows of `A` as stored (before transposing)... + if ( nota ) then + nrowa = M + else + nrowa = K + end if + ! .. + ! Set `nrowb` to the number of rows of `B` as stored (before transposing)... + if ( notb ) then + nrowb = K + else + nrowb = N + end if + ! .. + ! Validate input arguments... + info = 0 + if ( .NOT. nota .AND. transA /= 'T' .AND. transA /= 't' .AND. transA /= 'C' .AND. transA /= 'c' ) then + info = 1 + else if ( .NOT. notb .AND. transB /= 'T' .AND. transB /= 't' .AND. transB /= 'C' .AND. transB /= 'c' ) then + info = 2 + else if ( M < 0 ) then + info = 3 + else if ( N < 0 ) then + info = 4 + else if ( K < 0 ) then + info = 5 + else if ( LDA < max( 1, nrowa ) ) then + info = 8 + else if ( LDB < max( 1, nrowb ) ) then + info = 10 + else if ( LDC < max( 1, M ) ) then + info = 13 + end if + if ( info /= 0 ) then + call xerbla( 'dgemm ', info ) + return + end if + ! .. + ! Quick return if possible... + if ( M == 0 .OR. N == 0 .OR. ( ( alpha == 0.0d0 .OR. K == 0 ) .AND. beta == 1.0d0 ) ) then + return + end if + ! .. + ! Handle the case where `alpha` is zero... + if ( alpha == 0.0d0 ) then + if ( beta == 0.0d0 ) then + do j = 1, N + do i = 1, M + C( i, j ) = 0.0d0 + end do + end do + else + do j = 1, N + do i = 1, M + C( i, j ) = beta * C( i, j ) + end do + end do + end if + return + end if + ! .. + ! Perform matrix multiplication... + if ( notb ) then + if ( nota ) then + ! Form C = alpha*A*B + beta*C + do j = 1, N + if ( beta == 0.0d0 ) then + do i = 1, M + C( i, j ) = 0.0d0 + end do + else if ( beta /= 1.0d0 ) then + do i = 1, M + C( i, j ) = beta * C( i, j ) + end do + end if + do l = 1, K + temp = alpha * B( l, j ) + do i = 1, M + C( i, j ) = C( i, j ) + temp * A( i, l ) + end do + end do + end do + else + ! Form C = alpha*A^T*B + beta*C + do j = 1, N + do i = 1, M + temp = 0.0d0 + do l = 1, K + temp = temp + A( l, i ) * B( l, j ) + end do + if ( beta == 0.0d0 ) then + C( i, j ) = alpha * temp + else + C( i, j ) = alpha * temp + beta * C( i, j ) + end if + end do + end do + end if + else + if ( nota ) then + ! Form C = alpha*A*B^T + beta*C + do j = 1, N + if ( beta == 0.0d0 ) then + do i = 1, M + C( i, j ) = 0.0d0 + end do + else if ( beta /= 1.0d0 ) then + do i = 1, M + C( i, j ) = beta * C( i, j ) + end do + end if + do l = 1, K + temp = alpha * B( j, l ) + do i = 1, M + C( i, j ) = C( i, j ) + temp * A( i, l ) + end do + end do + end do + else + ! Form C = alpha*A^T*B^T + beta*C + do j = 1, N + do i = 1, M + temp = 0.0d0 + do l = 1, K + temp = temp + A( l, i ) * B( j, l ) + end do + if ( beta == 0.0d0 ) then + C( i, j ) = alpha * temp + else + C( i, j ) = alpha * temp + beta * C( i, j ) + end if + end do + end do + end if + end if + return +end subroutine dgemm diff --git a/lib/node_modules/@stdlib/blas/base/dgemm/src/dgemm_cblas.c b/lib/node_modules/@stdlib/blas/base/dgemm/src/dgemm_cblas.c new file mode 100644 index 000000000000..e707a32ecb2e --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dgemm/src/dgemm_cblas.c @@ -0,0 +1,43 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 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. +*/ + +#include "stdlib/blas/base/dgemm.h" +#include "stdlib/blas/base/dgemm_cblas.h" +#include "stdlib/blas/base/shared.h" + +/** +* Performs the matrix-matrix operation `C = alpha*op(A)*op(B) + beta*C`, where `op(X)` is either `op(X) = X` or `op(X) = X^T`, `alpha` and `beta` are scalars, and `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 layout 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 `op(A)` and `C` +* @param N number of columns in `op(B)` and `C` +* @param K number of columns in `op(A)` and rows in `op(B)` +* @param alpha scalar constant +* @param A first matrix +* @param LDA leading dimension of `A` +* @param B second matrix +* @param LDB leading dimension of `B` +* @param beta scalar constant +* @param C result matrix +* @param LDC leading dimension of `C` +*/ +void API_SUFFIX(c_dgemm)( const CBLAS_LAYOUT layout, const CBLAS_TRANSPOSE transA, const CBLAS_TRANSPOSE transB, const CBLAS_INT M, const CBLAS_INT N, const CBLAS_INT K, const double alpha, const double *A, const CBLAS_INT LDA, const double *B, const CBLAS_INT LDB, const double beta, double *C, const CBLAS_INT LDC ) { + API_SUFFIX(cblas_dgemm)( layout, transA, transB, M, N, K, alpha, A, LDA, B, LDB, beta, C, LDC ); +} diff --git a/lib/node_modules/@stdlib/blas/base/dgemm/src/dgemm_f.c b/lib/node_modules/@stdlib/blas/base/dgemm/src/dgemm_f.c new file mode 100644 index 000000000000..14fc2fe3dc6b --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dgemm/src/dgemm_f.c @@ -0,0 +1,74 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 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. +*/ + +#include "stdlib/blas/base/dgemm.h" +#include "stdlib/blas/base/dgemm_fortran.h" +#include "stdlib/blas/base/shared.h" +#include "stdlib/blas/base/xerbla.h" + +/** +* Performs the matrix-matrix operation `C = alpha*op(A)*op(B) + beta*C`, where `op(X)` is either `op(X) = X` or `op(X) = X^T`, `alpha` and `beta` are scalars, and `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 layout 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 `op(A)` and `C` +* @param N number of columns in `op(B)` and `C` +* @param K number of columns in `op(A)` and rows in `op(B)` +* @param alpha scalar constant +* @param A first matrix +* @param LDA leading dimension of `A` +* @param B second matrix +* @param LDB leading dimension of `B` +* @param beta scalar constant +* @param C result matrix +* @param LDC leading dimension of `C` +*/ +void API_SUFFIX(c_dgemm)( const CBLAS_LAYOUT layout, const CBLAS_TRANSPOSE transA, const CBLAS_TRANSPOSE transB, const CBLAS_INT M, const CBLAS_INT N, const CBLAS_INT K, const double alpha, const double *A, const CBLAS_INT LDA, const double *B, const CBLAS_INT LDB, const double beta, double *C, const CBLAS_INT LDC ) { + char ta; + char tb; + char ta_swap; + char tb_swap; + + if ( layout == CblasColMajor ) { + // Map CBLAS transpose enums to Fortran characters... + ta = ( transA == CblasNoTrans ) ? 'N' : 'T'; + tb = ( transB == CblasNoTrans ) ? 'N' : 'T'; + dgemm( &ta, &tb, &M, &N, &K, &alpha, A, &LDA, B, &LDB, &beta, C, &LDC ); + return; + } + if ( layout == CblasRowMajor ) { + /* + * For row-major layout, use the transpose equivalence: + * + * C(row) = α * op(A)(row) * op(B)(row) + β*C(row) + * + * is equivalent to (in column-major): + * + * C^T = α * op(B)^T * op(A)^T + β*C^T + * + * which means swapping A↔B, M↔N, and flipping transpose flags. + */ + ta_swap = ( transB == CblasNoTrans ) ? 'N' : 'T'; + tb_swap = ( transA == CblasNoTrans ) ? 'N' : 'T'; + dgemm( &ta_swap, &tb_swap, &N, &M, &K, &alpha, B, &LDB, A, &LDA, &beta, C, &LDC ); + return; + } + c_xerbla( 1, "c_dgemm", "Error: invalid argument. First argument must be a valid storage layout. Value: `%d`.", layout ); + return; +} diff --git a/lib/node_modules/@stdlib/blas/base/dgemm/src/dgemm_ndarray.c b/lib/node_modules/@stdlib/blas/base/dgemm/src/dgemm_ndarray.c new file mode 100644 index 000000000000..8b7cdebcc7bc --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dgemm/src/dgemm_ndarray.c @@ -0,0 +1,141 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 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. +*/ + +#include "stdlib/blas/base/dgemm.h" +#include "stdlib/blas/base/shared.h" +#include "stdlib/blas/base/xerbla.h" + +/** +* Performs the matrix-matrix operation `C = alpha*op(A)*op(B) + beta*C`, using alternative indexing semantics and where `op(X)` is either `op(X) = X` or `op(X) = X^T`, `alpha` and `beta` are scalars, and `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 `op(A)` and `C` +* @param N number of columns in `op(B)` and `C` +* @param K number of columns in `op(A)` and rows in `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 result 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` +*/ +void API_SUFFIX(c_dgemm_ndarray)( const CBLAS_TRANSPOSE transA, const CBLAS_TRANSPOSE transB, const CBLAS_INT M, const CBLAS_INT N, const CBLAS_INT K, const double alpha, const double *A, const CBLAS_INT strideA1, const CBLAS_INT strideA2, const CBLAS_INT offsetA, const double *B, const CBLAS_INT strideB1, const CBLAS_INT strideB2, const CBLAS_INT offsetB, const double beta, double *C, const CBLAS_INT strideC1, const CBLAS_INT strideC2, const CBLAS_INT offsetC ) { + CBLAS_INT da_row; // stride along rows of op(A), i.e., iterates over M + CBLAS_INT da_col; // stride along cols of op(A), i.e., iterates over K + CBLAS_INT db_row; // stride along rows of op(B), i.e., iterates over K + CBLAS_INT db_col; // stride along cols of op(B), i.e., iterates over N + CBLAS_INT ia; + CBLAS_INT ib; + CBLAS_INT ic; + CBLAS_INT i; + CBLAS_INT j; + CBLAS_INT l; + double temp; + + // Validate input arguments... + if ( M < 0 ) { + c_xerbla( 3, "c_dgemm_ndarray", "Error: invalid argument. Third argument must be a nonnegative integer. Value: `%d`.", M ); + return; + } + if ( N < 0 ) { + c_xerbla( 4, "c_dgemm_ndarray", "Error: invalid argument. Fourth argument must be a nonnegative integer. Value: `%d`.", N ); + return; + } + if ( K < 0 ) { + c_xerbla( 5, "c_dgemm_ndarray", "Error: invalid argument. Fifth argument must be a nonnegative integer. Value: `%d`.", K ); + return; + } + // Quick return if possible... + if ( M == 0 || N == 0 || ( ( alpha == 0.0 || K == 0 ) && beta == 1.0 ) ) { + return; + } + // Scale C by beta (handle beta == 0 and beta == 1 as special cases)... + if ( beta == 0.0 ) { + ic = offsetC; + for ( i = 0; i < M; i++ ) { + for ( j = 0; j < N; j++ ) { + C[ ic + (j * strideC2) ] = 0.0; + } + ic += strideC1; + } + } else if ( beta != 1.0 ) { + ic = offsetC; + for ( i = 0; i < M; i++ ) { + for ( j = 0; j < N; j++ ) { + C[ ic + (j * strideC2) ] *= beta; + } + ic += strideC1; + } + } + // Check whether we can early return after scaling... + if ( alpha == 0.0 || K == 0 ) { + return; + } + /* + * Resolve strides for op(A) and op(B). + * + * If transA == CblasNoTrans: op(A)[i,l] = A[offsetA + i*strideA1 + l*strideA2] + * → da_row = strideA1 (iterate over rows i = 0..M-1) + * → da_col = strideA2 (iterate over cols l = 0..K-1) + * + * If transA == CblasTrans: op(A)[i,l] = A[offsetA + l*strideA1 + i*strideA2] + * → da_row = strideA2 (iterate over rows i = 0..M-1) + * → da_col = strideA1 (iterate over cols l = 0..K-1) + */ + if ( transA == CblasNoTrans ) { + da_row = strideA1; + da_col = strideA2; + } else { + da_row = strideA2; + da_col = strideA1; + } + if ( transB == CblasNoTrans ) { + db_row = strideB1; + db_col = strideB2; + } else { + db_row = strideB2; + db_col = strideB1; + } + // Compute C += alpha * op(A) * op(B)... + ic = offsetC; + for ( i = 0; i < M; i++ ) { + for ( j = 0; j < N; j++ ) { + // Compute dot product of row i of op(A) with col j of op(B)... + ia = offsetA + ( i * da_row ); + ib = offsetB + ( j * db_col ); + temp = 0.0; + for ( l = 0; l < K; l++ ) { + temp += A[ ia ] * B[ ib ]; + ia += da_col; + ib += db_row; + } + C[ ic + (j * strideC2) ] += alpha * temp; + } + ic += strideC1; + } + return; +} diff --git a/lib/node_modules/@stdlib/blas/base/dgemm/test/test.dgemm.native.js b/lib/node_modules/@stdlib/blas/base/dgemm/test/test.dgemm.native.js new file mode 100644 index 000000000000..4d37264eef20 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dgemm/test/test.dgemm.native.js @@ -0,0 +1,714 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 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 resolve = require( 'path' ).resolve; +var tape = require( 'tape' ); +var Float64Array = require( '@stdlib/array/float64' ); +var tryRequire = require( '@stdlib/utils/try-require' ); +var dscal = require( '@stdlib/blas/base/dscal' ); + + +// VARIABLES // + +var dgemm = tryRequire( resolve( __dirname, './../lib/dgemm.native.js' ) ); +var opts = { + 'skip': ( dgemm instanceof Error ) +}; + + +// 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', opts, function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof dgemm, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function has an arity of 14', opts, function test( t ) { + t.strictEqual( dgemm.length, 14, 'returns expected value' ); + t.end(); +}); + +tape( 'the function throws an error if provided an invalid first argument', opts, 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() { + dgemm( value, data.transA, data.transB, data.M, data.N, data.K, data.alpha, new Float64Array( data.A ), data.lda, new Float64Array( data.B ), data.ldb, data.beta, new Float64Array( data.C ), data.ldc ); + }; + } +}); + +tape( 'the function throws an error if provided an invalid second argument', opts, 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() { + dgemm( data.order, value, data.transB, data.M, data.N, data.K, data.alpha, new Float64Array( data.A ), data.lda, new Float64Array( data.B ), data.ldb, data.beta, new Float64Array( data.C ), data.ldc ); + }; + } +}); + +tape( 'the function throws an error if provided an invalid third argument', opts, 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() { + dgemm( data.order, data.transA, value, data.M, data.N, data.K, data.alpha, new Float64Array( data.A ), data.lda, new Float64Array( data.B ), data.ldb, data.beta, new Float64Array( data.C ), data.ldc ); + }; + } +}); + +tape( 'the function throws an error if provided an invalid fourth argument', opts, 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() { + dgemm( data.order, data.transA, data.transB, value, data.N, data.K, data.alpha, new Float64Array( data.A ), data.lda, new Float64Array( data.B ), data.ldb, data.beta, new Float64Array( data.C ), data.ldc ); + }; + } +}); + +tape( 'the function throws an error if provided an invalid fifth argument', opts, 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() { + dgemm( data.order, data.transA, data.transB, data.M, value, data.K, data.alpha, new Float64Array( data.A ), data.lda, new Float64Array( data.B ), data.ldb, data.beta, new Float64Array( data.C ), data.ldc ); + }; + } +}); + +tape( 'the function throws an error if provided an invalid sixth argument', opts, 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() { + dgemm( data.order, data.transA, data.transB, data.M, data.N, value, data.alpha, new Float64Array( data.A ), data.lda, new Float64Array( data.B ), data.ldb, data.beta, new Float64Array( data.C ), data.ldc ); + }; + } +}); + +tape( 'the function throws an error if provided an invalid ninth argument', opts, 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() { + dgemm( data.order, data.transA, data.transB, data.M, data.N, data.K, data.alpha, new Float64Array( data.A ), value, new Float64Array( data.B ), data.ldb, data.beta, new Float64Array( data.C ), data.ldc ); + }; + } +}); + +tape( 'the function throws an error if provided an invalid eleventh argument', opts, 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() { + dgemm( data.order, data.transA, data.transB, data.M, data.N, data.K, data.alpha, new Float64Array( data.A ), data.lda, new Float64Array( data.B ), value, data.beta, new Float64Array( data.C ), data.ldc ); + }; + } +}); + +tape( 'the function throws an error if provided an invalid fourteenth argument', opts, 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() { + dgemm( data.order, data.transA, data.transB, data.M, data.N, data.K, data.alpha, new Float64Array( data.A ), data.lda, new Float64Array( data.B ), data.ldb, data.beta, new Float64Array( data.C ), value ); + }; + } +}); + +tape( 'the function performs the matrix-matrix operation `C = α*op(A)*op(B) + β*C` (row-major, no-transpose, no-transpose)', opts, function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = rntantb; + + a = new Float64Array( data.A ); + b = new Float64Array( data.B ); + c = new Float64Array( data.C ); + + expected = new Float64Array( data.C_out ); + + out = dgemm( 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)', opts, function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = cntantb; + + a = new Float64Array( data.A ); + b = new Float64Array( data.B ); + c = new Float64Array( data.C ); + + expected = new Float64Array( data.C_out ); + + out = dgemm( 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)', opts, function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = rtantb; + + a = new Float64Array( data.A ); + b = new Float64Array( data.B ); + c = new Float64Array( data.C ); + + expected = new Float64Array( data.C_out ); + + out = dgemm( 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)', opts, function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = ctantb; + + a = new Float64Array( data.A ); + b = new Float64Array( data.B ); + c = new Float64Array( data.C ); + + expected = new Float64Array( data.C_out ); + + out = dgemm( 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)', opts, function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = rntatb; + + a = new Float64Array( data.A ); + b = new Float64Array( data.B ); + c = new Float64Array( data.C ); + + expected = new Float64Array( data.C_out ); + + out = dgemm( 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)', opts, function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = cntatb; + + a = new Float64Array( data.A ); + b = new Float64Array( data.B ); + c = new Float64Array( data.C ); + + expected = new Float64Array( data.C_out ); + + out = dgemm( 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)', opts, function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = rtatb; + + a = new Float64Array( data.A ); + b = new Float64Array( data.B ); + c = new Float64Array( data.C ); + + expected = new Float64Array( data.C_out ); + + out = dgemm( 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)', opts, function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = ctatb; + + a = new Float64Array( data.A ); + b = new Float64Array( data.B ); + c = new Float64Array( data.C ); + + expected = new Float64Array( data.C_out ); + + out = dgemm( 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 returns a reference to the third input matrix (row-major)', opts, function test( t ) { + var data; + var out; + var a; + var b; + var c; + + data = rtatb; + + a = new Float64Array( data.A ); + b = new Float64Array( data.B ); + c = new Float64Array( data.C ); + + out = dgemm( 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)', opts, function test( t ) { + var data; + var out; + var a; + var b; + var c; + + data = ctatb; + + a = new Float64Array( data.A ); + b = new Float64Array( data.B ); + c = new Float64Array( data.C ); + + out = dgemm( 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)', opts, function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = rtatb; + + a = new Float64Array( data.A ); + b = new Float64Array( data.B ); + c = new Float64Array( data.C ); + + expected = new Float64Array( data.C ); + + out = dgemm( 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 = dgemm( 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)', opts, function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = ctatb; + + a = new Float64Array( data.A ); + b = new Float64Array( data.B ); + c = new Float64Array( data.C ); + + expected = new Float64Array( data.C ); + + out = dgemm( 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 = dgemm( 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 `α` or `K` is `0` and `β` is `1`, the function returns the third input matrix unchanged (row-major)', opts, function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = rtatb; + + a = new Float64Array( data.A ); + b = new Float64Array( data.B ); + c = new Float64Array( data.C ); + + expected = new Float64Array( data.C ); + + out = dgemm( 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 = dgemm( 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)', opts, function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = ctatb; + + a = new Float64Array( data.A ); + b = new Float64Array( data.B ); + c = new Float64Array( data.C ); + + expected = new Float64Array( data.C ); + + out = dgemm( 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 = dgemm( data.order, data.transA, data.transB, data.M, data.N, 0, data.alpha, a, data.lda, b, data.ldb, 1.0, c, data.ldc ); + t.strictEqual( out, c, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'if `α` is `0` and `β` is `0`, the function returns the third input matrix filled with zeros (row-major)', opts, function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = rtatb; + + a = new Float64Array( data.A ); + b = new Float64Array( data.B ); + c = new Float64Array( data.C ); + + expected = new Float64Array( c.length ); + + out = dgemm( 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)', opts, function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = ctatb; + + a = new Float64Array( data.A ); + b = new Float64Array( data.B ); + c = new Float64Array( data.C ); + + expected = new Float64Array( c.length ); + + out = dgemm( data.order, data.transA, data.transB, data.M, data.N, data.K, 0.0, a, data.lda, b, data.ldb, 0.0, c, data.ldc ); + t.strictEqual( out, c, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'if `α` is `0` and `β` is neither `0` nor `1`, the function returns the third input matrix scaled by `β` (row-major)', opts, function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = rtatb; + + a = new Float64Array( data.A ); + b = new Float64Array( data.B ); + c = new Float64Array( data.C ); + + expected = dscal( c.length, 10.0, new Float64Array( c ), 1 ); + + out = dgemm( 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)', opts, function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = ctatb; + + a = new Float64Array( data.A ); + b = new Float64Array( data.B ); + c = new Float64Array( data.C ); + + expected = dscal( c.length, 10.0, new Float64Array( c ), 1 ); + + out = dgemm( 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(); +}); diff --git a/lib/node_modules/@stdlib/blas/base/dgemm/test/test.ndarray.native.js b/lib/node_modules/@stdlib/blas/base/dgemm/test/test.ndarray.native.js new file mode 100644 index 000000000000..dcf04c8b4a53 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/base/dgemm/test/test.ndarray.native.js @@ -0,0 +1,1496 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 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 resolve = require( 'path' ).resolve; +var tape = require( 'tape' ); +var Float64Array = require( '@stdlib/array/float64' ); +var ones = require( '@stdlib/array/ones' ); +var filled = require( '@stdlib/array/filled' ); +var tryRequire = require( '@stdlib/utils/try-require' ); +var dscal = require( '@stdlib/blas/base/dscal' ); + + +// VARIABLES // + +var dgemm = tryRequire( resolve( __dirname, './../lib/ndarray.native.js' ) ); +var opts = { + 'skip': ( dgemm instanceof Error ) +}; + + +// 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', opts, function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof dgemm, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function has an arity of 19', opts, function test( t ) { + t.strictEqual( dgemm.length, 19, 'returns expected value' ); + t.end(); +}); + +tape( 'the function throws an error if provided an invalid first argument', opts, 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() { + dgemm( value, data.transB, data.M, data.N, data.K, data.alpha, new Float64Array( data.A ), data.strideA1, data.strideA2, data.offsetA, new Float64Array( data.B ), data.strideB1, data.strideB2, data.offsetB, data.beta, new Float64Array( data.C ), data.strideC1, data.strideC2, data.offsetC ); + }; + } +}); + +tape( 'the function throws an error if provided an invalid second argument', opts, 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() { + dgemm( data.transA, value, data.M, data.N, data.K, data.alpha, new Float64Array( data.A ), data.strideA1, data.strideA2, data.offsetA, new Float64Array( data.B ), data.strideB1, data.strideB2, data.offsetB, data.beta, new Float64Array( data.C ), data.strideC1, data.strideC2, data.offsetC ); + }; + } +}); + +tape( 'the function throws an error if provided an invalid third argument', opts, 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() { + dgemm( data.transA, data.transB, value, data.N, data.K, data.alpha, new Float64Array( data.A ), data.strideA1, data.strideA2, data.offsetA, new Float64Array( data.B ), data.strideB1, data.strideB2, data.offsetB, data.beta, new Float64Array( data.C ), data.strideC1, data.strideC2, data.offsetC ); + }; + } +}); + +tape( 'the function throws an error if provided an invalid fourth argument', opts, 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() { + dgemm( data.transA, data.transB, data.M, value, data.K, data.alpha, new Float64Array( data.A ), data.strideA1, data.strideA2, data.offsetA, new Float64Array( data.B ), data.strideB1, data.strideB2, data.offsetB, data.beta, new Float64Array( data.C ), data.strideC1, data.strideC2, data.offsetC ); + }; + } +}); + +tape( 'the function throws an error if provided an invalid fifth argument', opts, 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() { + dgemm( data.transA, data.transB, data.M, data.N, value, data.alpha, new Float64Array( data.A ), data.strideA1, data.strideA2, data.offsetA, new Float64Array( data.B ), data.strideB1, data.strideB2, data.offsetB, data.beta, new Float64Array( data.C ), data.strideC1, data.strideC2, data.offsetC ); + }; + } +}); + +tape( 'the function throws an error if provided an invalid seventeenth argument', opts, 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() { + dgemm( data.transA, data.transB, data.M, data.N, data.K, data.alpha, new Float64Array( data.A ), data.strideA1, data.strideA2, data.offsetA, new Float64Array( data.B ), data.strideB1, data.strideB2, data.offsetB, data.beta, new Float64Array( data.C ), value, data.strideC2, data.offsetC ); + }; + } +}); + +tape( 'the function throws an error if provided an invalid eighteenth argument', opts, 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() { + dgemm( data.transA, data.transB, data.M, data.N, data.K, data.alpha, new Float64Array( data.A ), data.strideA1, data.strideA2, data.offsetA, new Float64Array( data.B ), data.strideB1, data.strideB2, data.offsetB, data.beta, new Float64Array( 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)', opts, function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = cacbccntantb; + + a = new Float64Array( data.A ); + b = new Float64Array( data.B ); + c = new Float64Array( data.C ); + + expected = new Float64Array( data.C_out ); + + out = dgemm( 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)', opts, function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = cacbcctantb; + + a = new Float64Array( data.A ); + b = new Float64Array( data.B ); + c = new Float64Array( data.C ); + + expected = new Float64Array( data.C_out ); + + out = dgemm( 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)', opts, function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = cacbccntatb; + + a = new Float64Array( data.A ); + b = new Float64Array( data.B ); + c = new Float64Array( data.C ); + + expected = new Float64Array( data.C_out ); + + out = dgemm( 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)', opts, function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = cacbcctatb; + + a = new Float64Array( data.A ); + b = new Float64Array( data.B ); + c = new Float64Array( data.C ); + + expected = new Float64Array( data.C_out ); + + out = dgemm( 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)', opts, function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = cacbrcntantb; + + a = new Float64Array( data.A ); + b = new Float64Array( data.B ); + c = new Float64Array( data.C ); + + expected = new Float64Array( data.C_out ); + + out = dgemm( 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)', opts, function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = cacbrctantb; + + a = new Float64Array( data.A ); + b = new Float64Array( data.B ); + c = new Float64Array( data.C ); + + expected = new Float64Array( data.C_out ); + + out = dgemm( 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)', opts, function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = cacbrcntatb; + + a = new Float64Array( data.A ); + b = new Float64Array( data.B ); + c = new Float64Array( data.C ); + + expected = new Float64Array( data.C_out ); + + out = dgemm( 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)', opts, function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = cacbrctatb; + + a = new Float64Array( data.A ); + b = new Float64Array( data.B ); + c = new Float64Array( data.C ); + + expected = new Float64Array( data.C_out ); + + out = dgemm( 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)', opts, function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = carbccntantb; + + a = new Float64Array( data.A ); + b = new Float64Array( data.B ); + c = new Float64Array( data.C ); + + expected = new Float64Array( data.C_out ); + + out = dgemm( 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)', opts, function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = carbcctantb; + + a = new Float64Array( data.A ); + b = new Float64Array( data.B ); + c = new Float64Array( data.C ); + + expected = new Float64Array( data.C_out ); + + out = dgemm( 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)', opts, function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = carbccntatb; + + a = new Float64Array( data.A ); + b = new Float64Array( data.B ); + c = new Float64Array( data.C ); + + expected = new Float64Array( data.C_out ); + + out = dgemm( 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)', opts, function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = carbcctatb; + + a = new Float64Array( data.A ); + b = new Float64Array( data.B ); + c = new Float64Array( data.C ); + + expected = new Float64Array( data.C_out ); + + out = dgemm( 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)', opts, function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = carbrcntantb; + + a = new Float64Array( data.A ); + b = new Float64Array( data.B ); + c = new Float64Array( data.C ); + + expected = new Float64Array( data.C_out ); + + out = dgemm( 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)', opts, function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = carbrctantb; + + a = new Float64Array( data.A ); + b = new Float64Array( data.B ); + c = new Float64Array( data.C ); + + expected = new Float64Array( data.C_out ); + + out = dgemm( 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)', opts, function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = carbrcntatb; + + a = new Float64Array( data.A ); + b = new Float64Array( data.B ); + c = new Float64Array( data.C ); + + expected = new Float64Array( data.C_out ); + + out = dgemm( 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)', opts, function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = carbrctatb; + + a = new Float64Array( data.A ); + b = new Float64Array( data.B ); + c = new Float64Array( data.C ); + + expected = new Float64Array( data.C_out ); + + out = dgemm( 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)', opts, function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = racbccntantb; + + a = new Float64Array( data.A ); + b = new Float64Array( data.B ); + c = new Float64Array( data.C ); + + expected = new Float64Array( data.C_out ); + + out = dgemm( 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)', opts, function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = racbcctantb; + + a = new Float64Array( data.A ); + b = new Float64Array( data.B ); + c = new Float64Array( data.C ); + + expected = new Float64Array( data.C_out ); + + out = dgemm( 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)', opts, function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = racbccntatb; + + a = new Float64Array( data.A ); + b = new Float64Array( data.B ); + c = new Float64Array( data.C ); + + expected = new Float64Array( data.C_out ); + + out = dgemm( 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)', opts, function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = racbcctatb; + + a = new Float64Array( data.A ); + b = new Float64Array( data.B ); + c = new Float64Array( data.C ); + + expected = new Float64Array( data.C_out ); + + out = dgemm( 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)', opts, function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = racbrcntantb; + + a = new Float64Array( data.A ); + b = new Float64Array( data.B ); + c = new Float64Array( data.C ); + + expected = new Float64Array( data.C_out ); + + out = dgemm( 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)', opts, function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = racbrctantb; + + a = new Float64Array( data.A ); + b = new Float64Array( data.B ); + c = new Float64Array( data.C ); + + expected = new Float64Array( data.C_out ); + + out = dgemm( 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)', opts, function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = racbrcntatb; + + a = new Float64Array( data.A ); + b = new Float64Array( data.B ); + c = new Float64Array( data.C ); + + expected = new Float64Array( data.C_out ); + + out = dgemm( 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)', opts, function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = racbrctatb; + + a = new Float64Array( data.A ); + b = new Float64Array( data.B ); + c = new Float64Array( data.C ); + + expected = new Float64Array( data.C_out ); + + out = dgemm( 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)', opts, function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = rarbccntantb; + + a = new Float64Array( data.A ); + b = new Float64Array( data.B ); + c = new Float64Array( data.C ); + + expected = new Float64Array( data.C_out ); + + out = dgemm( 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)', opts, function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = rarbcctantb; + + a = new Float64Array( data.A ); + b = new Float64Array( data.B ); + c = new Float64Array( data.C ); + + expected = new Float64Array( data.C_out ); + + out = dgemm( 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)', opts, function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = rarbccntatb; + + a = new Float64Array( data.A ); + b = new Float64Array( data.B ); + c = new Float64Array( data.C ); + + expected = new Float64Array( data.C_out ); + + out = dgemm( 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)', opts, function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = rarbcctatb; + + a = new Float64Array( data.A ); + b = new Float64Array( data.B ); + c = new Float64Array( data.C ); + + expected = new Float64Array( data.C_out ); + + out = dgemm( 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)', opts, function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = rarbrcntantb; + + a = new Float64Array( data.A ); + b = new Float64Array( data.B ); + c = new Float64Array( data.C ); + + expected = new Float64Array( data.C_out ); + + out = dgemm( 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)', opts, function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = rarbrctantb; + + a = new Float64Array( data.A ); + b = new Float64Array( data.B ); + c = new Float64Array( data.C ); + + expected = new Float64Array( data.C_out ); + + out = dgemm( 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)', opts, function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = rarbrcntatb; + + a = new Float64Array( data.A ); + b = new Float64Array( data.B ); + c = new Float64Array( data.C ); + + expected = new Float64Array( data.C_out ); + + out = dgemm( 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)', opts, function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = rarbrctatb; + + a = new Float64Array( data.A ); + b = new Float64Array( data.B ); + c = new Float64Array( data.C ); + + expected = new Float64Array( data.C_out ); + + out = dgemm( 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 returns a reference to the third input matrix', opts, function test( t ) { + var data; + var out; + var a; + var b; + var c; + + data = rarbrcntantb; + + a = new Float64Array( data.A ); + b = new Float64Array( data.B ); + c = new Float64Array( data.C ); + + out = dgemm( 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', opts, function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = rarbrctatb; + + a = new Float64Array( data.A ); + b = new Float64Array( data.B ); + c = new Float64Array( data.C ); + + expected = new Float64Array( data.C ); + + out = dgemm( 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 = dgemm( 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 `α` or `K` is `0` and `β` is `1`, the function returns the third input matrix unchanged', opts, function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = rarbrctatb; + + a = new Float64Array( data.A ); + b = new Float64Array( data.B ); + c = new Float64Array( data.C ); + + expected = new Float64Array( data.C ); + + out = dgemm( 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 = dgemm( 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 `α` is `0` and `β` is `0`, the function returns the third input matrix filled with zeros', opts, function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = rarbrctatb; + + a = new Float64Array( data.A ); + b = new Float64Array( data.B ); + c = new Float64Array( data.C ); + + expected = new Float64Array( c.length ); + + out = dgemm( data.transA, data.transB, data.M, data.N, data.K, 0.0, a, data.strideA1, data.strideA2, data.offsetA, b, data.strideB1, data.strideB2, data.offsetB, 0.0, c, data.strideC1, data.strideC2, data.offsetC ); + t.strictEqual( out, c, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'if `α` is `0` and `β` is neither `0` nor `1`, the function returns the third input matrix scaled by `β`', opts, function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = rarbrctatb; + + a = new Float64Array( data.A ); + b = new Float64Array( data.B ); + c = new Float64Array( data.C ); + + expected = dscal( c.length, 10.0, new Float64Array( c ), 1 ); + + out = dgemm( data.transA, data.transB, data.M, data.N, data.K, 0.0, a, data.strideA1, data.strideA2, data.offsetA, b, data.strideB1, data.strideB2, data.offsetB, 10.0, c, data.strideC1, data.strideC2, data.offsetC ); + t.strictEqual( out, c, 'returns expected value' ); + t.deepEqual( out, expected, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function supports specifying the strides of the first and second dimensions of `A`', opts, function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = carbcctantbsa1sa2; + + a = new Float64Array( data.A ); + b = new Float64Array( data.B ); + c = new Float64Array( data.C ); + + expected = new Float64Array( data.C_out ); + + out = dgemm( 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`', opts, function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = carbcctantbsa1nsa2; + + a = new Float64Array( data.A ); + b = new Float64Array( data.B ); + c = new Float64Array( data.C ); + + expected = new Float64Array( data.C_out ); + + out = dgemm( 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`', opts, function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = carbcctantbsa1sa2n; + + a = new Float64Array( data.A ); + b = new Float64Array( data.B ); + c = new Float64Array( data.C ); + + expected = new Float64Array( data.C_out ); + + out = dgemm( 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`', opts, function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = carbcctantbsa1nsa2n; + + a = new Float64Array( data.A ); + b = new Float64Array( data.B ); + c = new Float64Array( data.C ); + + expected = new Float64Array( data.C_out ); + + out = dgemm( 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`', opts, function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = rarbrcntantboa; + + a = new Float64Array( data.A ); + b = new Float64Array( data.B ); + c = new Float64Array( data.C ); + + expected = new Float64Array( data.C_out ); + + out = dgemm( 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`', opts, function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = rarbcctantbsb1sb2; + + a = new Float64Array( data.A ); + b = new Float64Array( data.B ); + c = new Float64Array( data.C ); + + expected = new Float64Array( data.C_out ); + + out = dgemm( 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`', opts, function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = rarbcctantbsb1nsb2; + + a = new Float64Array( data.A ); + b = new Float64Array( data.B ); + c = new Float64Array( data.C ); + + expected = new Float64Array( data.C_out ); + + out = dgemm( 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`', opts, function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = rarbcctantbsb1sb2n; + + a = new Float64Array( data.A ); + b = new Float64Array( data.B ); + c = new Float64Array( data.C ); + + expected = new Float64Array( data.C_out ); + + out = dgemm( 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`', opts, function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = rarbcctantbsb1nsb2n; + + a = new Float64Array( data.A ); + b = new Float64Array( data.B ); + c = new Float64Array( data.C ); + + expected = new Float64Array( data.C_out ); + + out = dgemm( 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`', opts, function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = rarbrcntantbob; + + a = new Float64Array( data.A ); + b = new Float64Array( data.B ); + c = new Float64Array( data.C ); + + expected = new Float64Array( data.C_out ); + + out = dgemm( 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`', opts, function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = racbrcntatbsc1sc2; + + a = new Float64Array( data.A ); + b = new Float64Array( data.B ); + c = new Float64Array( data.C ); + + expected = new Float64Array( data.C_out ); + + out = dgemm( 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`', opts, function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = racbrcntatbsc1nsc2; + + a = new Float64Array( data.A ); + b = new Float64Array( data.B ); + c = new Float64Array( data.C ); + + expected = new Float64Array( data.C_out ); + + out = dgemm( 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`', opts, function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = racbrcntatbsc1sc2n; + + a = new Float64Array( data.A ); + b = new Float64Array( data.B ); + c = new Float64Array( data.C ); + + expected = new Float64Array( data.C_out ); + + out = dgemm( 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`', opts, function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = racbrcntatbsc1nsc2n; + + a = new Float64Array( data.A ); + b = new Float64Array( data.B ); + c = new Float64Array( data.C ); + + expected = new Float64Array( data.C_out ); + + out = dgemm( 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`', opts, function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = rarbrcntantboc; + + a = new Float64Array( data.A ); + b = new Float64Array( data.B ); + c = new Float64Array( data.C ); + + expected = new Float64Array( data.C_out ); + + out = dgemm( 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', opts, function test( t ) { + var expected; + var data; + var out; + var a; + var b; + var c; + + data = cap; + + a = new Float64Array( data.A ); + b = new Float64Array( data.B ); + c = new Float64Array( data.C ); + + expected = new Float64Array( data.C_out ); + + out = dgemm( 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 computation over large arrays (row-major, row-major, row-major)', opts, 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 = dgemm( '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)', opts, 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 = dgemm( '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(); +});