Skip to content

Commit 076d95a

Browse files
committed
chore: cleanup
--- 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: passed - task: lint_package_json status: passed - task: lint_repl_help status: passed - task: lint_javascript_src status: passed - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: passed - 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: passed - task: lint_typescript_tests status: passed - task: lint_license_headers status: passed ---
1 parent 47962d4 commit 076d95a

File tree

13 files changed

+85
-95
lines changed

13 files changed

+85
-95
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ limitations under the License.
2020

2121
# iladlc
2222

23-
> Find the index of the last non zero column in a matrix `A`
23+
> Find the index of the last non-zero column in a matrix `A`
2424
2525
<section class="usage">
2626

@@ -32,7 +32,7 @@ var iladlc = require( '@stdlib/lapack/base/iladlc' );
3232

3333
#### iladlc( order, M, N, A, LDA )
3434

35-
Finds the index of the last non zero column in a matrix `A`.
35+
Returns the index of the last non-zero column in a matrix `A`.
3636

3737
```javascript
3838
var Float64Array = require( '@stdlib/array/float64' );
@@ -77,7 +77,7 @@ var out = iladlc( 'row-major', 2, 3, A1, 3 );
7777

7878
#### iladlc.ndarray( uplo, M, N, A, sa1, sa2, oa, B, sb1, sb2, ob )
7979

80-
Finds the index of the last non zero column in a matrix `A` using alternative indexing semantics.
80+
Finds the index of the last non-zero column in a matrix `A` using alternative indexing semantics.
8181

8282
```javascript
8383
var Float64Array = require( '@stdlib/array/float64' );

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

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
var bench = require( '@stdlib/bench' );
2424
var isnan = require( '@stdlib/math/base/assert/is-nan' );
25-
var discreteUniform = require( '@stdlib/random/array/discrete-uniform' );
25+
var zeros = require( '@stdlib/array/zeros' );
2626
var pow = require( '@stdlib/math/base/special/pow' );
2727
var floor = require( '@stdlib/math/base/special/floor' );
2828
var pkg = require( './../package.json' ).name;
@@ -48,11 +48,7 @@ var LAYOUTS = [
4848
* @returns {Function} benchmark function
4949
*/
5050
function createBenchmark( order, N ) {
51-
var A;
52-
53-
A = discreteUniform( N*N, 0.0, 1.0, {
54-
'dtype': 'float64'
55-
});
51+
var A = zeros( N*N, 'float64' );
5652
return benchmark;
5753

5854
/**
@@ -67,6 +63,7 @@ function createBenchmark( order, N ) {
6763

6864
b.tic();
6965
for ( i = 0; i < b.iterations; i++ ) {
66+
A[ 0 ] = i;
7067
z = iladlc( order, N, N, A, N );
7168
if ( isnan( z ) ) {
7269
b.fail( 'should not return NaN' );

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

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@ var bench = require( '@stdlib/bench' );
2424
var isnan = require( '@stdlib/math/base/assert/is-nan' );
2525
var pow = require( '@stdlib/math/base/special/pow' );
2626
var floor = require( '@stdlib/math/base/special/floor' );
27-
var discreteUniform = require( '@stdlib/random/array/discrete-uniform' );
27+
var zeros = require( '@stdlib/array/zeros' );
2828
var isColumnMajor = require( '@stdlib/ndarray/base/assert/is-column-major-string' );
2929
var pkg = require( './../package.json' ).name;
30-
var iladlc = require( './../lib/iladlc.js' );
30+
var iladlc = require( './../lib/ndarray.js' );
3131

3232

3333
// VARIABLES //
@@ -49,11 +49,7 @@ var LAYOUTS = [
4949
* @returns {Function} benchmark function
5050
*/
5151
function createBenchmark( order, N ) {
52-
var A;
53-
54-
A = discreteUniform( N*N, 0.0, 1.0, {
55-
'dtype': 'float64'
56-
});
52+
var A = zeros( N*N, 'float64' );
5753
return benchmark;
5854

5955
/**
@@ -78,7 +74,8 @@ function createBenchmark( order, N ) {
7874

7975
b.tic();
8076
for ( i = 0; i < b.iterations; i++ ) {
81-
z = iladlc( order, N, N, A, sa1, sa2, 0 );
77+
A[ 0 ] = i;
78+
z = iladlc( N, N, A, sa1, sa2, 0 );
8279
if ( isnan( z ) ) {
8380
b.fail( 'should not return NaN' );
8481
}

lib/node_modules/@stdlib/lapack/base/iladlc/docs/repl.txt

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11

22
{{alias}}( order, M, N, A, LDA )
3-
Finds the index of the last non zero column in a matrix `A`.
3+
Returns the index of the last non-zero column in a matrix `A`.
44

55
Indexing is relative to the first index. To introduce an offset, use typed
66
array views.
77

8+
If provided an empty matrix or a matrix containing only zeros, the function
9+
returns `-1` (i.e., an invalid index).
10+
811
Parameters
912
----------
1013
order: string
@@ -23,7 +26,7 @@
2326
Returns
2427
-------
2528
iladlr: integer
26-
Zero based index of the last non-zero row.
29+
Zero based index of the last non-zero column.
2730

2831
Examples
2932
--------
@@ -33,13 +36,16 @@
3336

3437

3538
{{alias}}.ndarray( M, N, A, sa1, sa2, oa )
36-
Finds the index of the last non zero column in a matrix `A` using
39+
Returns the index of the last non-zero column in a matrix `A` using
3740
alternative indexing semantics.
3841

3942
While typed array views mandate a view offset based on the underlying
4043
buffer, the offset parameters support indexing semantics based on starting
4144
indices.
4245

46+
If provided an empty matrix or a matrix containing only zeros, the function
47+
returns `-1` (i.e., an invalid index).
48+
4349
Parameters
4450
----------
4551
M: integer
@@ -63,7 +69,7 @@
6369
Returns
6470
-------
6571
iladlr: integer
66-
Zero based index of the last non-zero row.
72+
Zero based index of the last non-zero column.
6773

6874
Examples
6975
--------

lib/node_modules/@stdlib/lapack/base/iladlc/docs/docs/index.d.ts renamed to lib/node_modules/@stdlib/lapack/base/iladlc/docs/types/index.d.ts

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,18 @@ import { Layout } from '@stdlib/types/blas';
2727
*/
2828
interface Routine {
2929
/**
30-
* Finds the index of the last non zero column in a matrix `A`.
30+
* Returns the index of the last non-zero column in a matrix `A`.
31+
*
32+
* ## Notes
33+
*
34+
* - If provided an empty matrix or a matrix containing only zeros, the function returns `-1` (i.e., an invalid index).
3135
*
3236
* @param order - storage layout
3337
* @param M - number of rows in `A`
3438
* @param N - number of columns in `A`
3539
* @param A - input matrix
3640
* @param LDA - stride of the first dimension of `A` (a.k.a., leading dimension of the matrix `A`)
37-
* @returns index of the last non zero column
41+
* @returns index of the last non-zero column
3842
*
3943
* @example
4044
* var Float64array = require( '@stdlib/array/float64' );
@@ -47,14 +51,18 @@ interface Routine {
4751
( order: Layout, M: number, N: number, A: Float64Array, LDA: number ): number;
4852

4953
/**
50-
* Finds the index of the last non zero column in a matrix `A` using alternative indexing semantics.
54+
* Finds the index of the last non-zero column in a matrix `A` using alternative indexing semantics.
55+
*
56+
* ## Notes
57+
*
58+
* - If provided an empty matrix or a matrix containing only zeros, the function returns `-1` (i.e., an invalid index).
5159
*
5260
* @param M - number of rows in `A`
5361
* @param N - number of columns in `A`
5462
* @param A - input matrix
5563
* @param strideA1 - stride of the first dimension of `A`
5664
* @param strideA2 - stride of the second dimension of `A`
57-
* @returns index of the last non zero column
65+
* @returns index of the last non-zero column
5866
*
5967
* @example
6068
* var Float64array = require( '@stdlib/array/float64' );
@@ -68,14 +76,18 @@ interface Routine {
6876
}
6977

7078
/**
71-
* Finds the index of the last non zero column in a matrix `A`.
79+
* Returns the index of the last non-zero column in a matrix `A`.
80+
*
81+
* ## Notes
82+
*
83+
* - If provided an empty matrix or a matrix containing only zeros, the function returns `-1` (i.e., an invalid index).
7284
*
7385
* @param order - storage layout
7486
* @param M - number of rows in `A`
7587
* @param N - number of columns in `A`
7688
* @param A - input matrix
7789
* @param LDA - stride of the first dimension of `A` (a.k.a., leading dimension of the matrix `A`)
78-
* @returns index of the last non zero column
90+
* @returns index of the last non-zero column
7991
*
8092
* @example
8193
* var Float64array = require( '@stdlib/array/float64' );

lib/node_modules/@stdlib/lapack/base/iladlc/lib/base.js

Lines changed: 8 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,17 @@
2020

2121
// MODULES //
2222

23-
var isRowMajor = require( '@stdlib/ndarray/base/assert/is-row-major' );
23+
var iladlr = require( '@stdlib/lapack/base/iladlr' ).ndarray;
2424

2525

2626
// MAIN //
2727

2828
/**
29-
* Finds the index of the last non zero column in a matrix `A`.
29+
* Returns the index of the last non-zero column in a matrix `A`.
30+
*
31+
* ## Notes
32+
*
33+
* - If provided an empty matrix or a matrix containing only zeros, the function returns `-1` (i.e., an invalid index).
3034
*
3135
* @private
3236
* @param {PositiveInteger} M - number of rows in `A`
@@ -35,7 +39,7 @@ var isRowMajor = require( '@stdlib/ndarray/base/assert/is-row-major' );
3539
* @param {integer} strideA1 - stride of the first dimension of `A`
3640
* @param {integer} strideA2 - stride of the second dimension of `A`
3741
* @param {NonNegativeInteger} offsetA - index offset for `A`
38-
* @returns {integer} index of the last non zero column
42+
* @returns {integer} index of the last non-zero column
3943
*
4044
* @example
4145
* var Float64array = require( '@stdlib/array/float64' );
@@ -46,50 +50,7 @@ var isRowMajor = require( '@stdlib/ndarray/base/assert/is-row-major' );
4650
* // returns 1
4751
*/
4852
function iladlc( M, N, A, strideA1, strideA2, offsetA ) {
49-
var ia1;
50-
var ia2;
51-
var i;
52-
var j;
53-
54-
if ( M === 0 || N === 0 ) {
55-
return -1; // Invalid index
56-
}
57-
58-
ia1 = offsetA + ( (N-1) * strideA2 ); // A( 1, N )
59-
ia2 = ia1 + ( (M-1) * strideA1 ); // A( M, N )
60-
61-
// Quick test for common case where corners are non-zero:
62-
if ( A[ ia1 ] !== 0.0 || A[ ia2 ] !== 0.0 ) {
63-
return N - 1;
64-
}
65-
66-
if ( isRowMajor( [ strideA1, strideA2 ] ) ) {
67-
ia1 = offsetA;
68-
for ( i = 0; i < M; i++ ) {
69-
ia2 = ( N - 1 ) * strideA2;
70-
for ( j = N-1; j >= 0; j-- ) {
71-
if ( A[ ia1 + ia2 ] !== 0.0 ) {
72-
return j;
73-
}
74-
ia2 -= strideA2;
75-
}
76-
ia1 += strideA1;
77-
}
78-
} else {
79-
ia1 = offsetA + ( (N-1) * strideA2 );
80-
for ( i = N-1; i >= 0; i-- ) {
81-
ia2 = 0;
82-
for ( j = 0; j < M; j++ ) {
83-
if ( A[ ia1 + ia2 ] !== 0.0 ) {
84-
return i;
85-
}
86-
ia2 += strideA1;
87-
}
88-
ia1 -= strideA2;
89-
}
90-
}
91-
92-
return -1;
53+
return iladlr( N, M, A, strideA2, strideA1, offsetA );
9354
}
9455

9556

lib/node_modules/@stdlib/lapack/base/iladlc/lib/iladlc.js

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,11 @@ var base = require( './base.js' );
3131
// MAIN //
3232

3333
/**
34-
* Finds the index of the last non zero column in a matrix `A`.
34+
* Returns the index of the last non-zero column in a matrix `A`.
35+
*
36+
* ## Notes
37+
*
38+
* - If provided an empty matrix or a matrix containing only zeros, the function returns `-1` (i.e., an invalid index).
3539
*
3640
* @param {string} order - storage layout
3741
* @param {PositiveInteger} M - number of rows in `A`
@@ -40,7 +44,7 @@ var base = require( './base.js' );
4044
* @param {integer} LDA - stride of the first dimension of `A` (a.k.a., leading dimension of the matrix `A`)
4145
* @throws {TypeError} first argument must be a valid order
4246
* @throws {RangeError} fifth argument must be greater than or equal to max(1,N)
43-
* @returns {integer} index of the last non zero column
47+
* @returns {integer} index of the last non-zero column
4448
*
4549
* @example
4650
* var Float64array = require( '@stdlib/array/float64' );
@@ -53,12 +57,17 @@ var base = require( './base.js' );
5357
function iladlc( order, M, N, A, LDA ) {
5458
var sa1;
5559
var sa2;
56-
60+
var s;
5761
if ( !isLayout( order ) ) {
5862
throw new TypeError( format( 'invalid argument. First argument must be a valid order. Value: `%s`.', order ) );
5963
}
60-
if ( isRowMajor( order ) && LDA < max( 1, N ) ) {
61-
throw new RangeError( format( 'invalid argument. Fourth argument must be greater than or equal to max(1,%d). Value: `%d`.', N, LDA ) );
64+
if ( isRowMajor( order ) ) {
65+
s = N;
66+
} else {
67+
s = M;
68+
}
69+
if ( LDA < max( 1, s ) ) {
70+
throw new RangeError( format( 'invalid argument. Fifth argument must be greater than or equal to max(1,%d). Value: `%d`.', s, LDA ) );
6271
}
6372
if ( isColumnMajor( order ) ) {
6473
sa1 = 1;

lib/node_modules/@stdlib/lapack/base/iladlc/lib/index.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,11 @@
1919
'use strict';
2020

2121
/**
22-
* LAPACK routine to find the index of the last non zero row in a input matrix.
22+
* LAPACK routine to find the index of the last non-zero column in a input matrix.
23+
*
24+
* ## Notes
25+
*
26+
* - If provided an empty matrix or a matrix containing only zeros, the function returns `-1` (i.e., an invalid index).
2327
*
2428
* @module @stdlib/lapack/base/iladlc
2529
*

lib/node_modules/@stdlib/lapack/base/iladlc/lib/ndarray.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,19 @@ var base = require( './base.js' );
2626
// MAIN //
2727

2828
/**
29-
* Finds the index of the last non zero column in a matrix `A` using alternative indexing semantics.
29+
* Finds the index of the last non-zero column in a matrix `A` using alternative indexing semantics.
30+
*
31+
* ## Notes
32+
*
33+
* - If provided an empty matrix or a matrix containing only zeros, the function returns `-1` (i.e., an invalid index).
3034
*
3135
* @param {PositiveInteger} M - number of rows in `A`
3236
* @param {PositiveInteger} N - number of columns in `A`
3337
* @param {Float64Array} A - input matrix
3438
* @param {integer} strideA1 - stride of the first dimension of `A`
3539
* @param {integer} strideA2 - stride of the second dimension of `A`
3640
* @param {NonNegativeInteger} offsetA - index offset for `A`
37-
* @returns {integer} index of the last non zero column
41+
* @returns {integer} index of the last non-zero column
3842
*
3943
* @example
4044
* var Float64array = require( '@stdlib/array/float64' );

lib/node_modules/@stdlib/lapack/base/iladlc/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@stdlib/lapack/base/iladlc",
33
"version": "0.0.0",
4-
"description": "LAPACK routine to find the index of the last non zero column in a input matrix.",
4+
"description": "LAPACK routine to find the index of the last non-zero column in a input matrix.",
55
"license": "Apache-2.0",
66
"author": {
77
"name": "The Stdlib Authors",

lib/node_modules/@stdlib/lapack/base/iladlc/test/test.iladlc.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ tape( 'the function returns an invalid index (-1) when N is zero', function test
139139
t.end();
140140
});
141141

142-
tape( 'the function returns the expected zero based index of the last non zero column of a matrix (row-major)', function test( t ) {
142+
tape( 'the function returns the expected zero based index of the last non-zero column of a matrix (row-major)', function test( t ) {
143143
var data;
144144
var out;
145145
var A;
@@ -153,7 +153,7 @@ tape( 'the function returns the expected zero based index of the last non zero c
153153
t.end();
154154
});
155155

156-
tape( 'the function returns the expected zero based index of the last non zero column of a matrix (column-major)', function test( t ) {
156+
tape( 'the function returns the expected zero based index of the last non-zero column of a matrix (column-major)', function test( t ) {
157157
var data;
158158
var out;
159159
var A;

0 commit comments

Comments
 (0)