Skip to content

Commit 8f17b92

Browse files
committed
docs: adds readme file
--- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: passed - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: passed - task: lint_typescript_tests status: na - task: lint_license_headers status: passed ---
1 parent cfea9c5 commit 8f17b92

1 file changed

Lines changed: 269 additions & 0 deletions

File tree

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

0 commit comments

Comments
 (0)