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
338 changes: 338 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,338 @@
<!--

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

-->

# dlagbrpvgrw

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

<section class="intro">

The `dlagbrpvgrw` 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."> -->
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.

Your raw TeX is incorrect.


```math
\text{RPGFactor} = \frac{\text||A||}{\text||U||}
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 needs improving. I suggest studying TeX a bit more.

Copy link
Copy Markdown
Contributor Author

@prajjwalbajpai prajjwalbajpai Feb 28, 2026

Choose a reason for hiding this comment

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

By improving do you mean formatting or the text itself? I just showed the reciprocal pivot growth factor formula, should i include formation of AB and AFB from the matrix A for better understanding?

```

<!-- </equation> -->


</section>

<!-- /.intro -->


<section class="usage">

## Usage

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

```javascript
var dlagbrpvgrw = require( '@stdlib/lapack/base/dla-gbrpvgrw' );
```

#### dlagbrpvgrw( 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 dlagbrpvgrw = 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 ] );

var out = dlagbrpvgrw( 'row-major', 4, 1, 1, 4, AB, 3, AFB, 4 );
// returns 1.0
```

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 dlagbrpvgrw = 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

var out = dlagbrpvgrw( 'row-major', 4, 1, 1, 4, AB, 3, AFB, 4 );
// returns 1.0
```

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

#### dlagbrpvgrw.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 dlagbrpvgrw = 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 ] );

var out = dlagbrpvgrw.ndarray( 4, 1, 1, 4, AB, 4, 1, 0, AFB, 4, 1, 0 );
// returns 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 dlagbrpvgrw = 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 ] );

var out = dlagbrpvgrw.ndarray( 4, 1, 1, 4, AB, 4, 1, 1, AFB, 4, 1, 1 );
// returns 1.0
```

</section>

<!-- /.usage -->

<section class="notes">

## Notes

- The norm is used. If this is much less than 1, the stability of the LU factorization of the (equilibrated) matrix `A` could be poor. This also means that the solution `X`, estimated condition numbers, and error bounds could be unreliable.

- Matrix `AB` is the matrix A in band storage, in rows 0 to `KL+KU`. The j-th column of A is stored in the j-th column of the matrix `AB` as `AB( KU+i-j, j ) = A( i, j )` for `max( 0, j - KU ) <= i <= min( N - 1, 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 0 to `KL+KU+1`, and the multipliers used during the factorization are stored in rows `KL+KU+1` to `2*KL+KU`.

- The leading dimension of `AB`, `LDAB` >= `KL+KU+1`.

- The leading dimension of `AFB`, `LDAFB` >= `2*KL+KU+1`.

- `dlagbrpvgrw()` corresponds to the [LAPACK][LAPACK] function [`dlagbrpvgrw`][lapack-dlagbrpvgrw].

</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 dlagbrpvgrw = 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( dlagbrpvgrw( '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-dlagbrpvgrw]: 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