|
| 1 | +<!-- |
| 2 | +
|
| 3 | +@license Apache-2.0 |
| 4 | +
|
| 5 | +Copyright (c) 2024 The Stdlib Authors. |
| 6 | +
|
| 7 | +Licensed under the Apache License, Version 2.0 (the "License"); |
| 8 | +you may not use this file except in compliance with the License. |
| 9 | +You may obtain a copy of the License at |
| 10 | +
|
| 11 | + http://www.apache.org/licenses/LICENSE-2.0 |
| 12 | +
|
| 13 | +Unless required by applicable law or agreed to in writing, software |
| 14 | +distributed under the License is distributed on an "AS IS" BASIS, |
| 15 | +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 16 | +See the License for the specific language governing permissions and |
| 17 | +limitations under the License. |
| 18 | +
|
| 19 | +--> |
| 20 | + |
| 21 | +# dpttrf |
| 22 | + |
| 23 | +> Compute the `L * D * L^T` factorization of a real symmetric positive definite tridiagonal matrix `A`. |
| 24 | +
|
| 25 | +<section class = "usage"> |
| 26 | + |
| 27 | +## Usage |
| 28 | + |
| 29 | +```javascript |
| 30 | +var dpttrf = require( '@stdlib/lapack/base/dpttrf' ); |
| 31 | +``` |
| 32 | + |
| 33 | +#### dpttrf( N, D, E ) |
| 34 | + |
| 35 | +Computes the `L * D * L^T` factorization of a real symmetric positive definite tridiagonal matrix `A`. |
| 36 | + |
| 37 | +```javascript |
| 38 | +var Float64Array = require( '@stdlib/array/float64' ); |
| 39 | + |
| 40 | +var D = new Float64Array( [ 4.0, 5.0, 6.0 ] ); |
| 41 | +var E = new Float64Array( [ 1.0, 2.0 ] ); |
| 42 | + |
| 43 | +dpttrf( 3, D, E ); |
| 44 | +// D => <Float64Array>[ 4, 4.75, ~5.15789 ] |
| 45 | +// E => <Float64Array>[ 0.25, ~0.4210 ] |
| 46 | +``` |
| 47 | + |
| 48 | +The function has the following parameters: |
| 49 | + |
| 50 | +- **N**: order of matrix `A`. |
| 51 | +- **D**: the `N` diagonal elements of `A` as a [`Float64Array`][mdn-float64array]. |
| 52 | +- **E**: the N-1 subdiagonal elements of `A` as a [`Float64Array`][mdn-float64array]. |
| 53 | + |
| 54 | +Note that indexing is relative to the first index. To introduce an offset, use [`typed array`][mdn-typed-array] views. |
| 55 | + |
| 56 | +<!-- eslint-disable stdlib/capitalized-comments --> |
| 57 | + |
| 58 | +```javascript |
| 59 | +var Float64Array = require( '@stdlib/array/float64' ); |
| 60 | + |
| 61 | +// Initial arrays... |
| 62 | +var D0 = new Float64Array( [ 0.0, 4.0, 5.0, 6.0 ] ); |
| 63 | +var E0 = new Float64Array( [ 0.0, 1.0, 2.0 ] ); |
| 64 | + |
| 65 | +// Create offset views... |
| 66 | +var D1 = new Float64Array( D0.buffer, D0.BYTES_PER_ELEMENT*1 ); // start at 2nd element |
| 67 | +var E1 = new Float64Array( E0.buffer, E0.BYTES_PER_ELEMENT*1 ); // start at 2nd element |
| 68 | + |
| 69 | +dpttrf( 3, D1, E1 ); |
| 70 | +// D0 => <Float64Array>[ 0.0, 4.0, 4.75, ~5.15789 ] |
| 71 | +// E0 => <Float64Array>[ 0.0, 0.25, ~0.4210 ] |
| 72 | +``` |
| 73 | + |
| 74 | +#### dpttrf.ndarray( N, D, strideD, offsetD, E, strideE, offsetE ) |
| 75 | + |
| 76 | +Computes the `L * D * L^T` factorization of a real symmetric positive definite tridiagonal matrix `A` using alternative indexing semantics. |
| 77 | + |
| 78 | +```javascript |
| 79 | +var Float64Array = require( '@stdlib/array/float64' ); |
| 80 | + |
| 81 | +var D = new Float64Array( [ 4.0, 5.0, 6.0 ] ); |
| 82 | +var E = new Float64Array( [ 1.0, 2.0 ] ); |
| 83 | + |
| 84 | +dpttrf.ndarray( 3, D, 1, 0, E, 1, 0 ); |
| 85 | +// D => <Float64Array>[ 4, 4.75, ~5.15789 ] |
| 86 | +// E => <Float64Array>[ 0.25, ~0.4210 ] |
| 87 | +``` |
| 88 | + |
| 89 | +The function has the following additional parameters: |
| 90 | + |
| 91 | +- **strideD**: stride length for `D`. |
| 92 | +- **offsetD**: starting index for `D`. |
| 93 | +- **strideE**: stride length for `E`. |
| 94 | +- **offsetE**: starting index for `E`. |
| 95 | + |
| 96 | +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, |
| 97 | + |
| 98 | +<!-- eslint-disable max-len --> |
| 99 | + |
| 100 | +```javascript |
| 101 | +var Float64Array = require( '@stdlib/array/float64' ); |
| 102 | + |
| 103 | +var D = new Float64Array( [ 0.0, 4.0, 5.0, 6.0 ] ); |
| 104 | +var E = new Float64Array( [ 0.0, 1.0, 2.0 ] ); |
| 105 | + |
| 106 | +dpttrf.ndarray( 3, D, 1, 1, E, 1, 1 ); |
| 107 | +// D => <Float64Array>[ 0.0, 4.0, 4.75, ~5.15789 ] |
| 108 | +// E => <Float64Array>[ 0.0, 0.25, ~0.4210 ] |
| 109 | +``` |
| 110 | + |
| 111 | +</section> |
| 112 | + |
| 113 | +<!-- /.usage --> |
| 114 | + |
| 115 | +<section class="notes"> |
| 116 | + |
| 117 | +## Notes |
| 118 | + |
| 119 | +- Both functions mutate the input arrays `D` and `E`. |
| 120 | + |
| 121 | +- Both functions return a status code indicating success or failure. A status code indicates the following conditions: |
| 122 | + |
| 123 | + - `0`: factorization was successful. |
| 124 | + - `<0`: the k-th argument had an illegal value, where `-k` equals the status code value. |
| 125 | + - `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. |
| 126 | + - `N`: the leading principal minor of order `N` is not positive, and factorization was completed. |
| 127 | + |
| 128 | +- `dpttrf()` corresponds to the [LAPACK][LAPACK] routine [`dpttrf`][lapack-dpttrf]. |
| 129 | + |
| 130 | +</section> |
| 131 | + |
| 132 | +<!-- /.notes --> |
| 133 | + |
| 134 | +<section class="examples"> |
| 135 | + |
| 136 | +## Examples |
| 137 | + |
| 138 | +<!-- eslint no-undef: "error" --> |
| 139 | + |
| 140 | +```javascript |
| 141 | +var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); |
| 142 | +var dpttrf = require( '@stdlib/lapack/base/dpttrf' ); |
| 143 | + |
| 144 | +var opts = { |
| 145 | + 'dtype': 'float64' |
| 146 | +}; |
| 147 | +var D = discreteUniform( 5, 1, 5, opts ); |
| 148 | +console.log( D ); |
| 149 | + |
| 150 | +var E = discreteUniform( D.length-1, 1, 5, opts ); |
| 151 | +console.log( E ); |
| 152 | + |
| 153 | +// Perform the `L * D * L^T` factorization: |
| 154 | +var info = dpttrf( D.length, D, E ); |
| 155 | +console.log( D ); |
| 156 | +console.log( E ); |
| 157 | +console.log( info ); |
| 158 | +``` |
| 159 | + |
| 160 | +</section> |
| 161 | + |
| 162 | +<!-- /.examples --> |
| 163 | + |
| 164 | +<!-- C interface documentation. --> |
| 165 | + |
| 166 | +* * * |
| 167 | + |
| 168 | +<section class="c"> |
| 169 | + |
| 170 | +## C APIs |
| 171 | + |
| 172 | +<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. --> |
| 173 | + |
| 174 | +<section class="intro"> |
| 175 | + |
| 176 | +</section> |
| 177 | + |
| 178 | +<!-- /.intro --> |
| 179 | + |
| 180 | +<!-- C usage documentation. --> |
| 181 | + |
| 182 | +<section class="usage"> |
| 183 | + |
| 184 | +### Usage |
| 185 | + |
| 186 | +```c |
| 187 | +TODO |
| 188 | +``` |
| 189 | + |
| 190 | +#### TODO |
| 191 | + |
| 192 | +TODO. |
| 193 | + |
| 194 | +```c |
| 195 | +TODO |
| 196 | +``` |
| 197 | + |
| 198 | +TODO |
| 199 | + |
| 200 | +```c |
| 201 | +TODO |
| 202 | +``` |
| 203 | + |
| 204 | +</section> |
| 205 | + |
| 206 | +<!-- /.usage --> |
| 207 | + |
| 208 | +<!-- C API usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> |
| 209 | + |
| 210 | +<section class="notes"> |
| 211 | + |
| 212 | +</section> |
| 213 | + |
| 214 | +<!-- /.notes --> |
| 215 | + |
| 216 | +<!-- C API usage examples. --> |
| 217 | + |
| 218 | +<section class="examples"> |
| 219 | + |
| 220 | +### Examples |
| 221 | + |
| 222 | +```c |
| 223 | +TODO |
| 224 | +``` |
| 225 | + |
| 226 | +</section> |
| 227 | + |
| 228 | +<!-- /.examples --> |
| 229 | + |
| 230 | +</section> |
| 231 | + |
| 232 | +<!-- /.c --> |
| 233 | + |
| 234 | +<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. --> |
| 235 | + |
| 236 | +<section class="related"> |
| 237 | + |
| 238 | +</section> |
| 239 | + |
| 240 | +<!-- /.related --> |
| 241 | + |
| 242 | +<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> |
| 243 | + |
| 244 | +<section class="links"> |
| 245 | + |
| 246 | +[lapack]: https://www.netlib.org/lapack/explore-html/ |
| 247 | + |
| 248 | +[lapack-dpttrf]: https://www.netlib.org/lapack/explore-html/d4/d2c/group__pttrf_ga8f112041da2b9b443f8761a1eaaf15b6.html#ga8f112041da2b9b443f8761a1eaaf15b6 |
| 249 | + |
| 250 | +[mdn-float64array]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Float64Array |
| 251 | + |
| 252 | +[mdn-typed-array]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray |
| 253 | + |
| 254 | +</section> |
| 255 | + |
| 256 | +<!-- /.links --> |
0 commit comments