Compute the `L * D * L^T` factorization of a real symmetric positive definite tridiagonal matrix `A`.
npm install @stdlib/lapack-base-spttrfWe believe in a future in which the web is a preferred environment for numerical computation. To help realize this future, we've built stdlib. stdlib is a standard library, with an emphasis on numerical and scientific computation, written in JavaScript (and C) for execution in browsers and in Node.js. The library is fully decomposable, being architected in such a way that you can swap out and mix and match APIs and functionality to cater to your exact preferences and use cases. When you use stdlib, you can be absolutely certain that you are using the most thorough, rigorous, well-written, studied, documented, tested, measured, and high-quality code out there. To join us in bringing numerical computing to the web, get started by checking us out on GitHub, and please consider financially supporting stdlib. We greatly appreciate your continued support!
About stdlib...
[![NPM version][npm-image]][npm-url] [![Build Status][test-image]][test-url] [![Coverage Status][coverage-image]][coverage-url]
> Compute the L D L^T factorization of a real symmetric positive definite tridiagonal matrix A.
``bash`
npm install @stdlib/lapack-base-spttrf
`javascript`
var spttrf = require( '@stdlib/lapack-base-spttrf' );
#### spttrf( N, D, E )
Computes the L D L^T factorization of a real symmetric positive definite tridiagonal matrix A.
`javascript
var Float32Array = require( '@stdlib/array-float32' );
var D = new Float32Array( [ 4.0, 5.0, 6.0 ] );
var E = new Float32Array( [ 1.0, 2.0 ] );
spttrf( 3, D, E );
// D =>
// E =>
`
The function has the following parameters:
- N: order of matrix A.N
- D: the diagonal elements of A as a [Float32Array][mdn-float32array].A
- E: the N-1 subdiagonal elements of as a [Float32Array][mdn-float32array].
Note that indexing is relative to the first index. To introduce an offset, use [typed array][mdn-typed-array] views.
`javascript
var Float32Array = require( '@stdlib/array-float32' );
// Initial arrays...
var D0 = new Float32Array( [ 0.0, 4.0, 5.0, 6.0 ] );
var E0 = new Float32Array( [ 0.0, 1.0, 2.0 ] );
// Create offset views...
var D1 = new Float32Array( D0.buffer, D0.BYTES_PER_ELEMENT*1 ); // start at 2nd element
var E1 = new Float32Array( E0.buffer, E0.BYTES_PER_ELEMENT*1 ); // start at 2nd element
spttrf( 3, D1, E1 );
// D0 =>
// E0 =>
`
#### spttrf.ndarray( N, D, strideD, offsetD, E, strideE, offsetE )
Computes the L D L^T factorization of a real symmetric positive definite tridiagonal matrix A using alternative indexing semantics.
`javascript
var Float32Array = require( '@stdlib/array-float32' );
var D = new Float32Array( [ 4.0, 5.0, 6.0 ] );
var E = new Float32Array( [ 1.0, 2.0 ] );
spttrf.ndarray( 3, D, 1, 0, E, 1, 0 );
// D =>
// E =>
`
The function has the following additional parameters:
- strideD: stride length for D.D
- offsetD: starting index for .E
- strideE: stride length for .E
- offsetE: starting index for .
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,
`javascript
var Float32Array = require( '@stdlib/array-float32' );
var D = new Float32Array( [ 0.0, 4.0, 5.0, 6.0 ] );
var E = new Float32Array( [ 0.0, 1.0, 2.0 ] );
spttrf.ndarray( 3, D, 1, 1, E, 1, 1 );
// D =>
// E =>
`
- Both functions mutate the input arrays D and E.
- 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 < k < N
- : the leading principal minor of order k is not positive and factorization could not be completed, where k equals the status code value.N
- : the leading principal minor of order N is not positive, and factorization was completed.
- spttrf() corresponds to the [LAPACK][LAPACK] routine [spttrf][lapack-spttrf].
`javascript
var discreteUniform = require( '@stdlib/random-array-discrete-uniform' );
var spttrf = require( '@stdlib/lapack-base-spttrf' );
var opts = {
'dtype': 'float32'
};
var D = discreteUniform( 5, 1, 5, opts );
console.log( D );
var E = discreteUniform( D.length-1, 1, 5, opts );
console.log( E );
// Perform the L D L^T factorization:`
var info = spttrf( D.length, D, E );
console.log( D );
console.log( E );
console.log( info );
*
`c`
TODO
#### TODO
TODO.
`c`
TODO
TODO
`c`
TODO
`c`
TODO
*
This package is part of [stdlib][stdlib], a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more.
For more information on the project, filing bug reports and feature requests, and guidance on how to develop [stdlib][stdlib], see the main project [repository][stdlib].
#### Community
[![Chat][chat-image]][chat-url]
---
See [LICENSE][stdlib-license].
Copyright © 2016-2026. The Stdlib [Authors][stdlib-authors].
[npm-image]: http://img.shields.io/npm/v/@stdlib/lapack-base-spttrf.svg
[npm-url]: https://npmjs.org/package/@stdlib/lapack-base-spttrf
[test-image]: https://github.com/stdlib-js/lapack-base-spttrf/actions/workflows/test.yml/badge.svg?branch=v0.1.1
[test-url]: https://github.com/stdlib-js/lapack-base-spttrf/actions/workflows/test.yml?query=branch:v0.1.1
[coverage-image]: https://img.shields.io/codecov/c/github/stdlib-js/lapack-base-spttrf/main.svg
[coverage-url]: https://codecov.io/github/stdlib-js/lapack-base-spttrf?branch=main
[chat-image]: https://img.shields.io/badge/zulip-join_chat-brightgreen.svg
[chat-url]: https://stdlib.zulipchat.com
[stdlib]: https://github.com/stdlib-js/stdlib
[stdlib-authors]: https://github.com/stdlib-js/stdlib/graphs/contributors
[umd]: https://github.com/umdjs/umd
[es-module]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules
[deno-url]: https://github.com/stdlib-js/lapack-base-spttrf/tree/deno
[deno-readme]: https://github.com/stdlib-js/lapack-base-spttrf/blob/deno/README.md
[umd-url]: https://github.com/stdlib-js/lapack-base-spttrf/tree/umd
[umd-readme]: https://github.com/stdlib-js/lapack-base-spttrf/blob/umd/README.md
[esm-url]: https://github.com/stdlib-js/lapack-base-spttrf/tree/esm
[esm-readme]: https://github.com/stdlib-js/lapack-base-spttrf/blob/esm/README.md
[branches-url]: https://github.com/stdlib-js/lapack-base-spttrf/blob/main/branches.md
[stdlib-license]: https://raw.githubusercontent.com/stdlib-js/lapack-base-spttrf/main/LICENSE
[lapack]: https://www.netlib.org/lapack/explore-html/
[lapack-spttrf]: https://www.netlib.org/lapack/explore-html/d4/d2c/group__pttrf_gab14da40f02882c3fb75197041cf58169.html#gab14da40f02882c3fb75197041cf58169
[mdn-float32array]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Float32Array
[mdn-typed-array]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray