Skip to content

Commit eaf4a76

Browse files
committed
docs: readme added
--- 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: passed - task: lint_typescript_tests status: na - task: lint_license_headers status: passed ---
1 parent bd612ec commit eaf4a76

1 file changed

Lines changed: 298 additions & 0 deletions

File tree

  • lib/node_modules/@stdlib/blas/base/chbmv
Lines changed: 298 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,298 @@
1+
<!--
2+
3+
@license Apache-2.0
4+
5+
Copyright (c) 2026 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+
# chbmv
22+
23+
> Performs the matrix-vector operation `y = α*A*x + β*y` for complex-valued data.
24+
25+
<section class="usage">
26+
27+
## Usage
28+
29+
```javascript
30+
var chbmv = require( '@stdlib/blas/base/chbmv' );
31+
```
32+
33+
#### chbmv( order, uplo, N, K, α, A, LDA, x, sx, β, y, sy )
34+
35+
Performs the matrix-vector operation `y = α*A*x + β*y`, where `α` and `β` are complex scalars, `x` and `y` are complex vectors, and `A` is an `N` by `N` Hermitian band matrix with `K` sub-diagonals or super-diagonals.
36+
37+
```javascript
38+
var Complex64Array = require( '@stdlib/array/complex64' );
39+
var Complex64 = require( '@stdlib/complex/float32/ctor' );
40+
41+
var A = new Complex64Array( [ 0.0, 0.0, 1.0, 0.0, 2.0, -2.0, 3.0, 0.0, 4.0, -4.0, 5.0, 0.0 ] ); // eslint-disable-line max-params, max-len
42+
var x = new Complex64Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0 ] );
43+
var y = new Complex64Array( [ 3.0, 3.0, 2.0, 2.0, 1.0, 1.0 ] );
44+
var alpha = new Complex64( 0.5, 0.5 );
45+
var beta = new Complex64( 0.5, -0.5 );
46+
47+
chbmv( 'row-major', 'lower', 3, 1, alpha, A, 2, x, 1, beta, y, 1 );
48+
// y => <Complex64Array>[ -1.0, 5.0, -8.0, 20.0, 9.0, 23.0 ]
49+
```
50+
51+
The function has the following parameters:
52+
53+
- **order**: storage layout.
54+
- **uplo**: specifies whether the upper or lower triangular part of the matrix `A` is supplied.
55+
- **N**: specifies number of elements along each dimension of `A`
56+
- **K**: specifies number of super-diagonals or sub-diagonals of matrix `A`.
57+
- **α**: complex scalar constant.
58+
- **A**: complex input matrix stored in linear memory as a [`Complex64Array`][@stdlib/array/complex64].
59+
- **LDA**: stride of the first dimension of `A` (a.k.a., leading dimension of the matrix `A`).
60+
- **x**: complex input vector [`Complex64Array`][@stdlib/array/complex64].
61+
- **sx**: stride length for `x`.
62+
- **β**: complex scalar constant.
63+
- **y**: output [`Complex64Array`][@stdlib/array/complex64].
64+
- **sy**: stride length for `y`.
65+
66+
The stride parameters determine how elements are accessed. For example, to iterate over every other element in `x` and `y`,
67+
68+
```javascript
69+
var Complex64Array = require( '@stdlib/array/complex64' );
70+
var Complex64 = require( '@stdlib/complex/float32/ctor' );
71+
72+
var A = new Complex64Array( [ 0.0, 0.0, 1.0, 0.0, 2.0, -2.0, 3.0, 0.0, 4.0, -4.0, 5.0, 0.0 ] ); // eslint-disable-line max-params, max-len
73+
var x = new Complex64Array( [ 1.0, 1.0, 0.0, 0.0, 0.0, 0.0, 2.0, 2.0, 0.0, 0.0, 0.0, 0.0, 3.0, 3.0 ] ); // eslint-disable-line max-params, max-len
74+
var y = new Complex64Array( [ 3.0, 3.0, 0.0, 0.0, 2.0, 2.0, 0.0, 0.0, 1.0, 1.0 ] ); // eslint-disable-line max-params, max-len
75+
var alpha = new Complex64( 0.5, 0.5 );
76+
var beta = new Complex64( 0.5, -0.5 );
77+
78+
chbmv( 'row-major', 'lower', 3, 1, alpha, A, 2, x, 3, beta, y, 2 );
79+
// y => <Complex64Array>[ -1.0, 5.0, 0.0, 0.0, -8.0, 20.0, 0.0, 0.0, 9.0, 23.0 ]
80+
```
81+
82+
Note that indexing is relative to the first index. To introduce an offset, use [`typed array`][mdn-typed-array] views.
83+
84+
<!-- eslint-disable stdlib/capitalized-comments -->
85+
86+
```javascript
87+
var Complex64Array = require( '@stdlib/array/complex64' );
88+
var Complex64 = require( '@stdlib/complex/float32/ctor' );
89+
90+
// Initial arrays...
91+
var x0 = new Complex64Array( [ 0.0, 0.0, 1.0, 1.0, 2.0, 2.0, 3.0, 3.0 ] );
92+
var y0 = new Complex64Array( [ 0.0, 0.0, 3.0, 3.0, 2.0, 2.0, 1.0, 1.0 ] ); // eslint-disable-line max-params, max-len
93+
var A = new Complex64Array( [ 0.0, 0.0, 1.0, 0.0, 2.0, -2.0, 3.0, 0.0, 4.0, -4.0, 5.0, 0.0 ] ); // eslint-disable-line max-params, max-len
94+
var alpha = new Complex64( 0.5, 0.5 );
95+
var beta = new Complex64( 0.5, -0.5 );
96+
97+
// Create offset views...
98+
var x1 = new Complex64Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); // start at 2nd complex element
99+
var y1 = new Complex64Array( y0.buffer, y0.BYTES_PER_ELEMENT*1 ); // start at 2nd complex element
100+
101+
chbmv( 'row-major', 'lower', 3, 1, alpha, A, 2, x1, 1, beta, y1, 1 );
102+
// y1 => <Complex64Array>[ -1.0, 5.0, -8.0, 20.0, 9.0, 23.0 ]
103+
```
104+
105+
<!-- lint disable maximum-heading-length -->
106+
107+
#### chbmv.ndarray( uplo, N, K, α, A, sa1, sa2, oa, x, sx, ox, β, y, sy, oy )
108+
109+
Performs the matrix-vector operation `y = α*A*x + β*y` using alternative indexing semantics, where `α` and `β` are complex scalars, `x` and `y` are complex vectors, and `A` is an `N` by `N` Hermitian band matrix with `K` sub-diagonals or super-diagonals.
110+
111+
```javascript
112+
var Complex64Array = require( '@stdlib/array/complex64' );
113+
var Complex64 = require( '@stdlib/complex/float32/ctor' );
114+
115+
var A = new Complex64Array( [ 0.0, 0.0, 1.0, 0.0, 2.0, -2.0, 3.0, 0.0, 4.0, -4.0, 5.0, 0.0 ] ); // eslint-disable-line max-params, max-len
116+
var x = new Complex64Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0 ] );
117+
var y = new Complex64Array( [ 3.0, 3.0, 2.0, 2.0, 1.0, 1.0 ] );
118+
var alpha = new Complex64( 0.5, 0.5 );
119+
var beta = new Complex64( 0.5, -0.5 );
120+
121+
chbmv.ndarray( 'lower', 3, 1, alpha, A, 2, 1, 0, x, 1, 0, beta, y, 1, 0 );
122+
// y => <Complex64Array>[ -1.0, 5.0, -8.0, 20.0, 9.0, 23.0 ]
123+
```
124+
125+
The function has the following additional parameters:
126+
127+
- **sa1**: stride of the first dimension of `A`.
128+
- **sa2**: stride of the second dimension of `A`.
129+
- **oa**: starting index for `A`.
130+
- **ox**: starting index for `x`.
131+
- **oy**: starting index for `y`.
132+
133+
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,
134+
135+
```javascript
136+
var Complex64Array = require( '@stdlib/array/complex64' );
137+
var Complex64 = require( '@stdlib/complex/float32/ctor' );
138+
139+
var A = new Complex64Array( [ 0.0, 0.0, 1.0, 0.0, 2.0, -2.0, 3.0, 0.0, 4.0, -4.0, 5.0, 0.0 ] ); // eslint-disable-line max-params, max-len
140+
var x = new Complex64Array( [ 0.0, 0.0, 1.0, 1.0, 2.0, 2.0, 3.0, 3.0 ] );
141+
var y = new Complex64Array( [ 1.0, 1.0, 0.0, 0.0, 2.0, 2.0, 0.0, 0.0, 3.0, 3.0 ] ); // eslint-disable-line max-params, max-len
142+
143+
var alpha = new Complex64( 0.5, 0.5 );
144+
var beta = new Complex64( 0.5, -0.5 );
145+
146+
chbmv.ndarray( 'lower', 3, 1, alpha, A, 1, 2, 0, x, 1, 1, beta, y, -1, 4 );
147+
// y => <Complex64Array>[ 9.0, 23.0, 0.0, 0.0, -8.0, 20.0, 0.0, 0.0, -1.0, 5.0 ]
148+
```
149+
150+
</section>
151+
152+
<!-- /.usage -->
153+
154+
<section class="notes">
155+
156+
## Notes
157+
158+
- `chbmv()` corresponds to the [BLAS][blas] level 2 function [`chbmv`][chbmv].
159+
160+
</section>
161+
162+
<!-- /.notes -->
163+
164+
<section class="examples">
165+
166+
## Examples
167+
168+
<!-- eslint no-undef: "error" -->
169+
170+
```javascript
171+
var discreteUniform = require( '@stdlib/random/base/discrete-uniform' );
172+
var Complex64 = require( '@stdlib/complex/float32/ctor' );
173+
var filledarrayBy = require( '@stdlib/array/filled-by' );
174+
var logEach = require( '@stdlib/console/log-each' );
175+
var chbmv = require( '@stdlib/blas/base/chbmv' );
176+
177+
function rand() {
178+
return new Complex64( discreteUniform( 0, 255 ), discreteUniform( -128, 127 ) ); // eslint-disable-line max-params, max-len
179+
}
180+
181+
var N = 3;
182+
var K = 1;
183+
184+
var A = filledarrayBy( N*(K+1), 'complex64', rand );
185+
var x = filledarrayBy( N, 'complex64', rand );
186+
var y = filledarrayBy( N, 'complex64', rand );
187+
188+
var alpha = new Complex64( 0.5, 0.5 );
189+
var beta = new Complex64( 0.5, -0.5 );
190+
191+
chbmv( 'row-major', 'lower', N, 1, alpha, A, (K+1), x, 1, beta, y, 1 );
192+
193+
// Print the results:
194+
logEach( '(%s)', x );
195+
196+
chbmv.ndarray( 'lower', N, 1, alpha, A, (K+1), 1, 0, x, 1, 0, beta, y, 1, 0 );
197+
198+
// Print the results:
199+
logEach( '(%s)', x );
200+
```
201+
202+
</section>
203+
204+
<!-- /.examples -->
205+
206+
<!-- C interface documentation. -->
207+
208+
* * *
209+
210+
<section class="c">
211+
212+
## C APIs
213+
214+
<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->
215+
216+
<section class="intro">
217+
218+
</section>
219+
220+
<!-- /.intro -->
221+
222+
<!-- C usage documentation. -->
223+
224+
<section class="usage">
225+
226+
### Usage
227+
228+
```c
229+
TODO
230+
```
231+
232+
#### TODO
233+
234+
TODO.
235+
236+
```c
237+
TODO
238+
```
239+
240+
TODO
241+
242+
```c
243+
TODO
244+
```
245+
246+
</section>
247+
248+
<!-- /.usage -->
249+
250+
<!-- C API usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
251+
252+
<section class="notes">
253+
254+
</section>
255+
256+
<!-- /.notes -->
257+
258+
<!-- C API usage examples. -->
259+
260+
<section class="examples">
261+
262+
### Examples
263+
264+
```c
265+
TODO
266+
```
267+
268+
</section>
269+
270+
<!-- /.examples -->
271+
272+
</section>
273+
274+
<!-- /.c -->
275+
276+
<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. -->
277+
278+
<section class="related">
279+
280+
</section>
281+
282+
<!-- /.related -->
283+
284+
<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
285+
286+
<section class="links">
287+
288+
[blas]: http://www.netlib.org/blas
289+
290+
[chbmv]: https://www.netlib.org/lapack/explore-html/d7/dda/group__gemv_ga44c85a0d7ecd60a6bc8ca27b222d7792.html#ga44c85a0d7ecd60a6bc8ca27b222d7792
291+
292+
[mdn-typed-array]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray
293+
294+
[@stdlib/array/complex64]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/complex64
295+
296+
</section>
297+
298+
<!-- /.links -->

0 commit comments

Comments
 (0)