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