Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
6297862
feat: add base algorithm
aayush0325 Mar 8, 2025
f9feb03
fix: remove useless isRowMajor check
aayush0325 Mar 8, 2025
0934fcb
fix: fix bug
aayush0325 Mar 8, 2025
a7b405e
feat: complete initial implementation
aayush0325 Mar 9, 2025
234ecb0
fix: update function return value and add docs and benchmarks
aayush0325 Mar 10, 2025
5955293
bench: remove benchmarks for now
aayush0325 Mar 11, 2025
d7ad06f
test: add initial tests
aayush0325 Mar 12, 2025
9f67b52
chore: update copyright years
stdlib-bot Mar 12, 2025
0c05a90
test: more test coverage
aayush0325 Mar 12, 2025
74c41e4
fix: fix tests failing
aayush0325 Mar 13, 2025
c9cc209
fix: reduce tolerance to zero and use deepequals
aayush0325 Mar 13, 2025
8e1cab4
test: more test coverage
aayush0325 Mar 13, 2025
c75fe9a
chore: reorder tests
aayush0325 Mar 13, 2025
27413b8
test: more test coverage
aayush0325 Mar 13, 2025
7cf13c9
fix: use correct fixture
aayush0325 Mar 13, 2025
6052a73
test: more test coverage
aayush0325 Mar 14, 2025
d93acb0
test: fix up fixtures
aayush0325 Mar 17, 2025
a611da7
test: add tests for ndarray offsets
aayush0325 Mar 17, 2025
7b1f840
test: add tests for positive strides
aayush0325 Mar 18, 2025
9004f0c
test: add tests for negative strides
aayush0325 Mar 19, 2025
2f73dfc
test: add tests for complex access patterns
aayush0325 Mar 21, 2025
713f2b2
chore: organize fixtures into different folderrs
aayush0325 Mar 21, 2025
5401195
chore: update spacing
aayush0325 Mar 21, 2025
57eadae
chore: update examples
aayush0325 Mar 22, 2025
c426eed
docs: add README and update examples
aayush0325 Mar 22, 2025
5023b6b
docs: use links for int32array and float64array
aayush0325 Mar 22, 2025
baa5473
docs: add repl.txt
aayush0325 Mar 22, 2025
5a19759
docs: update repl.txt
aayush0325 Mar 24, 2025
2f7869b
docs: update repl.txt
aayush0325 Mar 24, 2025
3549a0f
docs: update repl.txt
aayush0325 Mar 24, 2025
e173344
docs: update repl.txt
aayush0325 Mar 24, 2025
903f17d
docs: update examples
aayush0325 Mar 24, 2025
4a4fce6
docs: add info about itrans
aayush0325 Mar 24, 2025
679aad1
docs: update functiond descripton
aayush0325 Mar 24, 2025
1098972
chore: fix typo
aayush0325 Mar 24, 2025
cbf4d81
bench: add benchmarks
aayush0325 Mar 30, 2025
a27111b
bench: update benchmarks
aayush0325 Mar 31, 2025
8b9045b
chore: update package.json description
aayush0325 Apr 5, 2025
ebd1ee5
bench: add benchmarks
aayush0325 Jun 2, 2025
926559a
refactor: pointer arithmetic
aayush0325 Jun 2, 2025
b5e2295
refactor: pointer arithmetic
aayush0325 Jun 2, 2025
5a2397f
refactor: pointer arithmetic
aayush0325 Jun 2, 2025
85895af
refactor: pointer arithmetic
aayush0325 Jun 2, 2025
26deeaa
refactor: pointer arithmetic
aayush0325 Jun 2, 2025
6503aa3
refactor: pointer arithmetic
aayush0325 Jun 2, 2025
1d49d2b
refactor: pointer arithmetic
aayush0325 Jun 2, 2025
f3cc919
refactor: pointer arithmetic
aayush0325 Jun 2, 2025
0750aec
docs: improve doctests for complex number instances in `math/base/spe…
AyushiJain18270 Feb 16, 2026
da10498
bench: refactor to use dynamic memory allocation in `blas/base/saxpy`
AyushiJain18270 Feb 23, 2026
e62bbc7
bench: refactor to use string interpolation in blas/ext/base/dcusumkbn2
rautelaKamal Mar 4, 2026
bafbbfa
bench: refactor to use string interpolation in blas/ext/base/dasumpw
rautelaKamal Mar 4, 2026
cd68e4f
docs: improve doctests for ndarray instances in `blas/ext/ndarray/dso…
udaykakade25 Apr 19, 2026
4f14c50
chore: cleanup
aayush0325 Jul 21, 2026
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
302 changes: 302 additions & 0 deletions lib/node_modules/@stdlib/lapack/base/dgtts2/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,302 @@
<!--

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

-->

<!-- lint disable max-len -->

# dgtts2

> Solve a system of linear equations with a tridiagonal matrix using the LU factorization computed by [dgttrf][lapack-dgttrf].

<section class="usage">

## Usage

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

#### dgtts2( order, itrans, N, nrhs, DL, D, DU, DU2, IPIV, B, LDB )

Solves a system of linear equations with a tri diagonal matrix using the LU factorization computed by [dgttrf][lapack-dgttrf].

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

var DL = new Float64Array( [ 0.25, 0.26666667 ] );
var D = new Float64Array( [ 4.0, 3.75, 3.73333333 ] );
var DU = new Float64Array( [ 1.0, 0.73333333 ] );
var DU2 = new Float64Array( [ 0.0 ] );
var IPIV = new Int32Array( [ 0, 1, 2 ] );
var B = new Float64Array( [ 7.0, 8.0, 7.0 ] );

var out = dgtts2( 'column-major', 1, 3, 1, DL, D, DU, DU2, IPIV, B, 3 );
// out => <Float64Array>[ ~1.44, ~1.25, ~1.55 ]
```

The function has the following parameters:

- **order**: storage layout.
- **itrans**: specifies the form of the system of equations.
- **N**: order of the matrix `A`.
- **nrhs**: number of right-hand sides, i.e., the number of columns of the matrix `B`.
- **DL**: multipliers that define the matrix `L` as a [`Float64Array`][mdn-float64array].
- **D**: diagonal elements of the upper triangular matrix `U` as a [`Float64Array`][mdn-float64array].
- **DU**: elements of the first super-diagonal of `U` as a [`Float64Array`][mdn-float64array].
- **DU2**: elements of the second super-diagonal of `U` as a [`Float64Array`][mdn-float64array].
- **IPIV**: vector of pivot indices as an [`Int32Array`][mdn-int32array].
- **B**: right-hand side matrix B, overwritten by the solution matrix `X` as a [`Float64Array`][mdn-float64array].
- **LDB**: stride of the first dimension of `B` (a.k.a., leading dimension of the matrix `B`).

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' );

// Initial arrays...
var DL0 = new Float64Array( [ 0.0, 0.25, 0.26666667 ] );
var D0 = new Float64Array( [ 0.0, 4.0, 3.75, 3.73333333 ] );
var DU0 = new Float64Array( [ 0.0, 1.0, 0.73333333 ] );
var DU20 = new Float64Array( [ 0.0, 0.0 ] );
var IPIV0 = new Int32Array( [ 0, 0, 1, 2 ] );
var B0 = new Float64Array( [ 0.0, 7.0, 8.0, 7.0 ] );

// 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
var B = new Float64Array( B0.buffer, B0.BYTES_PER_ELEMENT*1 ); // start at 2nd element

dgtts2( 'column-major', 1, 3, 1, DL, D, DU, DU2, IPIV, B, 3 );
// B0 => <Float64Array>[ 0.0, ~1.44, ~1.25, ~1.55 ]
```

#### dgtts2.ndarray( itrans, N, nrhs, DL, sdl, odl, D, sd, od, DU, sdu, odu, DU2, sdu2, odu2, IPIV, si, oi, B, sb1, sb2, ob )

Solves a system of linear equations with a tri diagonal matrix using the LU factorization computed by [dgttrf][lapack-dgttrf] and alternative indexing semantics.

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

var DL = new Float64Array( [ 0.25, 0.26666667 ] );
var D = new Float64Array( [ 4.0, 3.75, 3.73333333 ] );
var DU = new Float64Array( [ 1.0, 0.73333333 ] );
var DU2 = new Float64Array( [ 0.0 ] );
var IPIV = new Int32Array( [ 0, 1, 2 ] );
var B = new Float64Array( [ 7.0, 8.0, 7.0 ] );

var out = dgtts2.ndarray( 1, 3, 1, DL, 1, 0, D, 1, 0, DU, 1, 0, DU2, 1, 0, IPIV, 1, 0, B, 1, 1, 0 );
// out => <Float64Array>[ ~1.44, ~1.25, ~1.55 ]
```

The function has the following parameters:

- **itrans**: specifies the form of the system of equations.
- **N**: order of the matrix `A`.
- **nrhs**: number of right-hand sides, i.e., the number of columns of the matrix `B`.
- **DL**: multipliers that define the matrix `L` as a [`Float64Array`][mdn-float64array].
- **sdl**: stride length for `DL`.
- **odl**: starting index for `DL`.
- **D**: diagonal elements of the upper triangular matrix `U` as a [`Float64Array`][mdn-float64array].
- **sd**: stride length for `D`.
- **od**: starting index for `D`.
- **DU**: elements of the first super-diagonal of `U` as a [`Float64Array`][mdn-float64array].
- **sdu**: stride length for `DU`.
- **odu**: starting index for `DU`.
- **DU2**: elements of the second super-diagonal of `U` as a [`Float64Array`][mdn-float64array].
- **sdu2**: stride length for `DU2`.
- **odu2**: starting index for `DU2`.
- **IPIV**: vector of pivot indices as an [`Int32Array`][mdn-int32array].
- **si**: stride length for `IPIV`.
- **oi**: starting index for `IPIV`.
- **B**: right-hand side matrix B, overwritten by the solution matrix `X` as a [`Float64Array`][mdn-float64array].
- **sb1**: stride length for first dimension of `B`.
- **sb2**: stride length for second dimension of `B`.
- **ob**: starting index for `B`.

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

var DL = new Float64Array( [ 0.0, 0.25, 0.26666667 ] );
var D = new Float64Array( [ 0.0, 4.0, 3.75, 3.73333333 ] );
var DU = new Float64Array( [ 0.0, 1.0, 0.73333333 ] );
var DU2 = new Float64Array( [ 0.0, 0.0 ] );
var IPIV = new Int32Array( [ 0, 0, 1, 2 ] );
var B = new Float64Array( [ 0.0, 7.0, 8.0, 7.0 ] );

var out = dgtts2.ndarray( 1, 3, 1, DL, 1, 1, D, 1, 1, DU, 1, 1, DU2, 1, 1, IPIV, 1, 1, B, 1, 1, 1 );
// out => <Float64Array>[ 0.0, ~1.44, ~1.25, ~1.55 ]
```

</section>

<!-- /.usage -->

<section class="notes">

## Notes

- `dgtts2()` corresponds to the [LAPACK][lapack] routine [`dgtts2`][lapack-dgtts2].

</section>

<!-- /.notes -->

<section class="examples">

## Examples

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

```javascript
var ndarray2array = require( '@stdlib/ndarray/base/to-array' );
var shape2strides = require( '@stdlib/ndarray/base/shape2strides' );
var Float64Array = require( '@stdlib/array/float64' );
var Int32Array = require( '@stdlib/array/int32' );
var dgtts2 = require( '@stdlib/lapack/base/dgtts2' );

var shape = [ 3, 3 ];
var order = 'row-major';
var strides = shape2strides( shape, order );

var B = new Float64Array( [ 7.0, 8.0, 7.0, 2.0, 3.0, 4.0, 1.0, 1.5, 2.0 ] );
console.log( ndarray2array( B, shape, strides, 0, order ) );

var DL = new Float64Array( [ 0.25, 0.26666667 ] );
var D = new Float64Array( [ 4.0, 3.75, 3.73333333 ] );
var DU = new Float64Array( [ 1.0, 0.73333333 ] );
var DU2 = new Float64Array( [ 0.0 ] );
var IPIV = new Int32Array( [ 0, 1, 2 ] );

var X = dgtts2( 'row-major', 1, 3, 3, DL, D, DU, DU2, IPIV, B, 3 );
console.log( ndarray2array( X, shape, strides, 0, order ) );
```

</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-dgtts2]: https://www.netlib.org/lapack/explore-html/d2/dea/group__gtts2_gae123fb2b13f2398457e4c47f5c7f7fcd.html#gae123fb2b13f2398457e4c47f5c7f7fcd

[lapack-dgttrf]: https://www.netlib.org/lapack/explore-html/d6/d46/group__gttrf_ga8d1e46216e6c861c89bd4328b8be52a1.html#ga8d1e46216e6c861c89bd4328b8be52a1

[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
Loading