Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
a381192
feat(blas): add base implementation of cgbmv
DivitJain26 Feb 24, 2026
9594594
feat(blas): add cgbmv.js
DivitJain26 Feb 24, 2026
6f51063
feat(blas): add ndarray.js
DivitJain26 Feb 24, 2026
1ff8882
feat(blas): add main.js
DivitJain26 Feb 24, 2026
7378d22
feat(blas): add index.js
DivitJain26 Feb 24, 2026
a619f7d
feat: base implementation added
DivitJain26 Feb 25, 2026
cec35de
chores: example useage corrected
DivitJain26 Feb 26, 2026
064b09b
fix(lint): add missing package.json for cgbmv
DivitJain26 Feb 26, 2026
b028501
fix(lint): add missing package.json for cgbmv
DivitJain26 Feb 26, 2026
f86970d
fix(lint): add missing package.json for cgbmv
DivitJain26 Feb 26, 2026
947a7c0
fix: base.js fixed
DivitJain26 Feb 27, 2026
2296ba5
fix: base.js fixed 2
DivitJain26 Feb 28, 2026
2719241
test: test.js implementation added
DivitJain26 Feb 28, 2026
7e58625
test: test.cgbmv.js implementation added
DivitJain26 Feb 28, 2026
dc65679
chores: clean up test.cgbmv.js
DivitJain26 Feb 28, 2026
468136a
test: clean ups
DivitJain26 Mar 1, 2026
0f38d0d
test: add ndarray tests for cgbmv
DivitJain26 Mar 1, 2026
2aabad8
test: LDA to lda
DivitJain26 Mar 2, 2026
5d4e1c8
chore: updates bounds and indexing of 2nd brnach in base implementation
DivitJain26 Mar 2, 2026
1b9b469
test: added fixtures cnt, rnt, ct, rt, ca, ra cxpyp, rxpyp
DivitJain26 Mar 2, 2026
5514d36
test: conjugate-transpose and vector strides fixture added
DivitJain26 Mar 7, 2026
e1cc979
test: conjugate-transpose test case added
DivitJain26 Mar 7, 2026
75bb006
chore: variable name changed
DivitJain26 Mar 7, 2026
21e785d
test: fixture fixed
DivitJain26 Mar 7, 2026
c507444
test: y vector length corrected
DivitJain26 Mar 7, 2026
7203bfb
chore: clean up
DivitJain26 Mar 7, 2026
66e57de
test: y vector fixtures packing corrected
DivitJain26 Mar 7, 2026
298e8cb
test: matrix A strideA1 and strideA2 fixtures added
DivitJain26 Mar 7, 2026
ff4c7f5
test: complex access pattern fixture added
DivitJain26 Mar 8, 2026
d7ce5ff
test: x zeros beta 1 and x zaros beta not 1 cases added
DivitJain26 Mar 8, 2026
9b48eeb
chore: description updated
DivitJain26 Mar 8, 2026
833fb3f
docs: docs added
DivitJain26 Mar 8, 2026
c6a186f
chore: clean up
DivitJain26 Mar 8, 2026
da812f3
test: benchmark added
DivitJain26 Mar 9, 2026
b2608ec
docs: explame for cgbmv added
DivitJain26 Mar 9, 2026
30a6843
chore: function description updated
DivitJain26 Mar 9, 2026
bde093f
docs: readme added
DivitJain26 Mar 9, 2026
1819cd1
docs: readme added
DivitJain26 Mar 9, 2026
0f8de07
docs: readme added
DivitJain26 Mar 9, 2026
c802ac8
docs: readme added
DivitJain26 Mar 9, 2026
f95c0bc
docs: readme added
DivitJain26 Mar 9, 2026
79d3656
docs: readme added
DivitJain26 Mar 9, 2026
a10ee3c
chore: clean up
DivitJain26 Mar 20, 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
301 changes: 301 additions & 0 deletions lib/node_modules/@stdlib/blas/base/cgbmv/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,301 @@
<!--

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

-->

# cgbmv

> Perform one of the matrix-vector operations `y = α*A*x + β*y` or `y = α*A^T*x + β*y` or `y = α*A^H*x + β*y` for complex-valued data.

<section class="usage">

## Usage

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

#### cgbmv( order, trans, M, N, KL, KU, α, A, LDA, x, sx, β, y, sy )

Performs one of the matrix-vector operations `y = α*A*x + β*y` or `y = α*A^T*x + β*y` or `y = α*A^H*x + β*y`, where `α` and `β` are complex scalars, `x` and `y` are complex vectors, and `A` is an `M` by `N` complex band matrix with `KL` sub-diagonals and `KU` super-diagonals.

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

var A = new Complex64Array( [ 0.0, 0.0, 1.0, 1.0, 3.0, 3.0, 2.0, 2.0, 4.0, 4.0, 6.0, 6.0, 5.0, 5.0, 7.0, 7.0, 0.0, 0.0 ] ); // eslint-disable-line max-params, max-len
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 );

cgbmv( 'row-major', 'no-transpose', 3, 3, 1, 1, alpha, A, 3, x, 1, beta, y, 1 );
// y => <Complex64Array>[ -4.0, 7.0, -26.0, 28.0, -30.0, 31.0 ]
```

The function has the following parameters:

- **order**: storage layout.
- **trans**: specifies whether `A` should be transposed, conjugate-transposed, or not transposed.
- **M**: number of rows in the matrix `A`.
- **N**: number of columns in the matrix `A`.
- **KL**: number of sub-diagonals in the matrix `A`.
- **KU**: number of super-diagonals in the matrix `A`.
- **α**: complex scalar constant.
- **A**: input band matrix stored in linear memory as a [`Complex64Array`][@stdlib/array/complex64]. The band matrix is first stored in compact band form, where only the diagonals within the bandwidth are kept, and is then laid out sequentially in linear memory.
- **LDA**: stride of the first dimension of `A` (a.k.a., leading dimension of the matrix `A`).
- **x**: input [`Complex64Array`][@stdlib/array/complex64].
- **sx**: stride length for `x`.
- **β**: complex 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`,

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

var A = new Complex64Array( [ 0.0, 0.0, 1.0, 1.0, 3.0, 3.0, 2.0, 2.0, 4.0, 4.0, 6.0, 6.0, 5.0, 5.0, 7.0, 7.0, 0.0, 0.0 ] ); // eslint-disable-line max-params, max-len
var x = 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
var y = new Complex64Array( [ 3.0, 3.0, 0.0, 0.0, 0.0, 0.0, 2.0, 2.0, 0.0, 0.0, 0.0, 0.0, 1.0, 1.0 ] ); // eslint-disable-line max-params, max-len
var alpha = new Complex64( 0.5, 0.5 );
var beta = new Complex64( 0.5, -0.5 );

cgbmv( 'row-major', 'no-transpose', 3, 3, 1, 1, alpha, A, 3, x, 2, beta, y, 3 );
// y => <Complex64Array>[ -4.0, 7.0, 0.0, 0.0, 0.0, 0.0, -26.0, 28.0, 0.0, 0.0, 0.0, 0.0, -30.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 -->

```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 ] ); // eslint-disable-line max-params, max-len
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
var A = new Complex64Array( [ 0.0, 0.0, 1.0, 1.0, 3.0, 3.0, 2.0, 2.0, 4.0, 4.0, 6.0, 6.0, 5.0, 5.0, 7.0, 7.0, 0.0, 0.0 ] ); // eslint-disable-line max-params, max-len

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

cgbmv( 'row-major', 'no-transpose', 3, 3, 1, 1, alpha, A, 3, x1, 1, beta, y1, 1 ); // eslint-disable-line max-params, max-len
// y1 => <Complex64Array>[ -4.0, 7.0, -26.0, 28.0, -30.0, 31.0 ]
```

<!-- lint disable maximum-heading-length -->
#### cgbmv.ndarray( trans, M, N, KL, KU, α, A, sa1, sa2, oa, x, sx, ox, β, y, sy, oy )

Performs one of the matrix-vector operations `y = α*A*x + β*y` or `y = α*A^T*x + β*y` or `y = α*A^H*x + β*y` using alternative indexing semantics, where `α` and `β` are complex scalars, `x` and `y` are complex vectors, and `A` is an `M` by `N` complex band matrix with `KL` sub-diagonals and `KU` super-diagonals.

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

var A = new Complex64Array( [ 0.0, 0.0, 1.0, 1.0, 3.0, 3.0, 2.0, 2.0, 4.0, 4.0, 6.0, 6.0, 5.0, 5.0, 7.0, 7.0, 0.0, 0.0 ] ); // eslint-disable-line max-params, max-len
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 );

cgbmv.ndarray( 'no-transpose', 3, 3, 1, 1, alpha, A, 3, 1, 0, x, 1, 0, beta, y, 1, 0 );
// y => <Complex64Array>[ -4.0, 7.0, -26.0, 28.0, -30.0, 31.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,

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

var A = new Complex64Array( [ 0.0, 0.0, 1.0, 1.0, 3.0, 3.0, 2.0, 2.0, 4.0, 4.0, 6.0, 6.0, 5.0, 5.0, 7.0, 7.0, 0.0, 0.0 ] ); // eslint-disable-line max-params, max-len
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 ] ); // eslint-disable-line max-params, max-len
var alpha = new Complex64( 0.5, 0.5 );
var beta = new Complex64( 0.5, -0.5 );

cgbmv.ndarray( 'no-transpose', 3, 3, 1, 1, alpha, A, 3, 1, 0, x, 1, 1, beta, y, -2, 4 );
// y => <Complex64Array>[ -30.0, 31.0, 0.0, 0.0, -26.0, 28.0, 0.0, 0.0, -4.0, 7.0 ]
```

</section>

<!-- /.usage -->

<section class="notes">

## Notes

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

</section>

<!-- /.notes -->

<section class="examples">

## Examples

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

```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 cgbmv = require( '@stdlib/blas/base/cgbmv' );

function rand() {
return new Complex64( discreteUniform( 0, 255 ), discreteUniform( -128, 127 ) ); // eslint-disable-line max-params, max-len
}

var M = 3;
var N = 3;
var KL = 1;
var KU = 1;

var A = filledarrayBy( (KL+KU+1)*N, 'complex64', rand );
var x = filledarrayBy( N, 'complex64', rand );
var y = filledarrayBy( M, 'complex64', rand );

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

cgbmv( 'row-major', 'no-transpose', M, N, KL, KU, alpha, A, (KL+KU+1), x, 1, beta, y, 1 ); // eslint-disable-line max-params, max-len

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

cgbmv.ndarray( 'no-transpose', M, N, KL, KU, alpha, A, 1, (KL+KU+1), 0, x, 1, 0, beta, y, 1, 0 ); // eslint-disable-line max-params, max-len

// 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

[cgbmv]: https://www.netlib.org/lapack/explore-html/d7/dda/group__gemv_ga44c85a0d7ecd60a6bc8ca27b222d7792.html#ga44c85a0d7ecd60a6bc8ca27b222d7792

[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