-
-
Notifications
You must be signed in to change notification settings - Fork 447
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d363531
commit 45f9026
Showing
11 changed files
with
939 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
97 changes: 97 additions & 0 deletions
97
lib/node_modules/@stdlib/lapack/base/iladlr/benchmark/benchmark.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
/** | ||
* @license Apache-2.0 | ||
* | ||
* Copyright (c) 2024 The Stdlib Authors. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
'use strict'; | ||
|
||
// MODULES // | ||
|
||
var bench = require( '@stdlib/bench' ); | ||
var uniform = require( '@stdlib/random/array/uniform' ); | ||
var isnan = require( '@stdlib/math/base/assert/is-nan' ); | ||
var floor = require( '@stdlib/math/base/special/floor' ); | ||
var pow = require( '@stdlib/math/base/special/pow' ); | ||
var pkg = require( './../package.json' ).name; | ||
var iladlr = require( './../lib/iladlr.js' ); | ||
|
||
|
||
// VARIABLES // | ||
|
||
var options = { | ||
'dtype': 'float64' | ||
}; | ||
|
||
|
||
// FUNCTIONS // | ||
|
||
/** | ||
* Creates a benchmark function. | ||
* | ||
* @private | ||
* @param {PositiveInteger} len - array length | ||
* @returns {Function} benchmark function | ||
*/ | ||
function createBenchmark( len ) { | ||
var A = uniform( len * len, -100.0, 100.0, options ); | ||
return benchmark; | ||
|
||
function benchmark( b ) { | ||
var out; | ||
var i; | ||
|
||
b.tic(); | ||
for ( i = 0; i < b.iterations; i++ ) { | ||
out = iladlr( 'row-major', len, len, A, len ); | ||
if ( isnan( out ) ) { | ||
b.fail( 'should not return NaN' ); | ||
} | ||
} | ||
b.toc(); | ||
if ( isnan( out ) ) { | ||
b.fail( 'should not return NaN' ); | ||
} | ||
b.pass( 'benchmark finished' ); | ||
b.end(); | ||
} | ||
} | ||
|
||
|
||
// MAIN // | ||
|
||
/** | ||
* Main execution sequence. | ||
* | ||
* @private | ||
*/ | ||
function main() { | ||
var len; | ||
var min; | ||
var max; | ||
var f; | ||
var i; | ||
|
||
min = 1; // 10^min | ||
max = 6; // 10^max | ||
|
||
for ( i = min; i <= max; i++ ) { | ||
len = floor( pow( pow( 10, i ), 0.5 ) ); | ||
f = createBenchmark( len ); | ||
bench( pkg+':order=row-major,len='+len, f ); | ||
} | ||
} | ||
|
||
main(); |
97 changes: 97 additions & 0 deletions
97
lib/node_modules/@stdlib/lapack/base/iladlr/benchmark/benchmark.ndarray.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
/** | ||
* @license Apache-2.0 | ||
* | ||
* Copyright (c) 2024 The Stdlib Authors. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
'use strict'; | ||
|
||
// MODULES // | ||
|
||
var bench = require( '@stdlib/bench' ); | ||
var uniform = require( '@stdlib/random/array/uniform' ); | ||
var isnan = require( '@stdlib/math/base/assert/is-nan' ); | ||
var floor = require( '@stdlib/math/base/special/floor' ); | ||
var pow = require( '@stdlib/math/base/special/pow' ); | ||
var pkg = require( './../package.json' ).name; | ||
var iladlr = require( './../lib/ndarray.js' ); | ||
|
||
|
||
// VARIABLES // | ||
|
||
var options = { | ||
'dtype': 'float64' | ||
}; | ||
|
||
|
||
// FUNCTIONS // | ||
|
||
/** | ||
* Creates a benchmark function. | ||
* | ||
* @private | ||
* @param {PositiveInteger} len - array length | ||
* @returns {Function} benchmark function | ||
*/ | ||
function createBenchmark( len ) { | ||
var A = uniform( len * len, -100.0, 100.0, options ); | ||
return benchmark; | ||
|
||
function benchmark( b ) { | ||
var out; | ||
var i; | ||
|
||
b.tic(); | ||
for ( i = 0; i < b.iterations; i++ ) { | ||
out = iladlr( len, len, A, len, 1, 0 ); | ||
if ( isnan( out ) ) { | ||
b.fail( 'should not return NaN' ); | ||
} | ||
} | ||
b.toc(); | ||
if ( isnan( out ) ) { | ||
b.fail( 'should not return NaN' ); | ||
} | ||
b.pass( 'benchmark finished' ); | ||
b.end(); | ||
} | ||
} | ||
|
||
|
||
// MAIN // | ||
|
||
/** | ||
* Main execution sequence. | ||
* | ||
* @private | ||
*/ | ||
function main() { | ||
var len; | ||
var min; | ||
var max; | ||
var f; | ||
var i; | ||
|
||
min = 1; // 10^min | ||
max = 6; // 10^max | ||
|
||
for ( i = min; i <= max; i++ ) { | ||
len = floor( pow( pow( 10, i ), 0.5 ) ); | ||
f = createBenchmark( len ); | ||
bench( pkg+':ndarray:order=row-major,len='+len, f ); | ||
} | ||
} | ||
|
||
main(); |
108 changes: 108 additions & 0 deletions
108
lib/node_modules/@stdlib/lapack/base/iladlr/docs/types/index.d.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
/** | ||
* @license Apache-2.0 | ||
* | ||
* Copyright (c) 2024 The Stdlib Authors. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
// TypeScript Version: 4.1 | ||
|
||
/// <reference types="@stdlib/types"/> | ||
|
||
import { Layout } from '@stdlib/types/blas'; | ||
|
||
/** | ||
* Interface describing `iladlr`. | ||
*/ | ||
interface Routine { | ||
/** | ||
* Returns last non-zero row of matrix `A`. | ||
* | ||
* @param order - storage layout | ||
* @param M - number of rows | ||
* @param N - number of columns | ||
* @param A - input matrix | ||
* @param LDA - stride of the first dimension of `A` (a.k.a., leading dimension of the matrix `A`) | ||
* @returns index of last non-zero row | ||
* | ||
* @example | ||
* var Float64Array = require( '@stdlib/array/float64' ); | ||
* | ||
* var out; | ||
* var A = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); | ||
* | ||
* out = iladlr( 'row-major', 2, 2, A, 2 ); | ||
* // returns 1 | ||
*/ | ||
( order: Layout, M: number, N: number, A: Float64Array, LDA: number ): number; | ||
|
||
/** | ||
* Returns last non-zero row of matrix `A` using alternative indexing semantics. | ||
* | ||
* @name iladlr.ndarray | ||
* @type {Function} | ||
* @param M - number of rows | ||
* @param N - number of columns | ||
* @param A - input 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` | ||
* @returns index of last non-zero row | ||
* | ||
* @example | ||
* var Float64Array = require( '@stdlib/array/float64' ); | ||
* | ||
* var out; | ||
* var A = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); | ||
* | ||
* out = iladlr.ndarray( 2, 2, A, 2, 1, 0 ); | ||
* // returns 1 | ||
*/ | ||
ndarray( M: number, N: number, A: Float64Array, strideA1: number, strideA2: number, offsetA: number ): number; | ||
} | ||
|
||
/** | ||
* Returns last non-zero row of matrix `A`. | ||
* | ||
* @param order - storage layout | ||
* @param M - number of rows | ||
* @param N - number of columns | ||
* @param A - input matrix | ||
* @param LDA - stride of the first dimension of `A` (a.k.a., leading dimension of the matrix `A`) | ||
* @returns index of last non-zero row | ||
* | ||
* @example | ||
* var Float64Array = require( '@stdlib/array/float64' ); | ||
* | ||
* var out; | ||
* var A = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); | ||
* | ||
* out = iladlr( 'row-major', 2, 2, A, 2 ); | ||
* // returns 1 | ||
* | ||
* @example | ||
* var Float64Array = require( '@stdlib/array/float64' ); | ||
* | ||
* var out; | ||
* var A = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); | ||
* | ||
* out = iladlr.ndarray( 2, 2, A, 2, 1, 0 ); | ||
* // returns 1 | ||
*/ | ||
declare var iladlr: Routine; | ||
|
||
|
||
// EXPORTS // | ||
|
||
export = iladlr; |
Oops, something went wrong.