Skip to content

Commit 8afe288

Browse files
committed
docs: add docs folder
--- 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: passed - 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: na - 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 3422a64 commit 8afe288

File tree

3 files changed

+389
-0
lines changed

3 files changed

+389
-0
lines changed
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
/*
2+
* @license Apache-2.0
3+
*
4+
* Copyright (c) 2025 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 `iladlc`.
27+
*/
28+
interface Routine {
29+
/**
30+
* Finds the index of the last non zero column in a matrix `A`.
31+
*
32+
* @param order - storage layout
33+
* @param M - number of rows in `A`
34+
* @param N - number of columns in `A`
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 the last non zero column
38+
*
39+
* @example
40+
* var Float64array = require( '@stdlib/array/float64' );
41+
*
42+
* var A = new Float64array( [ 1.0, 2.0, 0.0, 3.0, 4.0, 0.0 ] ); // => [ [ 1.0, 2.0, 0,0 ], [ 3.0, 4.0, 0.0 ] ]
43+
*
44+
* var out = iladlc( 'row-major', 2, 3, A, 3 );
45+
* // returns 1
46+
*/
47+
( order: Layout, M: number, N: number, A: Float64Array, LDA: number ): number;
48+
49+
/**
50+
* Finds the index of the last non zero column in a matrix `A` using alternative indexing semantics.
51+
*
52+
* @param M - number of rows in `A`
53+
* @param N - number of columns in `A`
54+
* @param A - input matrix
55+
* @param strideA1 - stride of the first dimension of `A`
56+
* @param strideA2 - stride of the second dimension of `A`
57+
* @returns index of the last non zero column
58+
*
59+
* @example
60+
* var Float64array = require( '@stdlib/array/float64' );
61+
*
62+
* var A = new Float64array( [ 1.0, 2.0, 0.0, 3.0, 4.0, 0.0 ] ); // => [ [ 1.0, 2.0, 0,0 ], [ 3.0, 4.0, 0.0 ] ]
63+
*
64+
* var out = iladlc.ndarray( 2, 3, A, 3, 1, 0 );
65+
* // returns 1
66+
*/
67+
ndarray( M: number, N: number, A: Float64Array, strideA1: number, strideA2: number, offsetA: number ): number;
68+
}
69+
70+
/**
71+
* Finds the index of the last non zero column in a matrix `A`.
72+
*
73+
* @param order - storage layout
74+
* @param M - number of rows in `A`
75+
* @param N - number of columns in `A`
76+
* @param A - input matrix
77+
* @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
79+
*
80+
* @example
81+
* var Float64array = require( '@stdlib/array/float64' );
82+
*
83+
* var A = new Float64array( [ 1.0, 2.0, 0.0, 3.0, 4.0, 0.0 ] ); // => [ [ 1.0, 2.0, 0,0 ], [ 3.0, 4.0, 0.0 ] ]
84+
*
85+
* var out = iladlc( 'row-major', 2, 3, A, 3 );
86+
* // returns 1
87+
*
88+
* @example
89+
* var Float64array = require( '@stdlib/array/float64' );
90+
*
91+
* var A = new Float64array( [ 1.0, 2.0, 0.0, 3.0, 4.0, 0.0 ] ); // => [ [ 1.0, 2.0, 0,0 ], [ 3.0, 4.0, 0.0 ] ]
92+
*
93+
* var out = iladlc.ndarray( 2, 3, A, 3, 1, 0 );
94+
* // returns 1
95+
*/
96+
declare var iladlc: Routine;
97+
98+
99+
// EXPORTS //
100+
101+
export = iladlc;
Lines changed: 213 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,213 @@
1+
/*
2+
* @license Apache-2.0
3+
*
4+
* Copyright (c) 2025 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+
import iladlc = require( './index' );
20+
21+
22+
// TESTS //
23+
24+
// The function returns a number...
25+
{
26+
const A = new Float64Array( 4 );
27+
28+
iladlc( 'row-major', 2, 2, A, 2 ); // $ExpectType number
29+
}
30+
31+
// The compiler throws an error if the function is provided a first argument which is not a string...
32+
{
33+
const A = new Float64Array( 4 );
34+
35+
iladlc( 5, 2, 2, A, 2 ); // $ExpectError
36+
iladlc( true, 2, 2, A, 2 ); // $ExpectError
37+
iladlc( false, 2, 2, A, 2 ); // $ExpectError
38+
iladlc( null, 2, 2, A, 2 ); // $ExpectError
39+
iladlc( void 0, 2, 2, A, 2 ); // $ExpectError
40+
iladlc( [], 2, 2, A, 2 ); // $ExpectError
41+
iladlc( {}, 2, 2, A, 2 ); // $ExpectError
42+
iladlc( ( x: number ): number => x, 2, 2, A, 2 ); // $ExpectError
43+
}
44+
45+
// The compiler throws an error if the function is provided a second argument which is not a number...
46+
{
47+
const A = new Float64Array( 4 );
48+
49+
iladlc( 'row-major', '5', 2, A, 2 ); // $ExpectError
50+
iladlc( 'row-major', true, 2, A, 2 ); // $ExpectError
51+
iladlc( 'row-major', false, 2, A, 2 ); // $ExpectError
52+
iladlc( 'row-major', null, 2, A, 2 ); // $ExpectError
53+
iladlc( 'row-major', void 0, 2, A, 2 ); // $ExpectError
54+
iladlc( 'row-major', [], 2, A, 2 ); // $ExpectError
55+
iladlc( 'row-major', {}, 2, A, 2 ); // $ExpectError
56+
iladlc( 'row-major', ( x: number ): number => x, 2, A, 2 ); // $ExpectError
57+
}
58+
59+
// The compiler throws an error if the function is provided a third argument which is not a number...
60+
{
61+
const A = new Float64Array( 4 );
62+
63+
iladlc( 'row-major', 2, '5', A, 2 ); // $ExpectError
64+
iladlc( 'row-major', 2, true, A, 2 ); // $ExpectError
65+
iladlc( 'row-major', 2, false, A, 2 ); // $ExpectError
66+
iladlc( 'row-major', 2, null, A, 2 ); // $ExpectError
67+
iladlc( 'row-major', 2, void 0, A, 2 ); // $ExpectError
68+
iladlc( 'row-major', 2, [], A, 2 ); // $ExpectError
69+
iladlc( 'row-major', 2, {}, A, 2 ); // $ExpectError
70+
iladlc( 'row-major', 2, ( x: number ): number => x, A, 2 ); // $ExpectError
71+
}
72+
73+
// The compiler throws an error if the function is provided a fourth argument which is not a Float64Array...
74+
{
75+
iladlc( 'row-major', 2, 2, '5', 2 ); // $ExpectError
76+
iladlc( 'row-major', 2, 2, 5, 2 ); // $ExpectError
77+
iladlc( 'row-major', 2, 2, true, 2 ); // $ExpectError
78+
iladlc( 'row-major', 2, 2, false, 2 ); // $ExpectError
79+
iladlc( 'row-major', 2, 2, null, 2 ); // $ExpectError
80+
iladlc( 'row-major', 2, 2, void 0, 2 ); // $ExpectError
81+
iladlc( 'row-major', 2, 2, [], 2 ); // $ExpectError
82+
iladlc( 'row-major', 2, 2, {}, 2 ); // $ExpectError
83+
iladlc( 'row-major', 2, 2, ( x: number ): number => x, 2 ); // $ExpectError
84+
}
85+
86+
// The compiler throws an error if the function is provided a fifth argument which is not a number...
87+
{
88+
const A = new Float64Array( 4 );
89+
90+
iladlc( 'row-major', 2, 2, A, '5' ); // $ExpectError
91+
iladlc( 'row-major', 2, 2, A, true ); // $ExpectError
92+
iladlc( 'row-major', 2, 2, A, false ); // $ExpectError
93+
iladlc( 'row-major', 2, 2, A, null ); // $ExpectError
94+
iladlc( 'row-major', 2, 2, A, void 0 ); // $ExpectError
95+
iladlc( 'row-major', 2, 2, A, [] ); // $ExpectError
96+
iladlc( 'row-major', 2, 2, A, {} ); // $ExpectError
97+
iladlc( 'row-major', 2, 2, A, ( x: number ): number => x ); // $ExpectError
98+
}
99+
100+
// The compiler throws an error if the function is provided an unsupported number of arguments...
101+
{
102+
const A = new Float64Array( 4 );
103+
104+
iladlc(); // $ExpectError
105+
iladlc( 'row-major' ); // $ExpectError
106+
iladlc( 'row-major', 2 ); // $ExpectError
107+
iladlc( 'row-major', 2, 2 ); // $ExpectError
108+
iladlc( 'row-major', 2, 2, A ); // $ExpectError
109+
iladlc( 'row-major', 2, 2, A, 2, 10 ); // $ExpectError
110+
}
111+
112+
// Attached to main export is an `ndarray` method which returns a number...
113+
{
114+
const A = new Float64Array( 4 );
115+
116+
iladlc.ndarray( 2, 2, A, 2, 1, 0 ); // $ExpectType number
117+
}
118+
119+
// The compiler throws an error if the function is provided a first argument which is not a number...
120+
{
121+
const A = new Float64Array( 4 );
122+
123+
iladlc.ndarray( '5', 2, A, 2, 1, 0 ); // $ExpectError
124+
iladlc.ndarray( true, 2, A, 2, 1, 0 ); // $ExpectError
125+
iladlc.ndarray( false, 2, A, 2, 1, 0 ); // $ExpectError
126+
iladlc.ndarray( null, 2, A, 2, 1, 0 ); // $ExpectError
127+
iladlc.ndarray( void 0, 2, A, 2, 1, 0 ); // $ExpectError
128+
iladlc.ndarray( [], 2, A, 2, 1, 0 ); // $ExpectError
129+
iladlc.ndarray( {}, 2, A, 2, 1, 0 ); // $ExpectError
130+
iladlc.ndarray( ( x: number ): number => x, 2, A, 2, 1, 0 ); // $ExpectError
131+
}
132+
133+
// The compiler throws an error if the function is provided a second argument which is not a number...
134+
{
135+
const A = new Float64Array( 4 );
136+
137+
iladlc.ndarray( 2, '5', A, 2, 1, 0 ); // $ExpectError
138+
iladlc.ndarray( 2, true, A, 2, 1, 0 ); // $ExpectError
139+
iladlc.ndarray( 2, false, A, 2, 1, 0 ); // $ExpectError
140+
iladlc.ndarray( 2, null, A, 2, 1, 0 ); // $ExpectError
141+
iladlc.ndarray( 2, void 0, A, 2, 1, 0 ); // $ExpectError
142+
iladlc.ndarray( 2, [], A, 2, 1, 0 ); // $ExpectError
143+
iladlc.ndarray( 2, {}, A, 2, 1, 0 ); // $ExpectError
144+
iladlc.ndarray( 2, ( x: number ): number => x, A, 2, 1, 0 ); // $ExpectError
145+
}
146+
147+
// The compiler throws an error if the function is provided a third argument which is not a Float64Array...
148+
{
149+
iladlc.ndarray( 2, 2, '5', 2, 1, 0 ); // $ExpectError
150+
iladlc.ndarray( 2, 2, 5, 2, 1, 0 ); // $ExpectError
151+
iladlc.ndarray( 2, 2, true, 2, 1, 0 ); // $ExpectError
152+
iladlc.ndarray( 2, 2, false, 2, 1, 0 ); // $ExpectError
153+
iladlc.ndarray( 2, 2, null, 2, 1, 0 ); // $ExpectError
154+
iladlc.ndarray( 2, 2, void 0, 2, 1, 0 ); // $ExpectError
155+
iladlc.ndarray( 2, 2, [], 2, 1, 0 ); // $ExpectError
156+
iladlc.ndarray( 2, 2, {}, 2, 1, 0 ); // $ExpectError
157+
iladlc.ndarray( 2, 2, ( x: number ): number => x, 2, 1, 0 ); // $ExpectError
158+
}
159+
160+
// The compiler throws an error if the function is provided a fourth argument which is not a number...
161+
{
162+
const A = new Float64Array( 4 );
163+
164+
iladlc.ndarray( 2, 2, A, '5', 1, 0 ); // $ExpectError
165+
iladlc.ndarray( 2, 2, A, true, 1, 0 ); // $ExpectError
166+
iladlc.ndarray( 2, 2, A, false, 1, 0 ); // $ExpectError
167+
iladlc.ndarray( 2, 2, A, null, 1, 0 ); // $ExpectError
168+
iladlc.ndarray( 2, 2, A, void 0, 1, 0 ); // $ExpectError
169+
iladlc.ndarray( 2, 2, A, [], 1, 0 ); // $ExpectError
170+
iladlc.ndarray( 2, 2, A, {}, 1, 0 ); // $ExpectError
171+
iladlc.ndarray( 2, 2, A, ( x: number ): number => x, 1, 0 ); // $ExpectError
172+
}
173+
174+
// The compiler throws an error if the function is provided a fifth argument which is not a number...
175+
{
176+
const A = new Float64Array( 4 );
177+
178+
iladlc.ndarray( 2, 2, A, 2, '5', 0 ); // $ExpectError
179+
iladlc.ndarray( 2, 2, A, 2, true, 0 ); // $ExpectError
180+
iladlc.ndarray( 2, 2, A, 2, false, 0 ); // $ExpectError
181+
iladlc.ndarray( 2, 2, A, 2, null, 0 ); // $ExpectError
182+
iladlc.ndarray( 2, 2, A, 2, void 0, 0 ); // $ExpectError
183+
iladlc.ndarray( 2, 2, A, 2, [], 0 ); // $ExpectError
184+
iladlc.ndarray( 2, 2, A, 2, {}, 0 ); // $ExpectError
185+
iladlc.ndarray( 2, 2, A, 2, ( x: number ): number => x, 0 ); // $ExpectError
186+
}
187+
188+
// The compiler throws an error if the function is provided a sixth argument which is not a number...
189+
{
190+
const A = new Float64Array( 4 );
191+
192+
iladlc.ndarray( 2, 2, A, 2, 1, '5' ); // $ExpectError
193+
iladlc.ndarray( 2, 2, A, 2, 1, true ); // $ExpectError
194+
iladlc.ndarray( 2, 2, A, 2, 1, false ); // $ExpectError
195+
iladlc.ndarray( 2, 2, A, 2, 1, null ); // $ExpectError
196+
iladlc.ndarray( 2, 2, A, 2, 1, void 0 ); // $ExpectError
197+
iladlc.ndarray( 2, 2, A, 2, 1, [] ); // $ExpectError
198+
iladlc.ndarray( 2, 2, A, 2, 1, {} ); // $ExpectError
199+
iladlc.ndarray( 2, 2, A, 2, 1, ( x: number ): number => x ); // $ExpectError
200+
}
201+
202+
// The compiler throws an error if the `ndarray` method is provided an unsupported number of arguments (6-argument version)...
203+
{
204+
const A = new Float64Array( 4 );
205+
206+
iladlc.ndarray(); // $ExpectError
207+
iladlc.ndarray( 2 ); // $ExpectError
208+
iladlc.ndarray( 2, 2 ); // $ExpectError
209+
iladlc.ndarray( 2, 2, A ); // $ExpectError
210+
iladlc.ndarray( 2, 2, A, 2 ); // $ExpectError
211+
iladlc.ndarray( 2, 2, A, 2, 1 ); // $ExpectError
212+
iladlc.ndarray( 2, 2, A, 2, 1, 0, 10 ); // $ExpectError
213+
}
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
2+
{{alias}}( order, M, N, A, LDA )
3+
Finds the index of the last non zero column in a matrix `A`.
4+
5+
Indexing is relative to the first index. To introduce an offset, use typed
6+
array views.
7+
8+
Parameters
9+
----------
10+
order: string
11+
Row-major (C-style) or column-major (Fortran-style) order. Must be
12+
either 'row-major' or 'column-major'.
13+
14+
M: integer
15+
Number of rows in `A`.
16+
17+
N: integer
18+
Number of columns in `A`.
19+
20+
A: Float64Array
21+
Input matrix `A`.
22+
23+
Returns
24+
-------
25+
iladlr: integer
26+
Zero based index of the last non-zero row.
27+
28+
Examples
29+
--------
30+
> var A = new {{alias:@stdlib/array/float64}}( [ 1.0, 2.0, 3.0, 4.0 ] );
31+
> {{alias}}( 'row-major', 2, 2, A, 2 )
32+
1
33+
34+
35+
{{alias}}.ndarray( M, N, A, sa1, sa2, oa )
36+
Finds the index of the last non zero column in a matrix `A` using
37+
alternative indexing semantics.
38+
39+
While typed array views mandate a view offset based on the underlying
40+
buffer, the offset parameters support indexing semantics based on starting
41+
indices.
42+
43+
Parameters
44+
----------
45+
M: integer
46+
Number of rows in `A`.
47+
48+
N: integer
49+
Number of columns in `A`.
50+
51+
A: Float64Array
52+
Input matrix `A`.
53+
54+
sa1: integer
55+
Stride of the first dimension of `A`.
56+
57+
sa2: integer
58+
Stride of the second dimension of `A`.
59+
60+
oa: integer
61+
Starting index for `A`.
62+
63+
Returns
64+
-------
65+
iladlr: integer
66+
Zero based index of the last non-zero row.
67+
68+
Examples
69+
--------
70+
> var A = new {{alias:@stdlib/array/float64}}( [ 1.0, 2.0, 3.0, 4.0 ] );
71+
> {{alias}}.ndarray( 2, 2, A, 2, 1, 0 )
72+
1
73+
74+
See Also
75+
--------

0 commit comments

Comments
 (0)