Skip to content

Commit 6099206

Browse files
committed
chore: update markdown 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: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed ---
1 parent 2590157 commit 6099206

File tree

1 file changed

+117
-117
lines changed
  • lib/node_modules/@stdlib/blas/base/zaxpy

1 file changed

+117
-117
lines changed

lib/node_modules/@stdlib/blas/base/zaxpy/README.md

Lines changed: 117 additions & 117 deletions
Original file line numberDiff line numberDiff line change
@@ -30,63 +30,43 @@ limitations under the License.
3030
var zaxpy = require( '@stdlib/blas/base/zaxpy' );
3131
```
3232

33-
#### zaxpy( N, za, zx, strideX, zy, strideY )
33+
#### zaxpy( N, alpha, x, strideX, y, strideY )
3434

35-
Scales values from `zx` by `za` and adds the result to `zy`.
35+
Scales values from `x` by `alpha` and adds the result to `y`.
3636

3737
```javascript
3838
var Complex128Array = require( '@stdlib/array/complex128' );
3939
var Complex128 = require( '@stdlib/complex/float64/ctor' );
40-
var real = require( '@stdlib/complex/float64/real' );
41-
var imag = require( '@stdlib/complex/float64/imag' );
42-
43-
var zx = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] );
44-
var zy = new Complex128Array( [ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 ] );
45-
var za = new Complex128( 2.0, 2.0 );
4640

47-
zaxpy( 3, za, zx, 1, zy, 1 );
41+
var x = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] );
42+
var y = new Complex128Array( [ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 ] );
43+
var alpha = new Complex128( 2.0, 2.0 );
4844

49-
var z = zy.get( 0 );
50-
// returns <Complex128>
51-
52-
var re = real( z );
53-
// returns -1.0
54-
55-
var im = imag( z );
56-
// returns 7.0
45+
zaxpy( 3, alpha, x, 1, y, 1 );
46+
// y => <Complex128Array>[ -1.0, 7.0, -1.0, 15.0, -1.0, 23.0 ]
5747
```
5848

5949
The function has the following parameters:
6050

6151
- **N**: number of indexed elements.
62-
- **za**: scalar [`Complex128`][@stdlib/complex/float64/ctor] constant.
63-
- **zx**: first input [`Complex128Array`][@stdlib/array/complex128].
64-
- **strideX**: index increment for `zx`.
65-
- **zy**: second input [`Complex128Array`][@stdlib/array/complex128].
66-
- **strideY**: index increment for `zy`.
52+
- **alpha**: scalar [`Complex128`][@stdlib/complex/float64/ctor] constant.
53+
- **x**: first input [`Complex128Array`][@stdlib/array/complex128].
54+
- **strideX**: stride length for `x`.
55+
- **y**: second input [`Complex128Array`][@stdlib/array/complex128].
56+
- **strideY**: stride length for `y`.
6757

68-
The `N` and stride parameters determine how values from `zx` are scaled by `za` and added to `zy`. For example, to scale every other value in `zx` by `za` and add the result to every other value of `zy`,
58+
The `N` and stride parameters determine how values from `x` are scaled by `alpha` and added to `y`. For example, to scale every other value in `x` by `alpha` and add the result to every other value of `y`,
6959

7060
```javascript
7161
var Complex128Array = require( '@stdlib/array/complex128' );
7262
var Complex128 = require( '@stdlib/complex/float64/ctor' );
73-
var real = require( '@stdlib/complex/float64/real' );
74-
var imag = require( '@stdlib/complex/float64/imag' );
75-
76-
var zx = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] );
77-
var zy = new Complex128Array( [ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 ] );
78-
var za = new Complex128( 2.0, 2.0 );
79-
80-
zaxpy( 2, za, zx, 2, zy, 2 );
8163

82-
var z = zy.get( 0 );
83-
// returns <Complex128>
64+
var x = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] );
65+
var y = new Complex128Array( [ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 ] );
66+
var alpha = new Complex128( 2.0, 2.0 );
8467

85-
var re = real( z );
86-
// returns -1.0
87-
88-
var im = imag( z );
89-
// returns 7.0
68+
zaxpy( 2, alpha, x, 2, y, 2 );
69+
// y => <Complex128Array>[ -1.0, 7.0, 1.0, 1.0, -1.0, 23.0, 1.0, 1.0 ]
9070
```
9171

9272
Note that indexing is relative to the first index. To introduce an offset, use [`typed array`][mdn-typed-array] views.
@@ -100,82 +80,56 @@ var real = require( '@stdlib/complex/float64/real' );
10080
var imag = require( '@stdlib/complex/float64/imag' );
10181

10282
// Initial arrays...
103-
var zx0 = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] );
104-
var zy0 = new Complex128Array( [ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 ] );
83+
var x0 = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] );
84+
var y0 = new Complex128Array( [ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 ] );
10585

10686
// Define a scalar constant:
107-
var za = new Complex128( 2.0, 2.0 );
87+
var alpha = new Complex128( 2.0, 2.0 );
10888

10989
// Create offset views...
110-
var zx1 = new Complex128Array( zx0.buffer, zx0.BYTES_PER_ELEMENT*1 ); // start at 2nd element
111-
var zy1 = new Complex128Array( zy0.buffer, zy0.BYTES_PER_ELEMENT*2 ); // start at 3rd element
112-
113-
// Scales values of `zx0` by `za` starting from second index and add the result to `zy0` starting from third index...
114-
zaxpy( 2, za, zx1, 1, zy1, 1 );
90+
var x1 = new Complex128Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); // start at 2nd element
91+
var y1 = new Complex128Array( y0.buffer, y0.BYTES_PER_ELEMENT*2 ); // start at 3rd element
11592

116-
var z = zy0.get( 2 );
117-
// returns <Complex128>
118-
119-
var re = real( z );
120-
// returns -1.0
121-
122-
var im = imag( z );
123-
// returns 15.0
93+
// Scales values of `x0` by `alpha` starting from second index and add the result to `y0` starting from third index...
94+
zaxpy( 2, alpha, x1, 1, y1, 1 );
95+
// y0 => <Complex128Array>[ 1.0, 1.0, 1.0, 1.0, -1.0, 15.0, -1.0, 23.0 ]
12496
```
12597

126-
#### zaxpy.ndarray( N, za, zx, strideX, offsetX, zy, strideY, offsetY )
98+
#### zaxpy.ndarray( N, alpha, x, strideX, offsetX, y, strideY, offsetY )
12799

128-
Scales values from `zx` by `za` and adds the result to `zy` using alternative indexing semantics.
100+
Scales values from `x` by `alpha` and adds the result to `y` using alternative indexing semantics.
129101

130102
```javascript
131103
var Complex128Array = require( '@stdlib/array/complex128' );
132104
var Complex128 = require( '@stdlib/complex/float64/ctor' );
133105
var real = require( '@stdlib/complex/float64/real' );
134106
var imag = require( '@stdlib/complex/float64/imag' );
135107

136-
var zx = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] );
137-
var zy = new Complex128Array( [ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 ] );
138-
var za = new Complex128( 2.0, 2.0 );
139-
140-
zaxpy.ndarray( 3, za, zx, 1, 0, zy, 1, 0 );
108+
var x = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] );
109+
var y = new Complex128Array( [ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 ] );
110+
var alpha = new Complex128( 2.0, 2.0 );
141111

142-
var z = zy.get( 0 );
143-
// returns <Complex128>
144-
145-
var re = real( z );
146-
// returns -1.0
147-
148-
var im = imag( z );
149-
// returns 7.0
112+
zaxpy.ndarray( 3, alpha, x, 1, 0, y, 1, 0 );
113+
// y => <Complex128Array>[ -1.0, 7.0, -1.0, 15.0, -1.0, 23.0 ]
150114
```
151115

152116
The function has the following additional parameters:
153117

154-
- **offsetX**: starting index for `zx`.
155-
- **offsetY**: starting index for `zy`.
118+
- **offsetX**: starting index for `x`.
119+
- **offsetY**: starting index for `y`.
156120

157121
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, to scale values in the first input strided array starting from the second element and add the result to the second input array starting from the second element,
158122

159123
```javascript
160124
var Complex128Array = require( '@stdlib/array/complex128' );
161125
var Complex128 = require( '@stdlib/complex/float64/ctor' );
162-
var real = require( '@stdlib/complex/float64/real' );
163-
var imag = require( '@stdlib/complex/float64/imag' );
164-
165-
var zx = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] );
166-
var zy = new Complex128Array( [ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 ] );
167-
var za = new Complex128( 2.0, 2.0 );
168-
169-
zaxpy.ndarray( 3, za, zx, 1, 1, zy, 1, 1 );
170126

171-
var z = zy.get( 3 );
172-
// returns <Complex128>
127+
var x = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] );
128+
var y = new Complex128Array( [ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 ] );
129+
var alpha = new Complex128( 2.0, 2.0 );
173130

174-
var re = real( z );
175-
// returns -1.0
176-
177-
var im = imag( z );
178-
// returns 31.0
131+
zaxpy.ndarray( 3, alpha, x, 1, 1, y, 1, 1 );
132+
// y => <Complex128Array>[ 1.0, 1.0, -1.0, 15.0, -1.0, 23.0, -1.0, 31.0 ]
179133
```
180134

181135
</section>
@@ -186,7 +140,8 @@ var im = imag( z );
186140

187141
## Notes
188142

189-
- If `N <= 0`, both functions return `zy` unchanged.
143+
- If `N <= 0`, both functions return `y` unchanged.
144+
- If `alpha === 0`, both functions return `y` unchanged.
190145
- `zaxpy()` corresponds to the [BLAS][blas] level 1 function [`zaxpy`][zaxpy].
191146

192147
</section>
@@ -212,17 +167,25 @@ function rand() {
212167
return new Complex128( discreteUniform( 0, 10 ), discreteUniform( -5, 5 ) );
213168
}
214169

215-
var zx = filledarrayBy( 10, 'complex128', rand );
216-
var zy = filledarrayBy( 10, 'complex128', rand );
217-
var zyc = zcopy( zy.length, zy, 1, zeros( zy.length, 'complex128' ), 1 );
170+
var x = filledarrayBy( 10, 'complex128', rand );
171+
var y = filledarrayBy( 10, 'complex128', rand );
172+
var yc = zcopy( y.length, y, 1, zeros( y.length, 'complex128' ), 1 );
173+
174+
var alpha = new Complex128( 2.0, 2.0 );
218175

219-
var za = new Complex128( 2.0, 2.0 );
176+
// Scale values from `x` by `alpha` and add the result to `y`:
177+
zaxpy( x.length, alpha, x, 1, y, 1 );
220178

221-
// Scale values from `zx` by `za` and add the result to `zy`:
222-
zaxpy( zx.length, za, zx, 1, zy, 1 );
179+
// Print the results:
180+
logEach( '(%s)*(%s) + (%s) = %s', alpha, x, yc, y );
181+
182+
yc = zcopy( y.length, y, 1, zeros( y.length, 'complex128' ), 1 );
183+
184+
// Scale values from `x` by `alpha` and add the result to `y` using alternative indexing semantics:
185+
zaxpy.ndarray( x.length, alpha, x, 1, 0, y, 1, 0 );
223186

224187
// Print the results:
225-
logEach( '(%s)*(%s) + (%s) = %s', za, zx, zyc, zy );
188+
logEach( '(%s)*(%s) + (%s) = %s', alpha, x, yc, y );
226189
```
227190

228191
</section>
@@ -252,34 +215,63 @@ logEach( '(%s)*(%s) + (%s) = %s', za, zx, zyc, zy );
252215
### Usage
253216

254217
```c
255-
#include "stdlib/blas/base/zaxpy.h"
218+
#include "stdlib/blas/base/caxpy.h"
219+
```
220+
221+
#### c_caxpy( N, alpha, \*X, strideX, \*Y, strideY )
222+
223+
Scales values from `X` by `alpha` and adds the result to `Y`.
224+
225+
```c
226+
#include "stdlib/complex/float32/ctor.h"
227+
228+
float x[] = { 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 };
229+
float y[] = { -1.0, -2.0, -3.0, -4.0, -5.0, -6.0, -7.0, -8.0 };
230+
const stdlib_complex128_t alpha = stdlib_complex128( 2.0, 2.0 );
231+
232+
c_caxpy( 4, alpha, (void *)x, 1, (void *)y, 1 );
233+
```
234+
235+
The function accepts the following arguments:
236+
237+
- **N**: `[in] CBLAS_INT` number of indexed elements.
238+
- **alpha**: `[in] stdlib_complex128_t` scalar constant.
239+
- **X**: `[in] void*` input array.
240+
- **strideX**: `[in] CBLAS_INT` stride length for `X`.
241+
- **Y**: `[inout] void*` output array.
242+
- **strideY**: `[in] CBLAS_INT` stride length for `Y`.
243+
244+
```c
245+
void c_caxpy( const CBLAS_INT N, const stdlib_complex128_t alpha, const void *x, const CBLAS_INT strideX, void *y, const CBLAS_INT strideY );
256246
```
257247

258-
#### c_zaxpy( N, za, \*ZX, strideX, \*ZY, strideY )
248+
#### c_caxpy_ndarray( N, alpha, \*X, strideX, offsetX, \*Y, strideY, offsetY )
259249

260-
Scales values from `ZX` by `za` and adds the result to `ZY`.
250+
Scales values from `X` by `alpha` and adds the result to `Y` using alternative indexing semantics.
261251

262252
```c
263-
#include "stdlib/complex/float64/ctor.h"
253+
#include "stdlib/complex/float32/ctor.h"
264254

265-
double zx[] = { 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 };
266-
double zy[] = { 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 };
267-
const stdlib_complex128_t za = stdlib_complex128( 2.0, 2.0 );
255+
float x[] = { 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 };
256+
float y[] = { -1.0, -2.0, -3.0, -4.0, -5.0, -6.0, -7.0, -8.0 };
257+
const stdlib_complex128_t alpha = stdlib_complex128( 2.0, 2.0 );
268258

269-
c_zaxpy( 3, za, (void *)zx, 1, (void *)zy, 1 );
259+
c_caxpy_ndarray( 4, alpha, (void *)x, 1, 0, (void *)y, 1, 0 );
270260
```
271261
272262
The function accepts the following arguments:
273263
274264
- **N**: `[in] CBLAS_INT` number of indexed elements.
275-
- **za**: `[in] stdlib_complex128_t` scalar constant.
276-
- **ZX**: `[in] void*` first input array.
277-
- **strideX**: `[in] CBLAS_INT` index increment for `ZX`.
278-
- **ZY**: `[inout] void*` second input array.
279-
- **strideY**: `[in] CBLAS_INT` index increment for `ZY`.
265+
- **alpha**: `[in] stdlib_complex128_t` scalar constant.
266+
- **X**: `[in] void*` input array.
267+
- **strideX**: `[in] CBLAS_INT` stride length for `X`.
268+
- **offsetX**: `[in] CBLAS_INT` starting index for `X`.
269+
- **Y**: `[inout] void*` output array.
270+
- **strideY**: `[in] CBLAS_INT` stride length for `Y`.
271+
- **offsetY**: `[in] CBLAS_INT` starting index for `Y`.
280272
281273
```c
282-
void c_zaxpy( const CBLAS_INT N, const stdlib_complex128_t za, void *ZX, const CBLAS_INT strideX, void *ZY, const CBLAS_INT strideY );
274+
void c_caxpy_ndarray( const CBLAS_INT N, const stdlib_complex128_t alpha, const void *x, const CBLAS_INT strideX, const CBLAS_INT offsetX, void *y, const CBLAS_INT strideY, const CBLAS_INT offsetY );
283275
```
284276

285277
</section>
@@ -301,17 +293,17 @@ void c_zaxpy( const CBLAS_INT N, const stdlib_complex128_t za, void *ZX, const C
301293
### Examples
302294

303295
```c
304-
#include "stdlib/blas/base/zaxpy.h"
305-
#include "stdlib/complex/float64/ctor.h"
296+
#include "stdlib/blas/base/caxpy.h"
297+
#include "stdlib/complex/float32/ctor.h"
306298
#include <stdio.h>
307299

308300
int main( void ) {
309301
// Create strided arrays:
310-
double zx[] = { 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 };
311-
double zy[] = { 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 };
302+
double x[] = { 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 };
303+
double y[] = { 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0 };
312304

313305
// Create a complex scalar:
314-
const stdlib_complex128_t za = stdlib_complex128( 2.0, 2.0 );
306+
const stdlib_complex128_t alpha = stdlib_complex128( 2.0, 2.0 );
315307

316308
// Specify the number of elements:
317309
const int N = 4;
@@ -320,12 +312,20 @@ int main( void ) {
320312
const int strideX = 1;
321313
const int strideY = 1;
322314

323-
// Copy elements:
324-
c_zaxpy( N, za, (void *)zx, strideX, (void *)zy, strideY );
315+
// Scale values from `x` by `alpha` and add the result to `y`:
316+
c_zaxpy( N, alpha, (void *)x, strideX, (void *)y, strideY );
317+
318+
// Print the result:
319+
for ( int i = 0; i < N; i++ ) {
320+
printf( "zaxpy[ %i ] = %lf + %lfj\n", i, y[ i * 2 ], y[ ( i * 2 ) + 1 ] );
321+
}
322+
323+
// Scale values from `x` by `alpha` and add the result to `y` using alternative indexing semantics:
324+
c_zaxpy_ndarray( N, alpha, (void *)x, strideX, 0, (void *)y, strideY, 0 );
325325

326326
// Print the result:
327327
for ( int i = 0; i < N; i++ ) {
328-
printf( "zaxpy[ %i ] = %f + %fj\n", i, zy[ i*2 ], zy[ (i*2)+1 ] );
328+
printf( "zaxpy[ %i ] = %lf + %lfj\n", i, y[ i * 2 ], y[ ( i * 2 ) + 1 ] );
329329
}
330330
}
331331
```
@@ -352,7 +352,7 @@ int main( void ) {
352352
353353
[blas]: http://www.netlib.org/blas
354354
355-
[zaxpy]: https://www.netlib.org/lapack/explore-html/d5/d4b/group__axpy_ga0b7bac1f4d42514074a48f14f5f9caa0.html#ga0b7bac1f4d42514074a48f14f5f9caa0
355+
[zaxpy]: https://www.netlib.org/lapack/explore-html/d5/d4b/group__axpy_gaf603daa00d5c723d0e409d9b2d011bf4.html
356356
357357
[mdn-typed-array]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray
358358

0 commit comments

Comments
 (0)