Skip to content

Commit 39e963a

Browse files
committed
docs: add readme
--- 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: 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 050b4ca commit 39e963a

File tree

1 file changed

+248
-0
lines changed
  • lib/node_modules/@stdlib/lapack/base/dlaset

1 file changed

+248
-0
lines changed
Lines changed: 248 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,248 @@
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+
# dlaset
22+
23+
> LAPACK routine to initialize an M by N matrix `A` to `beta` on the diagonals and `alpha` on the off diagonals.
24+
25+
<section class="usage">
26+
27+
## Usage
28+
29+
```javascript
30+
var dlaset = require( '@stdlib/lapack/base/dlaset' );
31+
```
32+
33+
#### dlaset( order, uplo, M, N, A, LDA, alpha, beta )
34+
35+
Initialises an M by N matrix `A` to `beta` on the diagonals and `alpha` on the off diagonals.
36+
37+
```javascript
38+
var Float64Array = require( '@stdlib/array/float64' );
39+
40+
var A = new Float64Array( 4 );
41+
42+
dlaset( 'row-major', 'all', 2, 2, A, 2, 0.0, 1.0 );
43+
// A => <Float64Array>[ 1.0, 0.0, 0.0, 1.0 ]
44+
```
45+
46+
The function has the following parameters:
47+
48+
- **order**: storage layout.
49+
- **uplo**: specifies whether to set the upper or lower triangular/trapezoidal part of a matrix `A`.
50+
- **M**: number of rows in `A`.
51+
- **N**: number of columns in `A`.
52+
- **A**: input [`Float64Array`][mdn-float64array].
53+
- **LDA**: stride of the first dimension of `A` (a.k.a., leading dimension of the matrix `A`).
54+
- **alpha**: number to set on the off-diagonal elements.
55+
- **beta**: number to set on the diagonal elements.
56+
57+
Note that indexing is relative to the first index. To introduce an offset, use [`typed array`][mdn-typed-array] views.
58+
59+
<!-- eslint-disable stdlib/capitalized-comments -->
60+
61+
```javascript
62+
var Float64Array = require( '@stdlib/array/float64' );
63+
64+
// Initial arrays...
65+
var A0 = new Float64Array( 5 );
66+
67+
// Create offset views...
68+
var A1 = new Float64Array( A0.buffer, A0.BYTES_PER_ELEMENT*1 ); // start at 2nd element
69+
70+
dlaset( 'row-major', 'all', 2, 2, A1, 2, 0.0, 1.0 );
71+
// A0 => <Float64Array>[ 0.0, 1.0, 0.0, 0.0, 1.0 ]
72+
```
73+
74+
#### dlaset.ndarray( uplo, M, N, A, sa1, sa2, oa, alpha, beta )
75+
76+
Initialises an M by N matrix `A` to `beta` on the diagonals and `alpha` on the off diagonals using alternative indexing semantics.
77+
78+
```javascript
79+
var Float64Array = require( '@stdlib/array/float64' );
80+
81+
var A = new Float64Array( 4 );
82+
83+
dlaset.ndarray( 'all', 2, 2, A, 2, 1, 0, 0.0, 1.0 );
84+
// A => <Float64Array>[ 1.0, 0.0, 0.0, 1.0 ]
85+
```
86+
87+
The function has the following parameters:
88+
89+
- **uplo**: specifies whether to copy the upper or lower triangular/trapezoidal part of a matrix `A`.
90+
- **M**: number of rows in `A`.
91+
- **N**: number of columns in `A`.
92+
- **A**: input [`Float64Array`][mdn-float64array].
93+
- **sa1**: stride of the first dimension of `A`.
94+
- **sa2**: stride of the second dimension of `A`.
95+
- **oa**: starting index for `A`.
96+
- **alpha**: number to set on the off-diagonal elements.
97+
- **beta**: number to set on the diagonal elements.
98+
99+
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,
100+
101+
```javascript
102+
var Float64Array = require( '@stdlib/array/float64' );
103+
104+
var A = new Float64Array( 5 );
105+
106+
dlaset.ndarray( 'all', 2, 2, A, 2, 1, 1, 0.0, 1.0 );
107+
// A => <Float64Array>[ 0.0, 1.0, 0.0, 0.0, 1.0 ]
108+
```
109+
110+
</section>
111+
112+
<!-- /.usage -->
113+
114+
<section class="notes">
115+
116+
## Notes
117+
118+
- `dlaset()` corresponds to the [LAPACK][lapack] routine [`dlaset`][lapack-dlaset].
119+
120+
</section>
121+
122+
<!-- /.notes -->
123+
124+
<section class="examples">
125+
126+
## Examples
127+
128+
<!-- eslint no-undef: "error" -->
129+
130+
```javascript
131+
var ndarray2array = require( '@stdlib/ndarray/base/to-array' );
132+
var uniform = require( '@stdlib/random/array/discrete-uniform' );
133+
var numel = require( '@stdlib/ndarray/base/numel' );
134+
var shape2strides = require( '@stdlib/ndarray/base/shape2strides' );
135+
var dlaset = require( '@stdlib/lapack/base/dlaset' );
136+
137+
var shape = [ 5, 8 ];
138+
var order = 'row-major';
139+
var strides = shape2strides( shape, order );
140+
141+
var N = numel( shape );
142+
143+
var A = uniform( N, -10, 10, {
144+
'dtype': 'float64'
145+
});
146+
console.log( ndarray2array( A, shape, strides, 0, order ) );
147+
148+
dlaset( order, 'all', shape[ 0 ], shape[ 1 ], A, strides[ 0 ], 2.0, 3.0 );
149+
console.log( ndarray2array( A, shape, strides, 0, order ) );
150+
```
151+
152+
</section>
153+
154+
<!-- /.examples -->
155+
156+
<!-- C interface documentation. -->
157+
158+
* * *
159+
160+
<section class="c">
161+
162+
## C APIs
163+
164+
<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->
165+
166+
<section class="intro">
167+
168+
</section>
169+
170+
<!-- /.intro -->
171+
172+
<!-- C usage documentation. -->
173+
174+
<section class="usage">
175+
176+
### Usage
177+
178+
```c
179+
TODO
180+
```
181+
182+
#### TODO
183+
184+
TODO.
185+
186+
```c
187+
TODO
188+
```
189+
190+
TODO
191+
192+
```c
193+
TODO
194+
```
195+
196+
</section>
197+
198+
<!-- /.usage -->
199+
200+
<!-- C API usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
201+
202+
<section class="notes">
203+
204+
</section>
205+
206+
<!-- /.notes -->
207+
208+
<!-- C API usage examples. -->
209+
210+
<section class="examples">
211+
212+
### Examples
213+
214+
```c
215+
TODO
216+
```
217+
218+
</section>
219+
220+
<!-- /.examples -->
221+
222+
</section>
223+
224+
<!-- /.c -->
225+
226+
<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. -->
227+
228+
<section class="related">
229+
230+
</section>
231+
232+
<!-- /.related -->
233+
234+
<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
235+
236+
<section class="links">
237+
238+
[lapack]: https://www.netlib.org/lapack/explore-html/
239+
240+
[lapack-dlaset]: https://www.netlib.org/lapack/explore-html-3.6.1/d7/d43/group__aux_o_t_h_e_rauxiliary_ga89e332374c7cd87e5db54bfe21550bc3.html
241+
242+
[mdn-float64array]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Float64Array
243+
244+
[mdn-typed-array]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray
245+
246+
</section>
247+
248+
<!-- /.links -->

0 commit comments

Comments
 (0)