Skip to content

Latest commit

 

History

History
332 lines (218 loc) · 9.66 KB

File metadata and controls

332 lines (218 loc) · 9.66 KB

dla_gbrpvgrw

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

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

$$\text{RPGFactor} = \frac{\text||A||}{\text||U||}$$

Usage

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.

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

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.
  • 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.
  • 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 views.

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

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.

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.
  • 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.
  • strideAB1: stride of the first dimension of AFB.
  • strideAB2: stride of the second dimension of AFB.
  • offsetAB: index offset for AFB.

While typed array views mandate a view offset based on the underlying buffer, the offset parameters support indexing semantics based on starting indices. For example,

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

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 function dla_gbrpvgrw.

Examples

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 ) );

C APIs

Usage

TODO

TODO

TODO.

TODO

TODO

TODO

Examples

TODO