|  | 
|  | 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 | +# dtrsv | 
|  | 22 | + | 
|  | 23 | +> Solve one of the systems of equations `A*x = b` or `A^T*x = b`. | 
|  | 24 | +
 | 
|  | 25 | +<section class = "usage"> | 
|  | 26 | + | 
|  | 27 | +## Usage | 
|  | 28 | + | 
|  | 29 | +```javascript | 
|  | 30 | +var dtrsv = require( '@stdlib/blas/base/dtrsv' ); | 
|  | 31 | +``` | 
|  | 32 | + | 
|  | 33 | +#### dtrsv( order, uplo, trans, diag, N, A, LDA, x, sx ) | 
|  | 34 | + | 
|  | 35 | +Solves one of the systems of equations `A*x = b` or `A^T*x = b` where `b` and `x` are `N` element vectors and `A` is an `N` by `N` unit, or non-unit, upper or lower triangular matrix. | 
|  | 36 | + | 
|  | 37 | +```javascript | 
|  | 38 | +var Float64Array = require( '@stdlib/array/float64' ); | 
|  | 39 | + | 
|  | 40 | +var A = new Float64Array( [ 1.0, 2.0, 3.0, 0.0, 1.0, 2.0, 0.0, 0.0, 1.0 ] ); | 
|  | 41 | +var x = new Float64Array( [ 1.0, 2.0, 3.0 ] ); | 
|  | 42 | + | 
|  | 43 | +dtrsv( 'row-major', 'upper', 'no-transpose', 'unit', 3, A, 3, x, 1 ); | 
|  | 44 | +// x => <Float64Array>[ 0.0, -4.0, 3.0 ] | 
|  | 45 | +``` | 
|  | 46 | + | 
|  | 47 | +The function has the following parameters: | 
|  | 48 | + | 
|  | 49 | +-   **order**: storage layout. | 
|  | 50 | +-   **uplo**: specifies whether `A` is an upper or lower triangular matrix. | 
|  | 51 | +-   **trans**: specifies whether `A` should be transposed, conjugate-transposed, or not transposed. | 
|  | 52 | +-   **diag**: specifies whether `A` has a unit diagonal. | 
|  | 53 | +-   **N**: number of elements along each dimension of `A`. | 
|  | 54 | +-   **A**: input matrix stored in linear memory as a [`Float64Array`][mdn-float64array]. | 
|  | 55 | +-   **lda**: stride of the first dimension of `A` (a.k.a., leading dimension of the matrix `A`). | 
|  | 56 | +-   **x**: input vector [`Float64Array`][mdn-float64array]. | 
|  | 57 | +-   **sx**: `x` stride length. | 
|  | 58 | + | 
|  | 59 | +The stride parameters determine how elements in the input arrays are accessed at runtime. For example, to iterate over the elements of `x` in reverse order, | 
|  | 60 | + | 
|  | 61 | +```javascript | 
|  | 62 | +var Float64Array = require( '@stdlib/array/float64' ); | 
|  | 63 | + | 
|  | 64 | +var A = new Float64Array( [ 1.0, 2.0, 3.0, 0.0, 1.0, 2.0, 0.0, 0.0, 1.0 ] ); | 
|  | 65 | +var x = new Float64Array( [ 3.0, 2.0, 1.0 ] ); | 
|  | 66 | + | 
|  | 67 | +dtrsv( 'row-major', 'upper', 'no-transpose', 'unit', 3, A, 3, x, -1 ); | 
|  | 68 | +// x => <Float64Array>[ 3.0, -4.0, 0.0 ] | 
|  | 69 | +``` | 
|  | 70 | + | 
|  | 71 | +Note that indexing is relative to the first index. To introduce an offset, use [`typed array`][mdn-typed-array] views. | 
|  | 72 | + | 
|  | 73 | +<!-- eslint-disable stdlib/capitalized-comments --> | 
|  | 74 | + | 
|  | 75 | +```javascript | 
|  | 76 | +var Float64Array = require( '@stdlib/array/float64' ); | 
|  | 77 | + | 
|  | 78 | +// Initial arrays... | 
|  | 79 | +var x0 = new Float64Array( [ 1.0, 1.0, 1.0, 1.0 ] ); | 
|  | 80 | +var A = new Float64Array( [ 1.0, 2.0, 3.0, 0.0, 1.0, 2.0, 0.0, 0.0, 1.0 ] ); | 
|  | 81 | + | 
|  | 82 | +// Create offset views... | 
|  | 83 | +var x1 = new Float64Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); // start at 2nd element | 
|  | 84 | + | 
|  | 85 | +dtrsv( 'row-major', 'upper', 'no-transpose', 'unit', 3, A, 3, x1, 1 ); | 
|  | 86 | +// x0 => <Float64Array>[ 1.0, 0.0, -1.0, 1.0 ] | 
|  | 87 | +``` | 
|  | 88 | + | 
|  | 89 | +#### dtrsv.ndarray( uplo, trans, diag, N, A, sa1, sa2, oa, x, sx, ox ) | 
|  | 90 | + | 
|  | 91 | +Solves one of the systems of equations `A*x = b` or `A^T*x = b`, using alternative indexing semantics and where `b` and `x` are `N` element vectors and `A` is an `N` by `N` unit, or non-unit, upper or lower triangular matrix. | 
|  | 92 | + | 
|  | 93 | +```javascript | 
|  | 94 | +var Float64Array = require( '@stdlib/array/float64' ); | 
|  | 95 | + | 
|  | 96 | +var A = new Float64Array( [ 1.0, 2.0, 3.0, 0.0, 1.0, 2.0, 0.0, 0.0, 1.0 ] ); | 
|  | 97 | +var x = new Float64Array( [ 1.0, 2.0, 3.0 ] ); | 
|  | 98 | + | 
|  | 99 | +dtrsv.ndarray( 'upper', 'no-transpose', 'unit', 3, A, 3, 1, 0, x, 1, 0 ); | 
|  | 100 | +// x => <Float64Array>[ 0.0, -4.0, 3.0 ] | 
|  | 101 | +``` | 
|  | 102 | + | 
|  | 103 | +The function has the following additional parameters: | 
|  | 104 | + | 
|  | 105 | +-   **sa1**: stride of the first dimension of `A`. | 
|  | 106 | +-   **sa2**: stride of the second dimension of `A`. | 
|  | 107 | +-   **oa**: starting index for `A`. | 
|  | 108 | +-   **ox**: starting index for `x`. | 
|  | 109 | + | 
|  | 110 | +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, | 
|  | 111 | + | 
|  | 112 | +```javascript | 
|  | 113 | +var Float64Array = require( '@stdlib/array/float64' ); | 
|  | 114 | + | 
|  | 115 | +var A = new Float64Array( [ 1.0, 2.0, 3.0, 0.0, 1.0, 2.0, 0.0, 0.0, 1.0 ] ); | 
|  | 116 | +var x = new Float64Array( [ 3.0, 2.0, 1.0 ] ); | 
|  | 117 | + | 
|  | 118 | +dtrsv.ndarray( 'upper', 'no-transpose', 'unit', 3, A, 3, 1, 0, x, -1, 2 ); | 
|  | 119 | +// x => <Float64Array>[ 3.0, -4.0, 0.0 ] | 
|  | 120 | +``` | 
|  | 121 | + | 
|  | 122 | +</section> | 
|  | 123 | + | 
|  | 124 | +<!-- /.usage --> | 
|  | 125 | + | 
|  | 126 | +<section class="notes"> | 
|  | 127 | + | 
|  | 128 | +## Notes | 
|  | 129 | + | 
|  | 130 | +-   `dtrsv()` corresponds to the [BLAS][blas] level 2 function [`dtrsv`][blas-dtrsv]. | 
|  | 131 | +-   Neither routine tests for singularity or near-singularity. Such tests must be performed before calling the routines. | 
|  | 132 | + | 
|  | 133 | +</section> | 
|  | 134 | + | 
|  | 135 | +<!-- /.notes --> | 
|  | 136 | + | 
|  | 137 | +<section class="examples"> | 
|  | 138 | + | 
|  | 139 | +## Examples | 
|  | 140 | + | 
|  | 141 | +<!-- eslint no-undef: "error" --> | 
|  | 142 | + | 
|  | 143 | +```javascript | 
|  | 144 | +var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); | 
|  | 145 | +var dtrsv = require( '@stdlib/blas/base/dtrsv' ); | 
|  | 146 | + | 
|  | 147 | +var opts = { | 
|  | 148 | +    'dtype': 'float64' | 
|  | 149 | +}; | 
|  | 150 | + | 
|  | 151 | +var N = 5; | 
|  | 152 | + | 
|  | 153 | +var A = discreteUniform( N*N, -10.0, 10.0, opts ); | 
|  | 154 | +var x = discreteUniform( N, -10.0, 10.0, opts ); | 
|  | 155 | + | 
|  | 156 | +dtrsv( 'column-major', 'upper', 'no-transpose', 'unit', N, A, N, x, 1 ); | 
|  | 157 | +console.log( x ); | 
|  | 158 | + | 
|  | 159 | +dtrsv.ndarray( 'upper', 'no-transpose', 'unit', N, A, 1, N, 0, x, 1, 0 ); | 
|  | 160 | +console.log( x ); | 
|  | 161 | +``` | 
|  | 162 | + | 
|  | 163 | +</section> | 
|  | 164 | + | 
|  | 165 | +<!-- /.examples --> | 
|  | 166 | + | 
|  | 167 | +<!-- C interface documentation. --> | 
|  | 168 | + | 
|  | 169 | +* * * | 
|  | 170 | + | 
|  | 171 | +<section class="c"> | 
|  | 172 | + | 
|  | 173 | +## C APIs | 
|  | 174 | + | 
|  | 175 | +<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. --> | 
|  | 176 | + | 
|  | 177 | +<section class="intro"> | 
|  | 178 | + | 
|  | 179 | +</section> | 
|  | 180 | + | 
|  | 181 | +<!-- /.intro --> | 
|  | 182 | + | 
|  | 183 | +<!-- C usage documentation. --> | 
|  | 184 | + | 
|  | 185 | +<section class="usage"> | 
|  | 186 | + | 
|  | 187 | +### Usage | 
|  | 188 | + | 
|  | 189 | +```c | 
|  | 190 | +TODO | 
|  | 191 | +``` | 
|  | 192 | + | 
|  | 193 | +#### TODO | 
|  | 194 | + | 
|  | 195 | +TODO. | 
|  | 196 | + | 
|  | 197 | +```c | 
|  | 198 | +TODO | 
|  | 199 | +``` | 
|  | 200 | + | 
|  | 201 | +TODO | 
|  | 202 | + | 
|  | 203 | +```c | 
|  | 204 | +TODO | 
|  | 205 | +``` | 
|  | 206 | + | 
|  | 207 | +</section> | 
|  | 208 | + | 
|  | 209 | +<!-- /.usage --> | 
|  | 210 | + | 
|  | 211 | +<!-- C API usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> | 
|  | 212 | + | 
|  | 213 | +<section class="notes"> | 
|  | 214 | + | 
|  | 215 | +</section> | 
|  | 216 | + | 
|  | 217 | +<!-- /.notes --> | 
|  | 218 | + | 
|  | 219 | +<!-- C API usage examples. --> | 
|  | 220 | + | 
|  | 221 | +<section class="examples"> | 
|  | 222 | + | 
|  | 223 | +### Examples | 
|  | 224 | + | 
|  | 225 | +```c | 
|  | 226 | +TODO | 
|  | 227 | +``` | 
|  | 228 | + | 
|  | 229 | +</section> | 
|  | 230 | + | 
|  | 231 | +<!-- /.examples --> | 
|  | 232 | + | 
|  | 233 | +</section> | 
|  | 234 | + | 
|  | 235 | +<!-- /.c --> | 
|  | 236 | + | 
|  | 237 | +<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. --> | 
|  | 238 | + | 
|  | 239 | +<section class="related"> | 
|  | 240 | + | 
|  | 241 | +</section> | 
|  | 242 | + | 
|  | 243 | +<!-- /.related --> | 
|  | 244 | + | 
|  | 245 | +<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> | 
|  | 246 | + | 
|  | 247 | +<section class="links"> | 
|  | 248 | + | 
|  | 249 | +[blas]: http://www.netlib.org/blas | 
|  | 250 | + | 
|  | 251 | +[blas-dtrsv]: https://www.netlib.org/lapack/explore-html/dd/dc3/group__trsv_ga7a7dcbb8745b4776ce13063ab031141f.html#ga7a7dcbb8745b4776ce13063ab031141f | 
|  | 252 | + | 
|  | 253 | +[mdn-float64array]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Float64Array | 
|  | 254 | + | 
|  | 255 | +[mdn-typed-array]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray | 
|  | 256 | + | 
|  | 257 | +</section> | 
|  | 258 | + | 
|  | 259 | +<!-- /.links --> | 
0 commit comments