Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
314 changes: 314 additions & 0 deletions lib/node_modules/@stdlib/blas/base/zhbmv/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,314 @@
<!--

@license Apache-2.0

Copyright (c) 2026 The Stdlib Authors.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

-->

# zhbmv

> Performs the matrix-vector operation `y = α*A*x + β*y`.

<section class="usage">

## Usage

```javascript
var zhbmv = require( '@stdlib/blas/base/zhbmv' );
```

#### zhbmv( order, uplo, N, K, α, A, LDA, x, sx, β, y, sy )

Performs the matrix-vector operation `y = α*A*x + β*y`, where `α` and `β` are scalars, `x` and `y` are vectors, and `A` is an `N` by `N` Hermitian band matrix with `K` super-diagonals.

<!-- eslint-disable max-len -->

```javascript
var Complex128Array = require( '@stdlib/array/complex128' );
var Complex128 = require( '@stdlib/complex/float64/ctor' );

var A = new Complex128Array( [ 0.0, 0.0, 1.0, 0.0, 2.0, -2.0, 3.0, 0.0, 4.0, -4.0, 5.0, 0.0 ] );
var x = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0 ] );
var y = new Complex128Array( [ 3.0, 3.0, 2.0, 2.0, 1.0, 1.0 ] );

var alpha = new Complex128( 0.5, 0.5 );
var beta = new Complex128( 0.5, -0.5 );

zhbmv( 'row-major', 'lower', 3, 1, alpha, A, 2, x, 1, beta, y, 1 );
// y => <Complex128Array>[ -1.0, 5.0, -8.0, 20.0, 9.0, 23.0 ]
```

The function has the following parameters:

- **order**: storage layout.
- **uplo**: specifies whether the upper or lower triangular part of the matrix `A` is supplied.
- **N**: specifies number of elements along each dimension of `A`
- **K**: specifies number of super-diagonals or sub-diagonals of matrix `A`.
- **α**: scalar constant.
- **A**: input matrix stored in linear memory as a [`Complex128Array`][@stdlib/array/complex128].
- **LDA**: stride of the first dimension of `A` (a.k.a., leading dimension of the matrix `A`).
- **x**: input vector [`Complex128Array`][@stdlib/array/complex128].
- **sx**: stride length for `x`.
- **β**: scalar constant.
- **y**: output [`Complex128Array`][@stdlib/array/complex128].
- **sy**: stride length for `y`.

The stride parameters determine how elements are accessed. For example, to iterate over every other element in `x` and `y`,

<!-- eslint-disable max-len -->

```javascript
var Complex128Array = require( '@stdlib/array/complex128' );
var Complex128 = require( '@stdlib/complex/float64/ctor' );

var A = new Complex128Array( [ 0.0, 0.0, 1.0, 0.0, 2.0, -2.0, 3.0, 0.0, 4.0, -4.0, 5.0, 0.0 ] );
var x = new Complex128Array( [ 1.0, 1.0, 0.0, 0.0, 2.0, 2.0, 0.0, 0.0, 3.0, 3.0 ] );
var y = new Complex128Array( [ 3.0, 3.0, 0.0, 0.0, 2.0, 2.0, 0.0, 0.0, 1.0, 1.0 ] );

var alpha = new Complex128( 0.5, 0.5 );
var beta = new Complex128( 0.5, -0.5 );

zhbmv( 'row-major', 'lower', 3, 1, alpha, A, 2, x, 2, beta, y, 2 );
// y => <Complex128Array>[ -1.0, 5.0, 0.0, 0.0, -8.0, 20.0, 0.0, 0.0, 9.0, 23.0 ]
```

Note that indexing is relative to the first index. To introduce an offset, use [`typed array`][mdn-typed-array] views.

<!-- eslint-disable stdlib/capitalized-comments -->

<!-- eslint-disable max-len -->

```javascript
var Complex128Array = require( '@stdlib/array/complex128' );
var Complex128 = require( '@stdlib/complex/float64/ctor' );

// Initial arrays...
var x0 = new Complex128Array( [ 0.0, 0.0, 1.0, 1.0, 2.0, 2.0, 3.0, 3.0 ] );
var y0 = new Complex128Array( [ 0.0, 0.0, 3.0, 3.0, 2.0, 2.0, 1.0, 1.0 ] );
var A = new Complex128Array( [ 0.0, 0.0, 1.0, 0.0, 2.0, -2.0, 3.0, 0.0, 4.0, -4.0, 5.0, 0.0 ] );

var alpha = new Complex128( 0.5, 0.5 );
var beta = new Complex128( 0.5, -0.5 );

// Create offset views...
var x1 = new Complex128Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); // start at 2nd complex element
var y1 = new Complex128Array( y0.buffer, y0.BYTES_PER_ELEMENT*1 ); // start at 2nd complex element

zhbmv( 'row-major', 'lower', 3, 1, alpha, A, 2, x1, 1, beta, y1, 1 );
// y1 => <Complex128Array>[ -1.0, 5.0, -8.0, 20.0, 9.0, 23.0 ]
```

<!-- lint disable maximum-heading-length -->

#### zhbmv.ndarray( uplo, N, K, α, A, sa1, sa2, oa, x, sx, ox, β, y, sy, oy )

Performs the matrix-vector operation `y = α*A*x + β*y` using alternative indexing semantics, where `α` and `β` are scalars, `x` and `y` are vectors, and `A` is an `N` by `N` Hermitian band matrix with `K` super-diagonals.

<!-- eslint-disable max-len -->

```javascript
var Complex128Array = require( '@stdlib/array/complex128' );
var Complex128 = require( '@stdlib/complex/float64/ctor' );

var A = new Complex128Array( [ 0.0, 0.0, 1.0, 0.0, 2.0, -2.0, 3.0, 0.0, 4.0, -4.0, 5.0, 0.0 ] );
var x = new Complex128Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0 ] );
var y = new Complex128Array( [ 3.0, 3.0, 2.0, 2.0, 1.0, 1.0 ] );

var alpha = new Complex128( 0.5, 0.5 );
var beta = new Complex128( 0.5, -0.5 );

zhbmv.ndarray( 'lower', 3, 1, alpha, A, 2, 1, 0, x, 1, 0, beta, y, 1, 0 );
// y => <Complex128Array>[ -1.0, 5.0, -8.0, 20.0, 9.0, 23.0 ]
```

The function has the following additional parameters:

- **sa1**: stride of the first dimension of `A`.
- **sa2**: stride of the second dimension of `A`.
- **oa**: starting index for `A`.
- **ox**: starting index for `x`.
- **oy**: starting index for `y`.

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,

<!-- eslint-disable max-len -->

```javascript
var Complex128Array = require( '@stdlib/array/complex128' );
var Complex128 = require( '@stdlib/complex/float64/ctor' );

var A = new Complex128Array( [ 0.0, 0.0, 1.0, 0.0, 2.0, -2.0, 3.0, 0.0, 4.0, -4.0, 5.0, 0.0 ] );
var x = new Complex128Array( [ 0.0, 0.0, 1.0, 1.0, 2.0, 2.0, 3.0, 3.0 ] );
var y = new Complex128Array( [ 1.0, 1.0, 0.0, 0.0, 2.0, 2.0, 0.0, 0.0, 3.0, 3.0 ] );

var alpha = new Complex128( 0.5, 0.5 );
var beta = new Complex128( 0.5, -0.5 );

zhbmv.ndarray( 'lower', 3, 1, alpha, A, 2, 1, 0, x, 1, 1, beta, y, -2, 4 );
// y => <Complex128Array>[ 9.0, 23.0, 0.0, 0.0, -8.0, 20.0, 0.0, 0.0, -1.0, 5.0 ]
```

</section>

<!-- /.usage -->

<section class="notes">

## Notes

- `zhbmv()` corresponds to the [BLAS][blas] level 2 function [`zhbmv`][zhbmv].

</section>

<!-- /.notes -->

<section class="examples">

## Examples

<!-- eslint no-undef: "error" -->

<!-- eslint-disable max-len -->

```javascript
var discreteUniform = require( '@stdlib/random/base/discrete-uniform' );
var Complex128 = require( '@stdlib/complex/float64/ctor' );
var filledarrayBy = require( '@stdlib/array/filled-by' );
var logEach = require( '@stdlib/console/log-each' );
var zhbmv = require( '@stdlib/blas/base/zhbmv' );

function rand() {
return new Complex128( discreteUniform( 0, 255 ), discreteUniform( -128, 127 ) );
}

var N = 3;
var K = 1;

var A = filledarrayBy( N*(K+1), 'complex128', rand );
var x = filledarrayBy( N, 'complex128', rand );
var y = filledarrayBy( N, 'complex128', rand );

var alpha = new Complex128( 0.5, 0.5 );
var beta = new Complex128( 0.5, -0.5 );

zhbmv( 'row-major', 'lower', N, 1, alpha, A, (K+1), x, 1, beta, y, 1 );

// Print the results:
logEach( '%s', x );

zhbmv.ndarray( 'lower', N, 1, alpha, A, (K+1), 1, 0, x, 1, 0, beta, y, 1, 0 );

// Print the results:
logEach( '%s', x );
```

</section>

<!-- /.examples -->

<!-- C interface documentation. -->

* * *

<section class="c">

## C APIs

<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->

<section class="intro">

</section>

<!-- /.intro -->

<!-- C usage documentation. -->

<section class="usage">

### Usage

```c
TODO
```

#### TODO

TODO.

```c
TODO
```

TODO

```c
TODO
```

</section>

<!-- /.usage -->

<!-- C API usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->

<section class="notes">

</section>

<!-- /.notes -->

<!-- C API usage examples. -->

<section class="examples">

### Examples

```c
TODO
```

</section>

<!-- /.examples -->

</section>

<!-- /.c -->

<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. -->

<section class="related">

</section>

<!-- /.related -->

<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->

<section class="links">

[blas]: http://www.netlib.org/blas

[zhbmv]: https://netlib.org/lapack/explore-html//da/dd4/group__hbmv_ga694b0528a7854e8d4a02fc5d2b646d2c.html

[mdn-typed-array]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray

[@stdlib/array/complex128]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/complex128

</section>

<!-- /.links -->
Loading