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

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

-->

# dlagtm

> Perform a matrix-matrix product of the form `B := alpha * A * X + beta * B` where `A` is a tridiagonal matrix.

<section class="usage">

## Usage

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

#### dlagtm( order, trans, N, NRHS, alpha, DL, D, DU, X, LDX, beta, B, LDB )

Performs a matrix-matrix product of the form `B := alpha * A * X + beta * B` where `A` is a tridiagonal matrix of order `N`, `B` and `X` are `N` by `NRHS` matrices, and `alpha` and `beta` are real scalars, each of which may be `0`, `1`, or `-1`.

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

var DL = new Float64Array( [ 1.0, 1.0 ] );
var D = new Float64Array( [ 2.0, 3.0, 4.0 ] );
var DU = new Float64Array( [ 1.0, 1.0 ] );
var X = new Float64Array( [ 1.0, 1.0, 1.0 ] );
var B = new Float64Array( [ 0.0, 0.0, 0.0 ] );

dlagtm( 'column-major', 'no-transpose', 3, 1, 1.0, DL, D, DU, X, 3, 0.0, B, 3 );
// B => <Float64Array>[ 3.0, 5.0, 5.0 ]
```

The function has the following parameters:

- **order**: storage layout.
- **trans**: specifies the operation applied to `A`. Must be one of `'no-transpose'`, `'transpose'`, or `'conjugate-transpose'`.
- **N**: order of the tridiagonal matrix `A`.
- **NRHS**: number of right hand sides (i.e., number of columns of `X` and `B`).
- **alpha**: scalar `alpha`. Must be `0`, `1`, or `-1`; otherwise, it is assumed to be `0`.
- **DL**: the `N-1` sub-diagonal elements of `A` as a [`Float64Array`][mdn-float64array].
- **D**: the `N` diagonal elements of `A` as a [`Float64Array`][mdn-float64array].
- **DU**: the `N-1` super-diagonal elements of `A` as a [`Float64Array`][mdn-float64array].
- **X**: input matrix `X` as a [`Float64Array`][mdn-float64array].
- **LDX**: stride of the first dimension of `X` (a.k.a., leading dimension of the matrix `X`).
- **beta**: scalar `beta`. Must be `0`, `1`, or `-1`; otherwise, it is assumed to be `1`.
- **B**: input/output matrix `B` 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' );

// Initial arrays:
var DL0 = new Float64Array( [ 0.0, 1.0, 1.0 ] );
var D0 = new Float64Array( [ 0.0, 2.0, 3.0, 4.0 ] );
var DU0 = new Float64Array( [ 0.0, 1.0, 1.0 ] );

// Create offset views:
var DL1 = new Float64Array( DL0.buffer, DL0.BYTES_PER_ELEMENT*1 );
var D1 = new Float64Array( D0.buffer, D0.BYTES_PER_ELEMENT*1 );
var DU1 = new Float64Array( DU0.buffer, DU0.BYTES_PER_ELEMENT*1 );

var X = new Float64Array( [ 1.0, 1.0, 1.0 ] );
var B = new Float64Array( [ 0.0, 0.0, 0.0 ] );

dlagtm( 'column-major', 'no-transpose', 3, 1, 1.0, DL1, D1, DU1, X, 3, 0.0, B, 3 );
// B => <Float64Array>[ 3.0, 5.0, 5.0 ]
```

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

#### dlagtm.ndarray( trans, N, NRHS, alpha, DL, sdl, odl, D, sd, od, DU, sdu, odu, X, sx1, sx2, ox, beta, B, sb1, sb2, ob )

Performs a matrix-matrix product of the form `B := alpha * A * X + beta * B` where `A` is a tridiagonal matrix, using alternative indexing semantics.

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

var DL = new Float64Array( [ 1.0, 1.0 ] );
var D = new Float64Array( [ 2.0, 3.0, 4.0 ] );
var DU = new Float64Array( [ 1.0, 1.0 ] );
var X = new Float64Array( [ 1.0, 1.0, 1.0 ] );
var B = new Float64Array( [ 0.0, 0.0, 0.0 ] );

dlagtm.ndarray( 'no-transpose', 3, 1, 1.0, DL, 1, 0, D, 1, 0, DU, 1, 0, X, 1, 3, 0, 0.0, B, 1, 3, 0 );
// B => <Float64Array>[ 3.0, 5.0, 5.0 ]
```

The function has the following parameters:

- **trans**: specifies the operation applied to `A`.
- **N**: order of the tridiagonal matrix `A`.
- **NRHS**: number of right hand sides.
- **alpha**: scalar `alpha`.
- **DL**: the sub-diagonal elements of `A` as a [`Float64Array`][mdn-float64array].
- **sdl**: stride length for `DL`.
- **odl**: starting index of `DL`.
- **D**: the diagonal elements of `A` as a [`Float64Array`][mdn-float64array].
- **sd**: stride length for `D`.
- **od**: starting index of `D`.
- **DU**: the super-diagonal elements of `A` as a [`Float64Array`][mdn-float64array].
- **sdu**: stride length for `DU`.
- **odu**: starting index of `DU`.
- **X**: input matrix `X` as a [`Float64Array`][mdn-float64array].
- **sx1**: stride of the first dimension of `X`.
- **sx2**: stride of the second dimension of `X`.
- **ox**: starting index for `X`.
- **beta**: scalar `beta`.
- **B**: input/output matrix `B` as a [`Float64Array`][mdn-float64array].
- **sb1**: stride of the first dimension of `B`.
- **sb2**: stride of the 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 DL = new Float64Array( [ 0.0, 1.0, 1.0 ] );
var D = new Float64Array( [ 0.0, 2.0, 3.0, 4.0 ] );
var DU = new Float64Array( [ 0.0, 1.0, 1.0 ] );
var X = new Float64Array( [ 1.0, 1.0, 1.0 ] );
var B = new Float64Array( [ 0.0, 0.0, 0.0 ] );

dlagtm.ndarray( 'no-transpose', 3, 1, 1.0, DL, 1, 1, D, 1, 1, DU, 1, 1, X, 1, 3, 0, 0.0, B, 1, 3, 0 );
// B => <Float64Array>[ 3.0, 5.0, 5.0 ]
```

</section>

<!-- /.usage -->

<section class="notes">

## Notes

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

</section>

<!-- /.notes -->

<section class="examples">

## Examples

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

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

var DL = new Float64Array( [ 1.0, 2.0 ] );
var D = new Float64Array( [ 3.0, 4.0, 5.0 ] );
var DU = new Float64Array( [ 6.0, 7.0 ] );
var X = new Float64Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] );
var B = new Float64Array( 6 );

var order = 'row-major';

// Compute B = A * X:
dlagtm( order, 'no-transpose', 3, 2, 1.0, DL, D, DU, X, 2, 0.0, B, 2 );

console.log( ndarray2array( B, [ 3, 2 ], [ 2, 1 ], 0, order ) );
// => [ [ 21.0, 30.0 ], [ 48.0, 60.0 ], [ 31.0, 38.0 ] ]
```

</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-dlagtm]: https://netlib.org/lapack/explore-html/db/dff/group__lagtm_gae4e1245409a54da68d2c104091c89bfa.html

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

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

</section>

<!-- /.links -->
Loading
Loading