Skip to content

Commit 126b65d

Browse files
committed
bench: fix assertions
--- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: passed - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed ---
1 parent 5bd0a2b commit 126b65d

File tree

2 files changed

+20
-12
lines changed

2 files changed

+20
-12
lines changed

lib/node_modules/@stdlib/lapack/base/clacpy/benchmark/benchmark.js

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,20 @@ var clacpy = require( './../lib/clacpy.js' );
4141
*/
4242
function createBenchmark( N ) {
4343
var opts;
44+
var abuf;
45+
var bbuf;
4446
var A;
4547
var B;
4648

4749
opts = {
4850
'dtype': 'float32'
4951
};
5052

51-
A = new Complex64Array( uniform( 2*N*N, -10.0, 10.0, opts ) );
52-
B = new Complex64Array( uniform( 2*N*N, -10.0, 10.0, opts ) );
53+
abuf = uniform( 2*N*N, -10.0, 10.0, opts );
54+
A = new Complex64Array( abuf );
55+
56+
bbuf = uniform( 2*N*N, -10.0, 10.0, opts );
57+
B = new Complex64Array( bbuf );
5358
return benchmark;
5459

5560
/**
@@ -59,18 +64,17 @@ function createBenchmark( N ) {
5964
* @param {Benchmark} b - benchmark instance
6065
*/
6166
function benchmark( b ) {
62-
var z;
6367
var i;
6468

6569
b.tic();
6670
for ( i = 0; i < b.iterations; i++ ) {
67-
z = clacpy( 'column-major', 'all', N, N, A, N, B, N );
68-
if ( isnanf( z[ i%z.length ] ) ) {
71+
clacpy( 'column-major', 'all', N, N, A, N, B, N );
72+
if ( isnanf( bbuf[ i%bbuf.length ] ) ) {
6973
b.fail( 'should not return NaN' );
7074
}
7175
}
7276
b.toc();
73-
if ( isnanf( z[ i%z.length ] ) ) {
77+
if ( isnanf( bbuf[ i%bbuf.length ] ) ) {
7478
b.fail( 'should not return NaN' );
7579
}
7680
b.pass( 'benchmark finished' );

lib/node_modules/@stdlib/lapack/base/clacpy/benchmark/benchmark.ndarray.js

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,20 @@ var clacpy = require( './../lib/ndarray.js' );
4141
*/
4242
function createBenchmark( N ) {
4343
var opts;
44+
var abuf;
45+
var bbuf;
4446
var A;
4547
var B;
4648

4749
opts = {
4850
'dtype': 'float32'
4951
};
5052

51-
A = new Complex64Array( uniform( 2*N*N, -10.0, 10.0, opts ) );
52-
B = new Complex64Array( uniform( 2*N*N, -10.0, 10.0, opts ) );
53+
abuf = uniform( 2*N*N, -10.0, 10.0, opts );
54+
A = new Complex64Array( abuf );
55+
56+
bbuf = uniform( 2*N*N, -10.0, 10.0, opts );
57+
B = new Complex64Array( bbuf );
5358
return benchmark;
5459

5560
/**
@@ -59,18 +64,17 @@ function createBenchmark( N ) {
5964
* @param {Benchmark} b - benchmark instance
6065
*/
6166
function benchmark( b ) {
62-
var z;
6367
var i;
6468

6569
b.tic();
6670
for ( i = 0; i < b.iterations; i++ ) {
67-
z = clacpy( 'all', N, N, A, 1, N, 0, B, 1, N, 0 );
68-
if ( isnanf( z[ i%z.length ] ) ) {
71+
clacpy( 'all', N, N, A, 1, N, 0, B, 1, N, 0 );
72+
if ( isnanf( bbuf[ i%bbuf.length ] ) ) {
6973
b.fail( 'should not return NaN' );
7074
}
7175
}
7276
b.toc();
73-
if ( isnanf( z[ i%z.length ] ) ) {
77+
if ( isnanf( bbuf[ i%bbuf.length ] ) ) {
7478
b.fail( 'should not return NaN' );
7579
}
7680
b.pass( 'benchmark finished' );

0 commit comments

Comments
 (0)