Skip to content

Commit 45f9026

Browse files
committed
feat: add other files
1 parent d363531 commit 45f9026

File tree

11 files changed

+939
-1
lines changed

11 files changed

+939
-1
lines changed

lib/node_modules/@stdlib/lapack/base/iladlr/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ var out = iladlr( 'row-major', 2, 2, A1, 2 );
6969
// out => 1
7070
```
7171

72-
#### iladlr.ndarray( M, N, A, strideA1, strideA2, offsetA )
72+
#### iladlr.ndarray( M, N, A, sa1, sa2, oa )
7373

7474
Returns last non-zero row of matrix `A` using alternative indexing semantics.
7575

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
/**
2+
* @license Apache-2.0
3+
*
4+
* Copyright (c) 2024 The Stdlib Authors.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
'use strict';
20+
21+
// MODULES //
22+
23+
var bench = require( '@stdlib/bench' );
24+
var uniform = require( '@stdlib/random/array/uniform' );
25+
var isnan = require( '@stdlib/math/base/assert/is-nan' );
26+
var floor = require( '@stdlib/math/base/special/floor' );
27+
var pow = require( '@stdlib/math/base/special/pow' );
28+
var pkg = require( './../package.json' ).name;
29+
var iladlr = require( './../lib/iladlr.js' );
30+
31+
32+
// VARIABLES //
33+
34+
var options = {
35+
'dtype': 'float64'
36+
};
37+
38+
39+
// FUNCTIONS //
40+
41+
/**
42+
* Creates a benchmark function.
43+
*
44+
* @private
45+
* @param {PositiveInteger} len - array length
46+
* @returns {Function} benchmark function
47+
*/
48+
function createBenchmark( len ) {
49+
var A = uniform( len * len, -100.0, 100.0, options );
50+
return benchmark;
51+
52+
function benchmark( b ) {
53+
var out;
54+
var i;
55+
56+
b.tic();
57+
for ( i = 0; i < b.iterations; i++ ) {
58+
out = iladlr( 'row-major', len, len, A, len );
59+
if ( isnan( out ) ) {
60+
b.fail( 'should not return NaN' );
61+
}
62+
}
63+
b.toc();
64+
if ( isnan( out ) ) {
65+
b.fail( 'should not return NaN' );
66+
}
67+
b.pass( 'benchmark finished' );
68+
b.end();
69+
}
70+
}
71+
72+
73+
// MAIN //
74+
75+
/**
76+
* Main execution sequence.
77+
*
78+
* @private
79+
*/
80+
function main() {
81+
var len;
82+
var min;
83+
var max;
84+
var f;
85+
var i;
86+
87+
min = 1; // 10^min
88+
max = 6; // 10^max
89+
90+
for ( i = min; i <= max; i++ ) {
91+
len = floor( pow( pow( 10, i ), 0.5 ) );
92+
f = createBenchmark( len );
93+
bench( pkg+':order=row-major,len='+len, f );
94+
}
95+
}
96+
97+
main();
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
/**
2+
* @license Apache-2.0
3+
*
4+
* Copyright (c) 2024 The Stdlib Authors.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
'use strict';
20+
21+
// MODULES //
22+
23+
var bench = require( '@stdlib/bench' );
24+
var uniform = require( '@stdlib/random/array/uniform' );
25+
var isnan = require( '@stdlib/math/base/assert/is-nan' );
26+
var floor = require( '@stdlib/math/base/special/floor' );
27+
var pow = require( '@stdlib/math/base/special/pow' );
28+
var pkg = require( './../package.json' ).name;
29+
var iladlr = require( './../lib/ndarray.js' );
30+
31+
32+
// VARIABLES //
33+
34+
var options = {
35+
'dtype': 'float64'
36+
};
37+
38+
39+
// FUNCTIONS //
40+
41+
/**
42+
* Creates a benchmark function.
43+
*
44+
* @private
45+
* @param {PositiveInteger} len - array length
46+
* @returns {Function} benchmark function
47+
*/
48+
function createBenchmark( len ) {
49+
var A = uniform( len * len, -100.0, 100.0, options );
50+
return benchmark;
51+
52+
function benchmark( b ) {
53+
var out;
54+
var i;
55+
56+
b.tic();
57+
for ( i = 0; i < b.iterations; i++ ) {
58+
out = iladlr( len, len, A, len, 1, 0 );
59+
if ( isnan( out ) ) {
60+
b.fail( 'should not return NaN' );
61+
}
62+
}
63+
b.toc();
64+
if ( isnan( out ) ) {
65+
b.fail( 'should not return NaN' );
66+
}
67+
b.pass( 'benchmark finished' );
68+
b.end();
69+
}
70+
}
71+
72+
73+
// MAIN //
74+
75+
/**
76+
* Main execution sequence.
77+
*
78+
* @private
79+
*/
80+
function main() {
81+
var len;
82+
var min;
83+
var max;
84+
var f;
85+
var i;
86+
87+
min = 1; // 10^min
88+
max = 6; // 10^max
89+
90+
for ( i = min; i <= max; i++ ) {
91+
len = floor( pow( pow( 10, i ), 0.5 ) );
92+
f = createBenchmark( len );
93+
bench( pkg+':ndarray:order=row-major,len='+len, f );
94+
}
95+
}
96+
97+
main();
Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
/**
2+
* @license Apache-2.0
3+
*
4+
* Copyright (c) 2024 The Stdlib Authors.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
// TypeScript Version: 4.1
20+
21+
/// <reference types="@stdlib/types"/>
22+
23+
import { Layout } from '@stdlib/types/blas';
24+
25+
/**
26+
* Interface describing `iladlr`.
27+
*/
28+
interface Routine {
29+
/**
30+
* Returns last non-zero row of matrix `A`.
31+
*
32+
* @param order - storage layout
33+
* @param M - number of rows
34+
* @param N - number of columns
35+
* @param A - input matrix
36+
* @param LDA - stride of the first dimension of `A` (a.k.a., leading dimension of the matrix `A`)
37+
* @returns index of last non-zero row
38+
*
39+
* @example
40+
* var Float64Array = require( '@stdlib/array/float64' );
41+
*
42+
* var out;
43+
* var A = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] );
44+
*
45+
* out = iladlr( 'row-major', 2, 2, A, 2 );
46+
* // returns 1
47+
*/
48+
( order: Layout, M: number, N: number, A: Float64Array, LDA: number ): number;
49+
50+
/**
51+
* Returns last non-zero row of matrix `A` using alternative indexing semantics.
52+
*
53+
* @name iladlr.ndarray
54+
* @type {Function}
55+
* @param M - number of rows
56+
* @param N - number of columns
57+
* @param A - input matrix
58+
* @param strideA1 - stride of the first dimension of `A`
59+
* @param strideA2 - stride of the second dimension of `A`
60+
* @param offsetA - starting index for `A`
61+
* @returns index of last non-zero row
62+
*
63+
* @example
64+
* var Float64Array = require( '@stdlib/array/float64' );
65+
*
66+
* var out;
67+
* var A = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] );
68+
*
69+
* out = iladlr.ndarray( 2, 2, A, 2, 1, 0 );
70+
* // returns 1
71+
*/
72+
ndarray( M: number, N: number, A: Float64Array, strideA1: number, strideA2: number, offsetA: number ): number;
73+
}
74+
75+
/**
76+
* Returns last non-zero row of matrix `A`.
77+
*
78+
* @param order - storage layout
79+
* @param M - number of rows
80+
* @param N - number of columns
81+
* @param A - input matrix
82+
* @param LDA - stride of the first dimension of `A` (a.k.a., leading dimension of the matrix `A`)
83+
* @returns index of last non-zero row
84+
*
85+
* @example
86+
* var Float64Array = require( '@stdlib/array/float64' );
87+
*
88+
* var out;
89+
* var A = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] );
90+
*
91+
* out = iladlr( 'row-major', 2, 2, A, 2 );
92+
* // returns 1
93+
*
94+
* @example
95+
* var Float64Array = require( '@stdlib/array/float64' );
96+
*
97+
* var out;
98+
* var A = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] );
99+
*
100+
* out = iladlr.ndarray( 2, 2, A, 2, 1, 0 );
101+
* // returns 1
102+
*/
103+
declare var iladlr: Routine;
104+
105+
106+
// EXPORTS //
107+
108+
export = iladlr;

0 commit comments

Comments
 (0)