Skip to content

Commit 98967e9

Browse files
committed
docs: add docs
--- 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: passed - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: passed - 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 c0126f6 commit 98967e9

File tree

3 files changed

+419
-0
lines changed

3 files changed

+419
-0
lines changed
Lines changed: 259 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,259 @@
1+
<!--
2+
3+
@license Apache-2.0
4+
5+
Copyright (c) 2025 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+
# dlaqr1
22+
23+
> Given a 2-by-2 or a 3-by-3 matrix, this LAPACK routine sets `V` to a scalar multiple of the first column of `K` where `K = (H - (sr1 + i*si1)*I)*(H - (sr2 + i*si2)*I)`.
24+
25+
<section class="usage">
26+
27+
## Usage
28+
29+
```javascript
30+
var dlaqr1 = require( '@stdlib/lapack/base/dlaqr1' );
31+
```
32+
33+
#### dlaqr1( order, N, H, LDH, sr1, si1, sr2, si2, V )
34+
35+
Given a 2-by-2 or a 3-by-3 matrix, this function sets `V` to a scalar multiple of the first column of `K` where `K = (H - (sr1 + i*si1)*I)*(H - (sr2 + i*si2)*I)`.
36+
37+
```javascript
38+
var Float64Array = require( '@stdlib/array/float64' );
39+
40+
var H = new Float64Array( [ 1.0, 3.0, 2.0, 2.0, 4.0, 6.0, 0.0, 5.0, 7.0 ] ); // => [ [ 1.0, 3.0, 2.0 ], [ 2.0, 4.0, 6.0 ], [ 0.0, 5.0, 7.0 ] ]
41+
var V = new Float64Array( 3 );
42+
43+
var out = dlaqr1( 'row-major', 3, H, 3, 1.5, 0.0, 2.5, 0.0, V );
44+
// returns <Float64Array>[ ~1.93, ~0.57, ~2.86 ]
45+
```
46+
47+
The function has the following parameters:
48+
49+
- **order**: storage layout.
50+
- **N**: number of row/columns in `H`.
51+
- **H**: input matrix stored in linear memory as a [`Float64Array`][mdn-float64array].
52+
- **LDH**: stride of the first dimension of `H` (a.k.a., leading dimension of the matrix `H`).
53+
- **sr1**: real part of the first conjugate complex shift.
54+
- **si1**: imaginary part of the first conjugate complex shift.
55+
- **sr2**: real part of the second conjugate complex shift.
56+
- **si2**: imaginary part of the second conjugate complex shift.
57+
- **V**: output [`Float64Array`][mdn-float64array].
58+
59+
Note that indexing is relative to the first index. To introduce an offset, use [`typed array`][mdn-typed-array] views.
60+
61+
<!-- eslint-disable max-len -->
62+
63+
```javascript
64+
var Float64Array = require( '@stdlib/array/float64' );
65+
66+
// Initial arrays...
67+
var H = new Float64Array( [ 0.0, 1.0, 3.0, 2.0, 2.0, 4.0, 6.0, 0.0, 5.0, 7.0 ] ); // => [ [ 1.0, 3.0, 2.0 ], [ 2.0, 4.0, 6.0 ], [ 0.0, 5.0, 7.0 ] ]
68+
var V = new Float64Array( 4 );
69+
70+
// Create offset views...
71+
var H1 = new Float64Array( H.buffer, H.BYTES_PER_ELEMENT*1 ); // start at 2nd element
72+
var V1 = new Float64Array( V.buffer, V.BYTES_PER_ELEMENT*1 ); // start at 2nd element
73+
74+
dlaqr1( 'row-major', 3, H1, 3, 1.5, 0.0, 2.5, 0.0, V1 );
75+
// V => <Float64Array>[ 0.0, ~1.93, ~0.57, ~2.86 ]
76+
```
77+
78+
#### dlaqr1.ndarray( N, H, sh1, sh2, oh, sr1, si1, sr2, si2, V, sv, ov )
79+
80+
Given a 2-by-2 or a 3-by-3 matrix, this function sets `V` to a scalar multiple of the first column of `K` where `K = (H - (sr1 + i*si1)*I)*(H - (sr2 + i*si2)*I)` using alternative indexing semantics.
81+
82+
```javascript
83+
var Float64Array = require( '@stdlib/array/float64' );
84+
85+
var H = new Float64Array( [ 1.0, 3.0, 2.0, 2.0, 4.0, 6.0, 0.0, 5.0, 7.0 ] ); // => [ [ 1.0, 3.0, 2.0 ], [ 2.0, 4.0, 6.0 ], [ 0.0, 5.0, 7.0 ] ]
86+
var V = new Float64Array( 3 );
87+
88+
var out = dlaqr1.ndarray( 3, H, 3, 1, 0, 1.5, 0.0, 2.5, 0.0, V, 1, 0 );
89+
// returns <Float64Array>[ ~1.93, ~0.57, ~2.86 ]
90+
```
91+
92+
The function has the following additional parameters:
93+
94+
- **N**: number of row/columns in `H`.
95+
- **H**: input matrix stored in linear memory as a [`Float64Array`][mdn-float64array].
96+
- **sh1**: stride of the first dimension of `H`.
97+
- **sh2**: stride of the second dimension of `H`.
98+
- **oh**: index offset for `H`.
99+
- **sr1**: real part of the first conjugate complex shift.
100+
- **si1**: imaginary part of the first conjugate complex shift.
101+
- **sr2**: real part of the second conjugate complex shift.
102+
- **si2**: imaginary part of the second conjugate complex shift.
103+
- **V**: output [`Float64Array`][mdn-float64array].
104+
- **sv**: stride length for `V`.
105+
- **ov**: index offset for `V`.
106+
107+
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,
108+
109+
<!-- eslint-disable max-len -->
110+
111+
```javascript
112+
var Float64Array = require( '@stdlib/array/float64' );
113+
114+
var H = new Float64Array( [ 0.0, 1.0, 3.0, 2.0, 2.0, 4.0, 6.0, 0.0, 5.0, 7.0 ] ); // => [ [ 1.0, 3.0, 2.0 ], [ 2.0, 4.0, 6.0 ], [ 0.0, 5.0, 7.0 ] ]
115+
var V = new Float64Array( 4 );
116+
117+
var out = dlaqr1.ndarray( 3, H, 3, 1, 1, 1.5, 0.0, 2.5, 0.0, V, 1, 1 );
118+
// returns <Float64Array>[ 0.0, ~1.93, ~0.57, ~2.86 ]
119+
```
120+
121+
</section>
122+
123+
<!-- /.usage -->
124+
125+
<section class="notes">
126+
127+
## Notes
128+
129+
- It is expected that either `sr1 = sr2` and `si1 + si2 = 0` or `si1 = si2 = 0` (i.e., they represent complex conjugate values).
130+
- This is useful for starting double implicit shift bulges in the QR algorithm.
131+
- `V` should have at least `N` indexed elements.
132+
- `dlaqr1()` corresponds to the [LAPACK][LAPACK] function [`dlaqr1`][lapack-dlaqr1].
133+
134+
</section>
135+
136+
<!-- /.notes -->
137+
138+
<section class="examples">
139+
140+
## Examples
141+
142+
<!-- eslint no-undef: "error" -->
143+
144+
```javascript
145+
var uniform = require( '@stdlib/random/array/uniform' );
146+
var Float64Array = require( '@stdlib/array/float64' );
147+
var dlaqr1 = require( '@stdlib/lapack/base/dlaqr1' );
148+
149+
// Create a random 3x3 matrix:
150+
var H = uniform( 9, -10.0, 10.0, {
151+
'dtype': 'float64'
152+
});
153+
154+
// Create an output vector:
155+
var V = new Float64Array( 3 );
156+
157+
dlaqr1( 'row-major', 3, H, 3, 1.5, 0.0, 2.5, 0.0, V );
158+
159+
// Print the result:
160+
console.log( V );
161+
```
162+
163+
</section>
164+
165+
<!-- /.examples -->
166+
167+
<!-- C interface documentation. -->
168+
169+
* * *
170+
171+
<section class="c">
172+
173+
## C APIs
174+
175+
<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->
176+
177+
<section class="intro">
178+
179+
</section>
180+
181+
<!-- /.intro -->
182+
183+
<!-- C usage documentation. -->
184+
185+
<section class="usage">
186+
187+
### Usage
188+
189+
```c
190+
TODO
191+
```
192+
193+
#### TODO
194+
195+
TODO.
196+
197+
```c
198+
TODO
199+
```
200+
201+
TODO
202+
203+
```c
204+
TODO
205+
```
206+
207+
</section>
208+
209+
<!-- /.usage -->
210+
211+
<!-- C API usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
212+
213+
<section class="notes">
214+
215+
</section>
216+
217+
<!-- /.notes -->
218+
219+
<!-- C API usage examples. -->
220+
221+
<section class="examples">
222+
223+
### Examples
224+
225+
```c
226+
TODO
227+
```
228+
229+
</section>
230+
231+
<!-- /.examples -->
232+
233+
</section>
234+
235+
<!-- /.c -->
236+
237+
<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. -->
238+
239+
<section class="related">
240+
241+
</section>
242+
243+
<!-- /.related -->
244+
245+
<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
246+
247+
<section class="links">
248+
249+
[lapack]: https://www.netlib.org/lapack/explore-html/
250+
251+
[lapack-dlaqr1]: https://www.netlib.org/lapack/explore-html/d1/d72/dlaqr1_8f.html
252+
253+
[mdn-float64array]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Float64Array
254+
255+
[mdn-typed-array]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray
256+
257+
</section>
258+
259+
<!-- /.links -->
Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
2+
{{alias}}( order, N, H, LDH, sr1, si1, sr2, si2, V )
3+
Given a 2-by-2 or a 3-by-3 matrix, this LAPACK routine sets `V` to a scalar
4+
multiple of the first column of `K` where:
5+
`K = (H - (sr1 + i*si1)*I)*(H - (sr2 + i*si2)*I)`.
6+
7+
Indexing is relative to the first index. To introduce an offset, use typed
8+
array views.
9+
10+
It is expected that either `sr1 = sr2` and `si1 + si2 = 0` or si1 = si2 = 0`
11+
(i.e., they represent complex conjugate values).
12+
13+
This is used for starting double implicit shift bulges in the QR algorithm.
14+
15+
Parameters
16+
----------
17+
order: string
18+
Storage layout.
19+
20+
N: integer
21+
Number of row/columns in `H`.
22+
23+
H: Float64Array
24+
Input matrix.
25+
26+
LDH: integer
27+
Stride of the first dimension of `H` (a.k.a., leading dimension of the
28+
matrix `H`).
29+
30+
sr1: number
31+
Real part of the first conjugate complex shift.
32+
33+
si1: number
34+
Imaginary part of the first conjugate complex shift.
35+
36+
sr2: number
37+
Real part of the second conjugate complex shift.
38+
39+
si2: number
40+
Imaginary part of the second conjugate complex shift.
41+
42+
V: Float64Array
43+
Output array.
44+
45+
Returns
46+
-------
47+
V: Float64Array
48+
Mutated output array.
49+
50+
Examples
51+
--------
52+
> var H = new {{alias:@stdlib/array/float64}}( [ 1.0, 2.0, 3.0, 4.0 ] );
53+
> var V = new {{alias:@stdlib/array/float64}}( 2 );
54+
> {{alias}}( 'row-major', 2, H, 2, 1.5, 1.0, 1.0, 2.0, V )
55+
<Float64Array>[ ~0.8, 1.5 ]
56+
57+
58+
{{alias}}.ndarray( N, H, sh1, sh2, oh, sr1, si1, sr2, si2, V, sv, ov )
59+
Given a 2-by-2 or a 3-by-3 matrix, this LAPACK routine sets `V` to a scalar
60+
multiple of the first column of `K` using alternative indexing semantics
61+
where:
62+
`K = (H - (sr1 + i*si1)*I)*(H - (sr2 + i*si2)*I)`.
63+
64+
It is expected that either `sr1 = sr2` and `si1 + si2 = 0` or si1 = si2 = 0`
65+
(i.e., they represent complex conjugate values).
66+
67+
This is used for starting double implicit shift bulges in the QR algorithm.
68+
69+
While typed array views mandate a view offset based on the underlying
70+
buffer, the offset parameters support indexing semantics based on starting
71+
indices.
72+
73+
Parameters
74+
----------
75+
N: integer
76+
Number of row/columns in `H`.
77+
78+
H: Float64Array
79+
Input matrix.
80+
81+
sh1: integer
82+
Stride of the first dimension of `H`.
83+
84+
sh2: integer
85+
Stride of the second dimension of `H`.
86+
87+
oh: integer
88+
Index offset for `H`.
89+
90+
sr1: number
91+
Real part of the first conjugate complex shift.
92+
93+
si1: number
94+
Imaginary part of the first conjugate complex shift.
95+
96+
sr2: number
97+
Real part of the second conjugate complex shift.
98+
99+
si2: number
100+
Imaginary part of the second conjugate complex shift.
101+
102+
V: Float64Array
103+
Output array.
104+
105+
sv: integer
106+
Stride length for `V`.
107+
108+
ov: integer
109+
Index offset for `V`.
110+
111+
Returns
112+
-------
113+
V: Float64Array
114+
Mutated output array.
115+
116+
Examples
117+
--------
118+
> var H = new {{alias:@stdlib/array/float64}}( [ 1.0, 2.0, 3.0, 4.0 ] );
119+
> var V = new {{alias:@stdlib/array/float64}}( 2 );
120+
> {{alias}}.ndarray( 2, H, 2, 1, 0, 1.5, 1.0, 1.0, 2.0, V, 1, 0 )
121+
<Float64Array>[ ~0.8, 1.5 ]
122+
123+
See Also
124+
--------

0 commit comments

Comments
 (0)