|
| 1 | +/** |
| 2 | +* @license Apache-2.0 |
| 3 | +* |
| 4 | +* Copyright (c) 2025 The Stdlib Authors. |
| 5 | +* |
| 6 | +* Licensed under the Apache License, Version 2.0 (the "License"); |
| 7 | +* you may not use this file except in compliance with the License. |
| 8 | +* You may obtain a copy of the License at |
| 9 | +* |
| 10 | +* http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | +* |
| 12 | +* Unless required by applicable law or agreed to in writing, software |
| 13 | +* distributed under the License is distributed on an "AS IS" BASIS, |
| 14 | +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 15 | +* See the License for the specific language governing permissions and |
| 16 | +* limitations under the License. |
| 17 | +*/ |
| 18 | + |
| 19 | +'use strict'; |
| 20 | + |
| 21 | +// MODULES // |
| 22 | + |
| 23 | +var format = require( '@stdlib/string/format' ); |
| 24 | +var base = require( './base.js' ); |
| 25 | + |
| 26 | + |
| 27 | +// MAIN // |
| 28 | + |
| 29 | +/** |
| 30 | +* Computes an LU factorization of a real tri diagonal matrix A using elimination with partial pivoting and row interchanges. |
| 31 | +* |
| 32 | +* @param {NonNegativeInteger} N - order of `A` |
| 33 | +* @param {Float64Array} DL - sub diagonal elements of `A` |
| 34 | +* @param {integer} strideDL - stride of the sub diagonal elements of `A` |
| 35 | +* @param {NonNegativeInteger} offsetDL - offset of the sub diagonal elements of `A` |
| 36 | +* @param {Float64Array} D - diagonal elements of `A` |
| 37 | +* @param {integer} strideD - stride of the diagonal elements of `A` |
| 38 | +* @param {NonNegativeInteger} offsetD - offset of the diagonal elements of `A` |
| 39 | +* @param {Float64Array} DU - diagonal elements of `A` |
| 40 | +* @param {integer} strideDU - stride of the first super diagonal elements of `A` |
| 41 | +* @param {NonNegativeInteger} offsetDU - offset of the first super diagonal elements of `A` |
| 42 | +* @param {Float64Array} DU2 - diagonal elements of `A` |
| 43 | +* @param {integer} strideDU2 - stride of the second super diagonal elements of `A` |
| 44 | +* @param {NonNegativeInteger} offsetDU2 - offset of the second super diagonal elements of `A` |
| 45 | +* @param {Int32Array} IPIV - vector of pivot indices |
| 46 | +* @param {integer} strideIPIV - `IPIV` stride length |
| 47 | +* @param {NonNegativeInteger} offsetIPIV - index offset for `IPIV` |
| 48 | +* @throws {RangeError} first argument must be a nonnegative integer |
| 49 | +* @returns {integer} status code |
| 50 | +* |
| 51 | +* @example |
| 52 | +* var Float64Array = require( '@stdlib/array/float64' ); |
| 53 | +* |
| 54 | +* var DL = new Float64Array( [ 1.0, 1.0 ] ); |
| 55 | +* var D = new Float64Array( [ 2.0, 3.0, 1.0 ] ); |
| 56 | +* var DU = new Float64Array( [ 1.0, 1.0 ] ); |
| 57 | +* var DU2 = new Float64Array( [ 0.0 ] ); |
| 58 | +* var IPIV = new Int32Array( [ 0, 1, 2 ] ); |
| 59 | +* |
| 60 | +* dgttrf( 3, DL, 1, 0, D, 1, 0, DU, 1, 0, DU2, 1, 0, IPIV, 1, 0 ); |
| 61 | +* // DL => <Float64Array>[ 0.5, 0.4 ] |
| 62 | +* // D => <Float64Array>[ 2, 2.5, 0.6 ] |
| 63 | +* // DU => <Float64Array>[ 1, 1 ] |
| 64 | +* // DU2 => <Float64Array>[ 0 ] |
| 65 | +*/ |
| 66 | +function dgttrf( N, DL, strideDL, offsetDL, D, strideD, offsetD, DU, strideDU, offsetDU, DU2, strideDU2, offsetDU2, IPIV, strideIPIV, offsetIPIV ) { // eslint-disable-line max-len, max-params |
| 67 | + if ( N < 0 ) { |
| 68 | + throw new RangeError( format( 'invalid argument. First argument must be a nonnegative integer. Value: `%d`.', N ) ); |
| 69 | + } |
| 70 | + return base( N, DL, strideDL, offsetDL, D, strideD, offsetD, DU, strideDU, offsetDU, DU2, strideDU2, offsetDU2, IPIV, strideIPIV, offsetIPIV ); // eslint-disable-line max-len |
| 71 | +} |
| 72 | + |
| 73 | + |
| 74 | +// EXPORTS // |
| 75 | + |
| 76 | +module.exports = dgttrf; |
0 commit comments