Skip to content

Commit 8fe0be2

Browse files
committed
docs: add REAMDE
--- 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: na - task: lint_repl_help status: na - task: lint_javascript_src status: passed - 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 b21fcc4 commit 8fe0be2

File tree

2 files changed

+262
-1
lines changed

2 files changed

+262
-1
lines changed
Lines changed: 261 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,261 @@
1+
<!--
2+
3+
@license Apache-2.0
4+
5+
Copyright (c) 2024 The Stdlib Authors.
6+
7+
Licensed under the Apache License, Version 2.0 (the "License");
8+
you may not use this file except in compliance with the License.
9+
You may obtain a copy of the License at
10+
11+
http://www.apache.org/licenses/LICENSE-2.0
12+
13+
Unless required by applicable law or agreed to in writing, software
14+
distributed under the License is distributed on an "AS IS" BASIS,
15+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
See the License for the specific language governing permissions and
17+
limitations under the License.
18+
19+
-->
20+
21+
# iladlr
22+
23+
> Find the index of the last non zero row in a matrix `A`
24+
25+
<section class="usage">
26+
27+
## Usage
28+
29+
```javascript
30+
var iladlr = require( '@stdlib/lapack/base/iladlr' );
31+
```
32+
33+
#### iladlr( order, M, N, A, LDA )
34+
35+
Finds the index of the last non zero row in a matrix `A`.
36+
37+
```javascript
38+
var Float64Array = require( '@stdlib/array/float64' );
39+
40+
var A = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 0.0, 0.0 ] );
41+
42+
/*
43+
A = [
44+
[ 1.0, 2.0 ],
45+
[ 3.0, 4.0 ],
46+
[ 0.0, 0.0 ]
47+
]
48+
*/
49+
50+
var out = iladlr( 'row-major', 3, 2, A, 2 );
51+
// returns 1
52+
```
53+
54+
The function has the following parameters:
55+
56+
- **order**: storage layout.
57+
- **M**: number of rows in `A`.
58+
- **N**: number of columns in `A`.
59+
- **A**: input [`Float64Array`][mdn-float64array].
60+
- **LDA**: stride of the first dimension of `A` (a.k.a., leading dimension of the matrix `A`).
61+
62+
Note that indexing is relative to the first index. To introduce an offset, use [`typed array`][mdn-typed-array] views.
63+
64+
<!-- eslint-disable stdlib/capitalized-comments -->
65+
66+
```javascript
67+
var Float64Array = require( '@stdlib/array/float64' );
68+
69+
// Initial arrays...
70+
var A0 = new Float64Array( [ 9999.0, 1.0, 2.0, 3.0, 4.0, 0.0, 0.0 ] );
71+
72+
// Create offset views...
73+
var A1 = new Float64Array( A0.buffer, A0.BYTES_PER_ELEMENT*1 ); // start at 2nd element
74+
75+
var out = iladlr( 'row-major', 3, 2, A1, 2 );
76+
// returns 1
77+
```
78+
79+
#### iladlr.ndarray( uplo, M, N, A, sa1, sa2, oa, B, sb1, sb2, ob )
80+
81+
Finds the index of the last non zero row in a matrix `A` using alternative indexing semantics.
82+
83+
```javascript
84+
var Float64Array = require( '@stdlib/array/float64' );
85+
86+
var A = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 0.0, 0.0 ] );
87+
88+
/*
89+
A = [
90+
[ 1.0, 2.0 ],
91+
[ 3.0, 4.0 ],
92+
[ 0.0, 0.0 ]
93+
]
94+
*/
95+
96+
var out = iladlr.ndarray( 3, 2, A, 2, 1, 0 );
97+
// returns 1
98+
```
99+
100+
The function has the following parameters:
101+
102+
- **M**: number of rows in `A`.
103+
- **N**: number of columns in `A`.
104+
- **A**: input [`Float64Array`][mdn-float64array].
105+
- **sa1**: stride of the first dimension of `A`.
106+
- **sa2**: stride of the second dimension of `A`.
107+
- **oa**: starting index for `A`.
108+
109+
While [`typed array`][mdn-typed-array] views mandate a view offset based on the underlying buffer, the offset parameters support indexing semantics based on starting indices. For example,
110+
111+
```javascript
112+
var Float64Array = require( '@stdlib/array/float64' );
113+
114+
var A = new Float64Array( [ 9999.0, 1.0, 2.0, 3.0, 4.0, 0.0, 0.0 ] );
115+
116+
/*
117+
A = [
118+
[ 1.0, 2.0 ],
119+
[ 3.0, 4.0 ],
120+
[ 0.0, 0.0 ]
121+
]
122+
*/
123+
124+
var out = iladlr.ndarray( 3, 2, A, 2, 1, 1 );
125+
// returns 1
126+
```
127+
128+
</section>
129+
130+
<!-- /.usage -->
131+
132+
<section class="notes">
133+
134+
## Notes
135+
136+
- `iladlr()` corresponds to the [LAPACK][lapack] routine [`iladlr`][lapack-iladlr].
137+
138+
</section>
139+
140+
<!-- /.notes -->
141+
142+
<section class="examples">
143+
144+
## Examples
145+
146+
<!-- eslint no-undef: "error" -->
147+
148+
```javascript
149+
var ndarray2array = require( '@stdlib/ndarray/base/to-array' );
150+
var Float64Array = require( '@stdlib/array/float64' );
151+
var shape2strides = require( '@stdlib/ndarray/base/shape2strides' );
152+
var iladlr = require( '@stdlib/lapack/base/iladlr' );
153+
154+
var shape = [ 3, 3 ];
155+
var order = 'row-major';
156+
var strides = shape2strides( shape, order );
157+
158+
var A = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 0.0, 0.0, 0.0 ] );
159+
console.log( ndarray2array( A, shape, strides, 0, order ) );
160+
161+
var out = iladlr( order, shape[ 0 ], shape[ 1 ], A, strides[ 0 ] );
162+
console.log( out );
163+
```
164+
165+
</section>
166+
167+
<!-- /.examples -->
168+
169+
<!-- C interface documentation. -->
170+
171+
* * *
172+
173+
<section class="c">
174+
175+
## C APIs
176+
177+
<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->
178+
179+
<section class="intro">
180+
181+
</section>
182+
183+
<!-- /.intro -->
184+
185+
<!-- C usage documentation. -->
186+
187+
<section class="usage">
188+
189+
### Usage
190+
191+
```c
192+
TODO
193+
```
194+
195+
#### TODO
196+
197+
TODO.
198+
199+
```c
200+
TODO
201+
```
202+
203+
TODO
204+
205+
```c
206+
TODO
207+
```
208+
209+
</section>
210+
211+
<!-- /.usage -->
212+
213+
<!-- C API usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
214+
215+
<section class="notes">
216+
217+
</section>
218+
219+
<!-- /.notes -->
220+
221+
<!-- C API usage examples. -->
222+
223+
<section class="examples">
224+
225+
### Examples
226+
227+
```c
228+
TODO
229+
```
230+
231+
</section>
232+
233+
<!-- /.examples -->
234+
235+
</section>
236+
237+
<!-- /.c -->
238+
239+
<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. -->
240+
241+
<section class="related">
242+
243+
</section>
244+
245+
<!-- /.related -->
246+
247+
<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
248+
249+
<section class="links">
250+
251+
[lapack]: https://www.netlib.org/lapack/explore-html/
252+
253+
[lapack-iladlr]: https://www.netlib.org/lapack/explore-html/da/d60/group__ilalr_gadb53a9bd5cc7a6e3bbca7bf4eca32208.html
254+
255+
[mdn-float64array]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Float64Array
256+
257+
[mdn-typed-array]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray
258+
259+
</section>
260+
261+
<!-- /.links -->

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ var base = require( './base.js' );
2626
// MAIN //
2727

2828
/**
29-
* Finds the index of the last non zero row in a matrix `A`.
29+
* Finds the index of the last non zero row in a matrix `A` using alternative indexing semantics.
3030
*
3131
* @param {PositiveInteger} M - number of rows in `A`
3232
* @param {PositiveInteger} N - number of columns in `A`

0 commit comments

Comments
 (0)