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
311 changes: 311 additions & 0 deletions lib/node_modules/@stdlib/lapack/base/dlagtf/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,311 @@
<!--

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

-->

# dlagtf

> Compute an `LU` factorization of a matrix `T - lambda*I`, where `T` is a general real tridiagonal matrix and `lambda` is a scalar, using partial pivoting with row interchanges.

<section class="intro">

The `dlagtf` routine factorizes the matrix `T - lambda*I`, where `T` is an N-by-N real tridiagonal matrix and `lambda` is a scalar, as:

```math
T - \lambda I = P L U
```

where `P` is a permutation matrix, `L` is a unit lower tridiagonal matrix with at most one non-zero sub-diagonal element per column, and `U` is an upper triangular matrix with at most two non-zero super-diagonal elements per column.

The factorization is obtained by Gaussian elimination with partial pivoting and implicit row scaling.

</section>

<!-- /.intro -->

<section class="usage">

## Usage

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

#### dlagtf( N, A, lambda, B, C, tol, D, IN )

Computes an `LU` factorization of a matrix `T - lambda*I`, where `T` is a general real tridiagonal matrix and `lambda` is a scalar, using partial pivoting with row interchanges.

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

var A = new Float64Array( [ 2.0, 3.0, 1.0 ] );
var B = new Float64Array( [ 1.0, 1.0 ] );
var C = new Float64Array( [ 1.0, 1.0 ] );
var D = new Float64Array( [ 0.0 ] );
var IN = new Int32Array( [ 0, 0, 0 ] );

dlagtf( 3, A, 0.0, B, C, 0.0, D, IN );
// A => <Float64Array>[ 2.0, 2.5, 0.6 ]
// B => <Float64Array>[ 1.0, 1.0 ]
// C => <Float64Array>[ 0.5, 0.4 ]
// D => <Float64Array>[ 0.0 ]
// IN => <Int32Array>[ 0, 0, 0 ]
```

The function has the following parameters:

- **N**: order of the matrix `T`.
- **A**: diagonal elements of `T` as a [`Float64Array`][mdn-float64array]. Should have `N` indexed elements. Overwritten by the diagonal elements of `U`.
- **lambda**: scalar constant.
- **B**: first super-diagonal elements of `T` as a [`Float64Array`][mdn-float64array]. Should have `N-1` indexed elements. Overwritten by the first super-diagonal elements of `U`.
- **C**: first sub-diagonal elements of `T` as a [`Float64Array`][mdn-float64array]. Should have `N-1` indexed elements. Overwritten by the multipliers that define `L`.
- **tol**: relative tolerance constant used to indicate whether `T - lambda*I` is nearly singular.
- **D**: second super-diagonal elements of `U` as a [`Float64Array`][mdn-float64array]. Should have `N-2` indexed elements. Overwritten by the second super-diagonal elements of `U`.
- **IN**: pivot indicators and singularity details as an [`Int32Array`][mdn-int32array]. Should have `N` indexed elements.

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

// Initial arrays...
var A0 = new Float64Array( [ 0.0, 2.0, 3.0, 1.0 ] );
var B0 = new Float64Array( [ 0.0, 1.0, 1.0 ] );
var C0 = new Float64Array( [ 0.0, 1.0, 1.0 ] );
var D0 = new Float64Array( [ 0.0, 0.0 ] );
var IN0 = new Int32Array( [ 0, 0, 0, 0 ] );

// Create offset views...
var A = new Float64Array( A0.buffer, A0.BYTES_PER_ELEMENT*1 ); // start at 2nd element
var B = new Float64Array( B0.buffer, B0.BYTES_PER_ELEMENT*1 ); // start at 2nd element
var C = new Float64Array( C0.buffer, C0.BYTES_PER_ELEMENT*1 ); // start at 2nd element
var D = new Float64Array( D0.buffer, D0.BYTES_PER_ELEMENT*1 ); // start at 2nd element
var IN = new Int32Array( IN0.buffer, IN0.BYTES_PER_ELEMENT*1 ); // start at 2nd element

dlagtf( 3, A, 0.0, B, C, 0.0, D, IN );
// A0 => <Float64Array>[ 0.0, 2.0, 2.5, 0.6 ]
// C0 => <Float64Array>[ 0.0, 0.5, 0.4 ]
```

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

#### dlagtf.ndarray( N, A, strideA, offsetA, lambda, B, strideB, offsetB, C, strideC, offsetC, tol, D, strideD, offsetD, IN, strideIN, offsetIN )

Computes an `LU` factorization of a matrix `T - lambda*I`, where `T` is a general real tridiagonal matrix and `lambda` is a scalar, using partial pivoting with row interchanges and alternative indexing semantics.

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

var A = new Float64Array( [ 2.0, 3.0, 1.0 ] );
var B = new Float64Array( [ 1.0, 1.0 ] );
var C = new Float64Array( [ 1.0, 1.0 ] );
var D = new Float64Array( [ 0.0 ] );
var IN = new Int32Array( [ 0, 0, 0 ] );

dlagtf.ndarray( 3, A, 1, 0, 0.0, B, 1, 0, C, 1, 0, 0.0, D, 1, 0, IN, 1, 0 );
// A => <Float64Array>[ 2.0, 2.5, 0.6 ]
// B => <Float64Array>[ 1.0, 1.0 ]
// C => <Float64Array>[ 0.5, 0.4 ]
// D => <Float64Array>[ 0.0 ]
// IN => <Int32Array>[ 0, 0, 0 ]
```

The function has the following additional parameters:

- **strideA**: stride length for `A`.
- **offsetA**: starting index for `A`.
- **strideB**: stride length for `B`.
- **offsetB**: starting index for `B`.
- **strideC**: stride length for `C`.
- **offsetC**: starting index for `C`.
- **strideD**: stride length for `D`.
- **offsetD**: starting index for `D`.
- **strideIN**: stride length for `IN`.
- **offsetIN**: starting index for `IN`.

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

var A = new Float64Array( [ 0.0, 2.0, 3.0, 1.0 ] );
var B = new Float64Array( [ 0.0, 1.0, 1.0 ] );
var C = new Float64Array( [ 0.0, 1.0, 1.0 ] );
var D = new Float64Array( [ 0.0, 0.0 ] );
var IN = new Int32Array( [ 0, 0, 0, 0 ] );

dlagtf.ndarray( 3, A, 1, 1, 0.0, B, 1, 1, C, 1, 1, 0.0, D, 1, 1, IN, 1, 1 );
// A => <Float64Array>[ 0.0, 2.0, 2.5, 0.6 ]
// C => <Float64Array>[ 0.0, 0.5, 0.4 ]
```

</section>

<!-- /.usage -->

<section class="notes">

## Notes

- Both functions mutate the input arrays `A`, `B`, `C`, `D`, and `IN`.
- `dlagtf()` corresponds to the [LAPACK][lapack] routine [`dlagtf`][lapack-dlagtf].

</section>

<!-- /.notes -->

<section class="examples">

## Examples

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

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

var N = 5;

var A = new Float64Array( [ 2.0, 3.0, 1.0, 2.0, 1.0 ] );
var B = new Float64Array( [ 1.0, 1.0, 1.0, 1.0 ] );
var C = new Float64Array( [ 1.0, 1.0, 1.0, 1.0 ] );
var D = new Float64Array( N-2 );
var IN = new Int32Array( N );

var info = dlagtf( N, A, 0.0, B, C, 0.0, D, IN );

console.log( A );
console.log( B );
console.log( C );
console.log( D );
console.log( IN );
console.log( info );
```

</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-dlagtf]: https://netlib.org/lapack/explore-html/d1/d90/group__lagtf_ga10cc4eb3c789fad38b52a86698d5a24a.html#ga10cc4eb3c789fad38b52a86698d5a24a

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

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

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

</section>

<!-- /.links -->
Loading