Skip to content
Open
Show file tree
Hide file tree
Changes from 2 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
332 changes: 332 additions & 0 deletions lib/node_modules/@stdlib/lapack/base/dla_gbrpvgrw/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,332 @@
<!--

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

-->

# dla_gbrpvgrw

> LAPACK routine to computes the reciprocal pivot growth factor norm(A)/norm(U) for a general banded matrix `A`.

<section class="intro">

The `dla_gbrpvgrw` routine computes the reciprocal pivot growth factor for a general banded matrix `A`. The factorization has the form:

<!-- <equation class="equation" label="eq:rpg_factor" align="center" raw="RPGFactor = norm(A) / norm(U)" alt="Equation for calculating RPG Factor."> -->

```math
\text{RPGFactor} = \frac{\text||A||}{\text||U||}
```

<!-- </equation> -->


</section>

<!-- /.intro -->


<section class="usage">

## Usage

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

```javascript
var dla_gbrpvgrw = require( '@stdlib/lapack/base/dla_gbrpvgrw' );
```

#### dla_gbrpvgrw( order, N, KL, KU, NCOLS, AB, LDAB, AFB, LDAFB )

Computes the reciprocal pivot growth factor norm(A)/norm(U) for a general banded matrix `A`.

```javascript
var Float64Array = require( '@stdlib/array/float64' );
var dla_gbrpvgrw = require( '@stdlib/lapack/base/dla_gbrpvgrw' );

/*
A = [
[ 1.0, 2.0, 0.0, 0.0 ],
[ 3.0, 4.0, 5.0, 0.0 ],
[ 0.0, 6.0, 7.0, 8.0 ],
[ 0.0, 0.0, 9.0,10.0 ]
]
*/

var AB = new Float64Array( [ 0.0, 2.0, 5.0, 8.0, 1.0, 4.0, 7.0, 10.0, 3.0, 6.0, 9.0, 0.0 ] );
var AFB = new Float64Array( [ 0.0, 0.0, 5.0, 8.0, 0.0, 4.0, 7.0, 10.0, 3.0, 6.0, 9.0, 1.8272, 0.3333, 0.1111, -0.2716, 0.0 ] );

dla_gbrpvgrw( 'row-major', 4, 1, 1, 4, AB, 3, AFB, 4 );
// 1.0
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't how we do returns annotations.

```

The function has the following parameters:

- **order**: storage layout.
- **N**: number of columns in matrix `A`.
- **KL**: number of subdiagonals within the band of matrix `A`.
- **KU**: number of superdiagonals within the band of matrix `A`.
- **NCOLS**: number of columns in matrix `A`.
- **AB**: the matrix `A` in band storage, stored in linear memory as a [`Float64Array`][mdn-float64array].
- **LDAB**: stride of the first dimension of `AB` (a.k.a., leading dimension of the matrix `AB`).
- **AFB**: the details of the LU factorization of the band matrix `A` stored in linear memory as a [`Float64Array`][mdn-float64array].
- **LDAFB**: stride of the first dimension of `AFB` (a.k.a., leading dimension of the matrix `AFB`).

The function returns the reciprocal pivot growth factor.

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 Float64Array = require( '@stdlib/array/float64' );
var dla_gbrpvgrw = require( '@stdlib/lapack/base/dla_gbrpvgrw' );

// Initial arrays...
var AB0 = new Float64Array( [ 0.0, 0.0, 2.0, 5.0, 8.0, 1.0, 4.0, 7.0, 10.0, 3.0, 6.0, 9.0, 0.0 ] );
var AFB0 = new Float64Array( [ 0.0, 0.0, 0.0, 5.0, 8.0, 0.0, 4.0, 7.0, 10.0, 3.0, 6.0, 9.0, 1.8272, 0.3333, 0.1111, -0.2716, 0.0 ] );

/*
A = [
[ 1.0, 2.0, 0.0, 0.0 ],
[ 3.0, 4.0, 5.0, 0.0 ],
[ 0.0, 6.0, 7.0, 8.0 ],
[ 0.0, 0.0, 9.0,10.0 ]
]
*/

// Create offset views...
var AB = new Float64Array( AB0.buffer, AB0.BYTES_PER_ELEMENT*1 ); // start at 2nd element
var AFB = new Float64Array( AFB0.buffer, AFB0.BYTES_PER_ELEMENT*1 ); // start at 2nd element

dla_gbrpvgrw( 'row-major', 4, 1, 1, 4, AB, 3, AFB, 4 );
// 1.0
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment here and elsewhere.

```

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

#### dla_gbrpvgrw.ndarray( N, KL, KU, NCOLS, AB, strideAB1, strideAB2, offsetAB, AFB, strideAFB1, strideAFB2, offsetAFB )

Computes the reciprocal pivot growth factor norm(A)/norm(U) for a general banded matrix `A` using alternative indexing semantics.

```javascript
var Float64Array = require( '@stdlib/array/float64' );
var dla_gbrpvgrw = require( '@stdlib/lapack/base/dla_gbrpvgrw' );

/*
A = [
[ 1.0, 2.0, 0.0, 0.0 ],
[ 3.0, 4.0, 5.0, 0.0 ],
[ 0.0, 6.0, 7.0, 8.0 ],
[ 0.0, 0.0, 9.0,10.0 ]
]
*/

var AB = new Float64Array( [ 0.0, 2.0, 5.0, 8.0, 1.0, 4.0, 7.0, 10.0, 3.0, 6.0, 9.0, 0.0 ] );
var AFB = new Float64Array( [ 0.0, 0.0, 5.0, 8.0, 0.0, 4.0, 7.0, 10.0, 3.0, 6.0, 9.0, 1.8272, 0.3333, 0.1111, -0.2716, 0.0 ] );

dla_gbrpvgrw.ndarray( 4, 1, 1, 4, AB, 4, 1, 0, AFB, 4, 1, 0 );
// 1.0
```

The function has the following parameters:

- **N**: number of columns in matrix `A`.
- **KL**: number of subdiagonals within the band of matrix `A`.
- **KU**: number of superdiagonals within the band of matrix `A`.
- **NCOLS**: number of columns in matrix `A`.
- **AB**: the matrix `A` in band storage, stored in linear memory as a [`Float64Array`][mdn-float64array].
- **strideAB1**: stride of the first dimension of `AB`.
- **strideAB2**: stride of the second dimension of `AB`.
- **offsetAB**: index offset for `AB`.
- **AFB**: the details of the LU factorization of the band matrix `A` stored in linear memory as a [`Float64Array`][mdn-float64array].
- **strideAB1**: stride of the first dimension of `AFB`.
- **strideAB2**: stride of the second dimension of `AFB`.
- **offsetAB**: index offset for `AFB`.

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 Float64Array = require( '@stdlib/array/float64' );
var dla_gbrpvgrw = require( '@stdlib/lapack/base/dla_gbrpvgrw' );

/*
A = [
[ 1.0, 2.0, 0.0, 0.0 ],
[ 3.0, 4.0, 5.0, 0.0 ],
[ 0.0, 6.0, 7.0, 8.0 ],
[ 0.0, 0.0, 9.0,10.0 ]
]
*/

var AB = new Float64Array( [ 0.0, 0.0, 2.0, 5.0, 8.0, 1.0, 4.0, 7.0, 10.0, 3.0, 6.0, 9.0, 0.0 ] );
var AFB = new Float64Array( [ 0.0, 0.0, 0.0, 5.0, 8.0, 0.0, 4.0, 7.0, 10.0, 3.0, 6.0, 9.0, 1.8272, 0.3333, 0.1111, -0.2716, 0.0 ] );

dla_gbrpvgrw.ndarray( 4, 1, 1, 4, AB, 4, 1, 1, AFB, 4, 1, 1 );
// 1.0
```

</section>

<!-- /.usage -->

<section class="notes">

## Notes

- Matrix `AB` is the matrix A in band storage, in rows 1 to KL+KU+1. The j-th column of A is stored in the j-th column of the matrix `AB` as `AB(KU+1+i-j,j) = A(i,j)` for max(1,j-KU)<=i<=min(N,j+kl).
- Matrix `AFB` stores the details of the LU factorization of the band matrix A, as computed by `DGBTRF`. `U` is stored as an upper triangular band matrix with KL+KU superdiagonals in rows 1 to `KL`+`KU`+1, and the multipliers used during the factorization are stored in rows `KL`+`KU`+2 to 2*`KL`+`KU`+1.
- The leading dimension of `AB`, `LDAB` >= KL+KU+1.
- The leading dimension of `AFB`, `LDAFB` >= 2*KL+KU+1.
- `dla_gbrpvgrw()` corresponds to the [LAPACK][LAPACK] function [`dla_gbrpvgrw`][lapack-dla_gbrpvgrw].

</section>

<!-- /.notes -->

<section class="examples">

## Examples

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

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

```javascript
var Float64Array = require( '@stdlib/array/float64' );
var ndarray2array = require( '@stdlib/ndarray/base/to-array' );
var dla_gbrpvgrw = require( '@stdlib/lapack/base/dla_gbrpvgrw' );

var N = 4;
var KL = 1;
var KU = 1;
var NCOLS = 4;
var LDAB = 3;
var LDAFB = 4;

var AB = new Float64Array( [ 0.0, 2.0, 5.0, 8.0, 1.0, 4.0, 7.0, 10.0, 3.0, 6.0, 9.0, 0.0 ] );
var AFB = new Float64Array( [ 0.0, 0.0, 5.0, 8.0, 0.0, 4.0, 7.0, 10.0, 3.0, 6.0, 9.0, 1.8272, 0.3333, 0.1111, -0.2716, 0.0 ] );

console.log( 'The matrix `AB` i.e, the matrix `A` in band storage, in rows 1 to KL+KU+1:' );
console.log( ndarray2array( AB, [ LDAB, N ], [ N, 1 ], 0, 'row-major' ) );

console.log( 'The matrix `AFB` containing the details of the LU factorization of the band matrix `A`, as computed by `DGBTRF`:' );
console.log( ndarray2array( AFB, [ LDAFB, N ], [ N, 1 ], 0, 'row-major' ) );

console.log( 'The reciprocal pivot growth factor norm(A)/norm(U) for `AB`:' );
console.log( dla_gbrpvgrw( 'row-major', N, KL, KU, NCOLS, AB, LDAB, AFB, LDAFB ) );
```

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

[lapack]: https://www.netlib.org/lapack/explore-html/

[lapack-dla_gbrpvgrw]: https://netlib.org/lapack/explore-html//d1/ddf/group__la__gbrpvgrw_ga8475794e57172d20803e770faa7d4543.html

[mdn-float64array]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Float64Array

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

</section>

<!-- /.links -->
Loading