About stdlib...
We 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!
spttrf
Compute the
L * D * L^Tfactorization of a real symmetric positive definite tridiagonal matrixA.
Installation
npm install @stdlib/lapack-base-spttrf
Usage
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.
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 => <Float32Array>[ 4, 4.75, ~5.15789 ]
// E => <Float32Array>[ 0.25, ~0.4210 ]
The function has the following parameters:
- N: order of matrix
A. - D: the
Ndiagonal elements ofAas aFloat32Array. - E: the N-1 subdiagonal elements of
Aas aFloat32Array.
Note that indexing is relative to the first index. To introduce an offset, use typed array views.
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 => <Float32Array>[ 0.0, 4.0, 4.75, ~5.15789 ]
// E0 => <Float32Array>[ 0.0, 0.25, ~0.4210 ]
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.
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 => <Float32Array>[ 4, 4.75, ~5.15789 ]
// E => <Float32Array>[ 0.25, ~0.4210 ]
The function has the following additional parameters:
- strideD: stride length for
D. - offsetD: starting index for
D. - strideE: stride length for
E. - offsetE: starting index for
E.
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 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 => <Float32Array>[ 0.0, 4.0, 4.75, ~5.15789 ]
// E => <Float32Array>[ 0.0, 0.25, ~0.4210 ]
Notes
Both functions mutate the input arrays
DandE.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-kequals the status code value.0 < k < N: the leading principal minor of orderkis not positive and factorization could not be completed, wherekequals the status code value.N: the leading principal minor of orderNis not positive, and factorization was completed.
Examples
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 APIs
Usage
TODO
TODO
TODO.
TODO
TODO
TODO
Examples
TODO
Notice
This package is part of 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, see the main project repository.
Community
License
See LICENSE.
Copyright
Copyright 2016-2026. The Stdlib Authors.