Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
431 changes: 431 additions & 0 deletions lib/node_modules/@stdlib/lapack/base/dgebd2/README.md

Large diffs are not rendered by default.

127 changes: 127 additions & 0 deletions lib/node_modules/@stdlib/lapack/base/dgebd2/benchmark/benchmark.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
/**
* @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 bench = require( '@stdlib/bench' );
var discreteUniform = require( '@stdlib/random/array/discrete-uniform' );
var Float64Array = require( '@stdlib/array/float64' );
var max = require( '@stdlib/math/base/special/max' );
var pow = require( '@stdlib/math/base/special/pow' );
var floor = require( '@stdlib/math/base/special/floor' );
var format = require( '@stdlib/string/format' );
var pkg = require( './../package.json' ).name;
var dgebd2 = require( './../lib/dgebd2.js' );


// VARIABLES //

var LAYOUTS = [
'row-major',
'column-major'
];
var opts = {
'dtype': 'float64'
};


// FUNCTIONS //

/**
* Creates a benchmark function.
*
* @private
* @param {string} order - storage layout
* @param {PositiveInteger} N - number of elements along each dimension
* @returns {Function} benchmark function
*/
function createBenchmark( order, N ) {
var TAUQ;
var TAUP;
var WORK;
var A;
var D;
var E;

A = discreteUniform( N*N, 1.0, 10.0, opts );
D = new Float64Array( N );
E = new Float64Array( max( 0, N - 1 ) );
TAUQ = new Float64Array( N );
TAUP = new Float64Array( N );
WORK = new Float64Array( N );
return benchmark;

/**
* Benchmark function.
*
* @private
* @param {Benchmark} b - benchmark instance
*/
function benchmark( b ) {
var i;
var z;

b.tic();
for ( i = 0; i < b.iterations; i++ ) {
z = dgebd2( order, N, N, A, N, D, E, TAUQ, TAUP, WORK );
if ( z !== 0 ) {
b.fail( 'should return a success status code' );
}
}
b.toc();
if ( z !== 0 ) {
b.fail( 'should return a success status code' );
}
b.pass( 'benchmark finished' );
b.end();
}
}


// MAIN //

/**
* Main execution sequence.
*
* @private
*/
function main() {
var minPow;
var maxPow;
var order;
var N;
var f;
var i;
var j;

minPow = 1; // 10^minPow
maxPow = 6; // 10^maxPow

for ( j = 0; j < LAYOUTS.length; j++ ) {
order = LAYOUTS[ j ];
for ( i = minPow; i <= maxPow; i++ ) {
N = floor( pow( pow( 10, i ), 1.0/2.0 ) );
f = createBenchmark( order, N );
bench( format( '%s::square_matrix:order=%s,size=%d', pkg, order, N*N ), f );
}
}
}

main();
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
/**
* @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 bench = require( '@stdlib/bench' );
var discreteUniform = require( '@stdlib/random/array/discrete-uniform' );
var Float64Array = require( '@stdlib/array/float64' );
var max = require( '@stdlib/math/base/special/max' );
var pow = require( '@stdlib/math/base/special/pow' );
var isColumnMajor = require( '@stdlib/ndarray/base/assert/is-column-major-string' );
var floor = require( '@stdlib/math/base/special/floor' );
var format = require( '@stdlib/string/format' );
var pkg = require( './../package.json' ).name;
var dgebd2 = require( './../lib/ndarray.js' );


// VARIABLES //

var LAYOUTS = [
'row-major',
'column-major'
];
var opts = {
'dtype': 'float64'
};


// FUNCTIONS //

/**
* Creates a benchmark function.
*
* @private
* @param {string} order - storage layout
* @param {PositiveInteger} N - number of elements along each dimension
* @returns {Function} benchmark function
*/
function createBenchmark( order, N ) {
var TAUQ;
var TAUP;
var WORK;
var sa1;
var sa2;
var A;
var D;
var E;

A = discreteUniform( N*N, 1.0, 10.0, opts );
D = new Float64Array( N );
E = new Float64Array( max( 0, N - 1 ) );
TAUQ = new Float64Array( N );
TAUP = new Float64Array( N );
WORK = new Float64Array( N );

if ( isColumnMajor( order ) ) {
sa1 = 1;
sa2 = N;
} else {
sa1 = N;
sa2 = 1;
}
return benchmark;

/**
* Benchmark function.
*
* @private
* @param {Benchmark} b - benchmark instance
*/
function benchmark( b ) {
var i;
var z;

b.tic();
for ( i = 0; i < b.iterations; i++ ) {
z = dgebd2( N, N, A, sa1, sa2, 0, D, 1, 0, E, 1, 0, TAUQ, 1, 0, TAUP, 1, 0, WORK, 1, 0 );

Check warning on line 94 in lib/node_modules/@stdlib/lapack/base/dgebd2/benchmark/benchmark.ndarray.js

View workflow job for this annotation

GitHub Actions / Lint Changed Files

This line has a length of 101. Maximum allowed is 80
if ( z !== 0 ) {
b.fail( 'should return a success status code' );
}
}
b.toc();
if ( z !== 0 ) {
b.fail( 'should return a success status code' );
}
b.pass( 'benchmark finished' );
b.end();
}
}


// MAIN //

/**
* Main execution sequence.
*
* @private
*/
function main() {
var minPow;
var maxPow;
var order;
var N;
var f;
var i;
var j;

minPow = 1; // 10^minPow
maxPow = 6; // 10^maxPow

for ( j = 0; j < LAYOUTS.length; j++ ) {
order = LAYOUTS[ j ];
for ( i = minPow; i <= maxPow; i++ ) {
N = floor( pow( pow( 10, i ), 1.0/2.0 ) );
f = createBenchmark( order, N );
bench( format( '%s:ndarray::square_matrix:order=%s,size=%d', pkg, order, N*N ), f );
}
}
}

main();
Loading
Loading