Skip to content

Files

This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

dgttrf

Compute an LU factorization of a real tri diagonal matrix A using elimination with partial pivoting and row interchanges.

Usage

var dgttrf = require( '@stdlib/lapack/base/dgttrf' );

dgttrf( N, DL, D, DU, DU2, IPIV )

Computes an LU factorization of a real tri diagonal matrix A using elimination with partial pivoting and row interchanges.

var Float64Array = require( '@stdlib/array/float64' );
var Int32Array = require( '@stdlib/array/int32' );

var DL = new Float64Array( [ 1.0, 1.0 ] );
var D = new Float64Array( [ 2.0, 3.0, 1.0 ] );
var DU = new Float64Array( [ 1.0, 1.0 ] );
var DU2 = new Float64Array( 1 );
var IPIV = new Int32Array( 3 );

dgttrf( 3, DL, D, DU, DU2, IPIV );
// DL => <Float64Array>[ 0.5, 0.4 ]
// D => <Float64Array>[ 2, 2.5, 0.6 ]
// DU => <Float64Array>[ 1, 1 ]
// DU2 => <Float64Array>[ 0 ]
// IPIV => <Int32Array>[ 0, 1, 2 ]

The function has the following parameters:

  • N: order of matrix A.
  • DL: the sub diagonal elements of A as a Float64Array. On exit, DL is overwritten by the multipliers that define the matrix L from the LU factorization of A.
  • D: the diagonal elements of A as a Float64Array. On exit, D is overwritten by the diagonal elements of the upper triangular matrix U from the LU factorization of A.
  • DU: the super diagonal elements of A as a Float64Array. On exit, DU is overwritten by the elements of the first super-diagonal of U.
  • DU2: On exit, DU2 is overwritten by the elements of the second super-diagonal of U as a Float64Array.
  • IPIV: vector of pivot indices as a Int32Array.

Note that indexing is relative to the first index. To introduce an offset, use typed array views.

var Float64Array = require( '@stdlib/array/float64' );
var Int32Array = require( '@stdlib/array/int32' );

// Initial arrays...
var DL0 = new Float64Array( [ 0.0, 1.0, 1.0 ] );
var D0 = new Float64Array( [ 0.0, 2.0, 3.0, 1.0 ] );
var DU0 = new Float64Array( [ 0.0, 1.0, 1.0 ] );
var DU20 = new Float64Array( 2 );
var IPIV0 = new Int32Array( 4 );

// Create offset views...
var DL = new Float64Array( DL0.buffer, DL0.BYTES_PER_ELEMENT*1 ); // start at 2nd element
var D = new Float64Array( D0.buffer, D0.BYTES_PER_ELEMENT*1 ); // start at 2nd element
var DU = new Float64Array( DU0.buffer, DU0.BYTES_PER_ELEMENT*1 ); // start at 2nd element
var DU2 = new Float64Array( DU20.buffer, DU20.BYTES_PER_ELEMENT*1 ); // start at 2nd element
var IPIV = new Int32Array( IPIV0.buffer, IPIV0.BYTES_PER_ELEMENT*1 ); // start at 2nd element

dgttrf( 3, DL, D, DU, DU2, IPIV );
// DL0 => <Float64Array>[ 0, 0.5, 0.4 ]
// D0 => <Float64Array>[ 0, 2, 2.5, 0.6 ]
// DU0 => <Float64Array>[ 0, 1, 1 ]
// DU20 => <Float64Array>[ 0, 0 ]
// IPIV0 => <Int32Array>[ 0, 0, 1, 2 ]

dgttrf.ndarray( N, DL, sdl, odl, D, sd, od, DU, sdu, odu, DU2, sdu2, odu2, IPIV, si, oi )

Computes an LU factorization of a real tri diagonal matrix A using elimination with partial pivoting and row interchanges and alternative indexing semantics.

var Float64Array = require( '@stdlib/array/float64' );
var Int32Array = require( '@stdlib/array/int32' );
var dgttrf = require( '@stdlib/lapack/base/dgttrf' );

var DL = new Float64Array( [ 1.0, 1.0 ] );
var D = new Float64Array( [ 2.0, 3.0, 1.0 ] );
var DU = new Float64Array( [ 1.0, 1.0 ] );
var DU2 = new Float64Array( 1 );
var IPIV = new Int32Array( 3 );

dgttrf.ndarray( 3, DL, 1, 0, D, 1, 0, DU, 1, 0, DU2, 1, 0, IPIV, 1, 0 );
// DL => <Float64Array>[ 0.5, 0.4 ]
// D => <Float64Array>[ 2, 2.5, 0.6 ]
// DU => <Float64Array>[ 1, 1 ]
// DU2 => <Float64Array>[ 0 ]
// IPIV => <Int32Array>[ 0, 1, 2 ]

The function has the following additional parameters:

  • sdl: stride length for DL.
  • odl: starting index for DL.
  • sd: stride length for D.
  • od: starting index for D.
  • sdu: stride length for DU.
  • odu: starting index for DU.
  • sdu2: stride length for DU2.
  • odu2: starting index for DU2.
  • si: stride length for IPIV.
  • oi: starting index for IPIV.

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 Int32Array = require( '@stdlib/array/int32' );

var DL = new Float64Array( [ 0.0, 1.0, 1.0 ] );
var D = new Float64Array( [ 0.0, 2.0, 3.0, 1.0 ] );
var DU = new Float64Array( [ 0.0, 1.0, 1.0 ] );
var DU2 = new Float64Array( 2 );
var IPIV = new Int32Array( 4 );

dgttrf.ndarray( 3, DL, 1, 1, D, 1, 1, DU, 1, 1, DU2, 1, 1, IPIV, 1, 1 );
// DL => <Float64Array>[ 0, 0.5, 0.4 ]
// D => <Float64Array>[ 0, 2, 2.5, 0.6 ]
// DU => <Float64Array>[ 0, 1, 1 ]
// DU2 => <Float64Array>[ 0, 0 ]
// IPIV => <Int32Array>[ 0, 0, 1, 2 ]

Notes

  • Both functions mutate the input arrays DL, D, DU, DU2 and IPIV.

  • Both functions return a status code indicating success or failure. A status code indicates the following conditions:

    • 0: factorization was successful.
    • <0: the k-th argument had an illegal value, where -k equals the status code value.
    • >0: U( k, k ) is exactly zero the factorization has been completed, but the factor U is exactly singular, and division by zero will occur if it is used to solve a system of equations, where k equals the status code value.
  • dgttrf() corresponds to the LAPACK routine dgttrf.

Examples

var Int32Array = require( '@stdlib/array/int32' );
var Float64Array = require( '@stdlib/array/float64' );
var dgttrf = require( '@stdlib/lapack/base/dgttrf' );

var N = 9;

var DL = new Float64Array( [ 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0 ] );

var D = new Float64Array( [ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 ] );

var DU = new Float64Array( [ 4.0, 4.0, 4.0, 4.0, 4.0, 4.0, 4.0, 4.0 ] );

var DU2 = new Float64Array( N-2 );

var IPIV = new Int32Array( N );

// Perform the `A = LU` factorization:
var info = dgttrf( N, DL, D, DU, DU2, IPIV );

console.log( DL );
console.log( D );
console.log( DU );
console.log( DU2 );
console.log( IPIV );
console.log( info );

C APIs

Usage

TODO

TODO

TODO.

TODO

TODO

TODO

Examples

TODO