Skip to content

Commit 2619a88

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: passed - task: lint_typescript_tests status: na - task: lint_license_headers status: passed ---
1 parent 021c661 commit 2619a88

1 file changed

Lines changed: 306 additions & 0 deletions

File tree

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

0 commit comments

Comments
 (0)