Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
a820134
feat: chpmv base setup
DivitJain26 Mar 29, 2026
c01c034
update
DivitJain26 Apr 1, 2026
85c048e
feat: base algorithm working
DivitJain26 Apr 1, 2026
e6a82d8
feat: lib added
DivitJain26 Apr 2, 2026
c02d159
feat: incorrect file removed
DivitJain26 Apr 2, 2026
9fe1220
test: test file added
DivitJain26 Apr 2, 2026
dd12410
test: test.chpmv file added
DivitJain26 Apr 2, 2026
a5ad986
test: test.ndarray file added
DivitJain26 Apr 2, 2026
2f158bd
test: test.ndarray file added
DivitJain26 Apr 2, 2026
a03bcf1
test: layout, uplo combination fixtures added
DivitJain26 Apr 2, 2026
ba9f54a
test: beta scaled output fixtures added
DivitJain26 Apr 2, 2026
f6a8929
test: input vector strides fixtures added
DivitJain26 Apr 2, 2026
e911707
test: offset fixtures added
DivitJain26 Apr 2, 2026
064a5db
test: ap stride fixtures added
DivitJain26 Apr 2, 2026
6df3f46
test: complex access pattern fixtures added
DivitJain26 Apr 2, 2026
976c529
docs: types added
DivitJain26 Apr 3, 2026
bf8d337
docs: types tests added
DivitJain26 Apr 3, 2026
33b932e
docs: repl.txt added
DivitJain26 Apr 3, 2026
9330147
bench: add bechmarks
DivitJain26 Apr 3, 2026
9e89ed6
bench: add example
DivitJain26 Apr 3, 2026
23ead71
docs: add readme file
DivitJain26 Apr 3, 2026
af7ca6a
docs: add readme file
DivitJain26 Apr 3, 2026
509bc48
Merge branch 'develop' into blas/base/chpmv
DivitJain26 Apr 3, 2026
dfe62b2
Merge branch 'develop' into blas/base/chpmv
DivitJain26 Apr 9, 2026
b97c3cf
docs: update link to chpmv
DivitJain26 Apr 9, 2026
c9c769c
test: cover zero-beta branch
DivitJain26 Apr 9, 2026
a096f94
test: update validation
DivitJain26 Apr 15, 2026
c918c8e
refactor: improve float32 precision for addition assignment
DivitJain26 Apr 15, 2026
e633511
refactor: update variable names
DivitJain26 Apr 15, 2026
3bfab67
chore: clean up in benchmarks
DivitJain26 Apr 18, 2026
3c58239
chore: clean up in docs
DivitJain26 Apr 18, 2026
45b492b
chore: clean up in example
DivitJain26 Apr 18, 2026
7002bc3
chore: clean up in lib
DivitJain26 Apr 18, 2026
b72e23b
chore: clean up in readme
DivitJain26 Apr 18, 2026
382d080
chore: clean up
DivitJain26 Apr 21, 2026
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
306 changes: 306 additions & 0 deletions lib/node_modules/@stdlib/blas/base/chpmv/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,306 @@
<!--

@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.

-->

# chpmv

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

<section class="usage">

## Usage

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

#### chpmv( order, uplo, N, α, AP, x, sx, β, y, sy )

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.

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

```javascript
var Complex64Array = require( '@stdlib/array/complex64' );
var Complex64 = require( '@stdlib/complex/float32/ctor' );

var AP = new Complex64Array( [ 1.0, 0.0, 2.0, -2.0, 4.0, 0.0, 3.0, -3.0, 5.0, -5.0, 6.0, 0.0 ] );
var x = new Complex64Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0 ] );
var y = new Complex64Array( [ 3.0, 3.0, 2.0, 2.0, 1.0, 1.0 ] );
var alpha = new Complex64( 0.5, 0.5 );
var beta = new Complex64( 0.5, -0.5 );

chpmv( 'row-major', 'lower', 3, alpha, AP, x, 1, beta, y, 1 );
// y => <Complex64Array>[ -10.0, 14.0, -11.0, 25.0, 14.0, 31.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`.
- **α**: scalar constant.
- **AP**: input matrix in packed form stored in linear memory as a [`Complex64Array`][@stdlib/array/complex64].
- **x**: input vector [`Complex64Array`][@stdlib/array/complex64].
- **sx**: stride length for `x`.
- **β**: scalar constant.
- **y**: output [`Complex64Array`][@stdlib/array/complex64].
- **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 Complex64Array = require( '@stdlib/array/complex64' );
var Complex64 = require( '@stdlib/complex/float32/ctor' );

var AP = new Complex64Array( [ 1.0, 0.0, 2.0, -2.0, 4.0, 0.0, 3.0, -3.0, 5.0, -5.0, 6.0, 0.0 ] );
var x = new Complex64Array( [ 1.0, 1.0, 0.0, 0.0, 2.0, 2.0, 0.0, 0.0, 3.0, 3.0 ] );
var y = new Complex64Array( [ 3.0, 3.0, 0.0, 0.0, 2.0, 2.0, 0.0, 0.0, 1.0, 1.0 ] );
var alpha = new Complex64( 0.5, 0.5 );
var beta = new Complex64( 0.5, -0.5 );

chpmv( 'row-major', 'lower', 3, alpha, AP, x, 2, beta, y, 2 );
// y => <Complex64Array>[ -10.0, 14.0, 0.0, 0.0, -11.0, 25.0, 0.0, 0.0, 14.0, 31.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 Complex64Array = require( '@stdlib/array/complex64' );
var Complex64 = require( '@stdlib/complex/float32/ctor' );

// Initial arrays...
var x0 = new Complex64Array( [ 0.0, 0.0, 1.0, 1.0, 2.0, 2.0, 3.0, 3.0 ] );
var y0 = new Complex64Array( [ 0.0, 0.0, 3.0, 3.0, 2.0, 2.0, 1.0, 1.0 ] );
var AP = new Complex64Array( [ 1.0, 0.0, 2.0, -2.0, 4.0, 0.0, 3.0, -3.0, 5.0, -5.0, 6.0, 0.0 ] );
var alpha = new Complex64( 0.5, 0.5 );
var beta = new Complex64( 0.5, -0.5 );

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

chpmv( 'row-major', 'lower', 3, alpha, AP, x1, 1, beta, y1, 1 );
// y1 => <Complex64Array>[ -10.0, 14.0, -11.0, 25.0, 14.0, 31.0 ]
```

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

#### chpmv.ndarray( order, uplo, N, α, A, sap, oap, 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 `N` element vectors, and `A` is an `N` by `N` Hermitian matrix supplied in packed form.

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

```javascript
var Complex64Array = require( '@stdlib/array/complex64' );
var Complex64 = require( '@stdlib/complex/float32/ctor' );

var AP = new Complex64Array( [ 1.0, 0.0, 2.0, -2.0, 4.0, 0.0, 3.0, -3.0, 5.0, -5.0, 6.0, 0.0 ] );
var x = new Complex64Array( [ 1.0, 1.0, 2.0, 2.0, 3.0, 3.0 ] );
var y = new Complex64Array( [ 3.0, 3.0, 2.0, 2.0, 1.0, 1.0 ] );
var alpha = new Complex64( 0.5, 0.5 );
var beta = new Complex64( 0.5, -0.5 );

chpmv.ndarray( 'row-major', 'lower', 3, alpha, AP, 1, 0, x, 1, 0, beta, y, 1, 0 );
// y => <Complex64Array>[ -10.0, 14.0, -11.0, 25.0, 14.0, 31.0 ]
```

The function has the following additional parameters:

- **sap**: stride of `AP`..
- **oap**: starting index for `AP`.
- **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 Complex64Array = require( '@stdlib/array/complex64' );
var Complex64 = require( '@stdlib/complex/float32/ctor' );

var AP = new Complex64Array( [ 1.0, 0.0, 2.0, -2.0, 4.0, 0.0, 3.0, -3.0, 5.0, -5.0, 6.0, 0.0 ] );
var x = new Complex64Array( [ 0.0, 0.0, 1.0, 1.0, 2.0, 2.0, 3.0, 3.0 ] );
var y = new Complex64Array( [ 1.0, 1.0, 0.0, 0.0, 2.0, 2.0, 0.0, 0.0, 3.0, 3.0 ] );

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

chpmv.ndarray( 'row-major', 'lower', 3, alpha, AP, 1, 0, x, 1, 1, beta, y, -2, 4 );
// y => <Complex64Array>[ 14.0, 31.0, 0.0, 0.0, -11.0, 25.0, 0.0, 0.0, -10.0, 14.0 ]
```

</section>

<!-- /.usage -->

<section class="notes">

## Notes

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

</section>

<!-- /.notes -->

<section class="examples">

## Examples

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

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

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

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

var N = 5;

var AP = filledarrayBy( N*(N+1)/2, 'complex64', rand );
var x = filledarrayBy( N, 'complex64', rand );
var y = filledarrayBy( N, 'complex64', rand );

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

chpmv( 'row-major', 'lower', N, alpha, AP, x, 1, beta, y, 1 );

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

chpmv.ndarray( 'row-major', 'lower', N, alpha, AP, 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

[chpmv]: https://www.netlib.org/lapack/explore-html/d0/d4b/group__hpmv_ga8615e798761db472ab0abb8f67594287.html#ga8615e798761db472ab0abb8f67594287

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

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

</section>

<!-- /.links -->
Loading