@@ -30,33 +30,33 @@ limitations under the License.
30
30
var scasum = require ( ' @stdlib/blas/base/scasum' );
31
31
```
32
32
33
- #### scasum( N, cx , strideX )
33
+ #### scasum( N, x , strideX )
34
34
35
35
Computes the sum of the absolute values of the real and imaginary components of a single-precision complex floating-point vector.
36
36
37
37
``` javascript
38
38
var Complex64Array = require ( ' @stdlib/array/complex64' );
39
39
40
- var cx = new Complex64Array ( [ 0.3 , 0.1 , 0.5 , 0.0 , 0.0 , 0.5 , 0.0 , 0.2 ] );
40
+ var x = new Complex64Array ( [ 0.3 , 0.1 , 0.5 , 0.0 , 0.0 , 0.5 , 0.0 , 0.2 ] );
41
41
42
- var out = scasum ( 4 , cx , 1 );
42
+ var out = scasum ( 4 , x , 1 );
43
43
// returns ~1.6
44
44
```
45
45
46
46
The function has the following parameters:
47
47
48
48
- ** N** : number of indexed elements.
49
- - ** cx ** : input [ ` Complex64Array ` ] [ @stdlib/array/complex64 ] .
50
- - ** strideX** : index increment for ` cx ` .
49
+ - ** x ** : input [ ` Complex64Array ` ] [ @stdlib/array/complex64 ] .
50
+ - ** strideX** : index increment for ` x ` .
51
51
52
52
The ` N ` and stride parameters determine which elements in the strided array are accessed at runtime. For example, to traverse every other value,
53
53
54
54
``` javascript
55
55
var Complex64Array = require ( ' @stdlib/array/complex64' );
56
56
57
- var cx = new Complex64Array ( [ - 2.0 , 1.0 , 3.0 , - 5.0 , 4.0 , 0.0 , - 1.0 , - 3.0 ] );
57
+ var x = new Complex64Array ( [ - 2.0 , 1.0 , 3.0 , - 5.0 , 4.0 , 0.0 , - 1.0 , - 3.0 ] );
58
58
59
- var out = scasum ( 2 , cx , 2 );
59
+ var out = scasum ( 2 , x , 2 );
60
60
// returns 7.0
61
61
```
62
62
@@ -66,26 +66,26 @@ Note that indexing is relative to the first index. To introduce an offset, use [
66
66
var Complex64Array = require ( ' @stdlib/array/complex64' );
67
67
68
68
// Initial array:
69
- var cx0 = new Complex64Array ( [ 1.0 , - 2.0 , 3.0 , - 4.0 , 5.0 , - 6.0 ] );
69
+ var x0 = new Complex64Array ( [ 1.0 , - 2.0 , 3.0 , - 4.0 , 5.0 , - 6.0 ] );
70
70
71
71
// Create an offset view:
72
- var cx1 = new Complex64Array ( cx0 .buffer , cx0 .BYTES_PER_ELEMENT * 1 ); // start at 2nd element
72
+ var x1 = new Complex64Array ( x0 .buffer , x0 .BYTES_PER_ELEMENT * 1 ); // start at 2nd element
73
73
74
74
// Compute the L2-out:
75
- var out = scasum ( 2 , cx1 , 1 );
75
+ var out = scasum ( 2 , x1 , 1 );
76
76
// returns 18.0
77
77
```
78
78
79
- #### scasum.ndarray( N, cx , strideX, offset )
79
+ #### scasum.ndarray( N, x , strideX, offset )
80
80
81
81
Computes the sum of the absolute values of the real and imaginary components of a single-precision complex floating-point vector using alternative indexing semantics.
82
82
83
83
``` javascript
84
84
var Complex64Array = require ( ' @stdlib/array/complex64' );
85
85
86
- var cx = new Complex64Array ( [ 0.3 , 0.1 , 0.5 , 0.0 , 0.0 , 0.5 , 0.0 , 0.2 ] );
86
+ var x = new Complex64Array ( [ 0.3 , 0.1 , 0.5 , 0.0 , 0.0 , 0.5 , 0.0 , 0.2 ] );
87
87
88
- var out = scasum .ndarray ( 4 , cx , 1 , 0 );
88
+ var out = scasum .ndarray ( 4 , x , 1 , 0 );
89
89
// returns ~1.6
90
90
```
91
91
@@ -98,9 +98,9 @@ While [`typed array`][mdn-typed-array] views mandate a view offset based on the
98
98
``` javascript
99
99
var Complex64Array = require ( ' @stdlib/array/complex64' );
100
100
101
- var cx = new Complex64Array ( [ 1.0 , - 2.0 , 3.0 , - 4.0 , 5.0 , - 6.0 ] );
101
+ var x = new Complex64Array ( [ 1.0 , - 2.0 , 3.0 , - 4.0 , 5.0 , - 6.0 ] );
102
102
103
- var out = scasum .ndarray ( 2 , cx , 1 , 1 );
103
+ var out = scasum .ndarray ( 2 , x , 1 , 1 );
104
104
// returns 18.0
105
105
```
106
106
@@ -135,11 +135,11 @@ function rand() {
135
135
return new Complex64 ( discreteUniform ( 0 , 10 ), discreteUniform ( - 5 , 5 ) );
136
136
}
137
137
138
- var cx = filledarrayBy ( 10 , ' complex64' , rand );
139
- console .log ( cx .toString () );
138
+ var x = filledarrayBy ( 10 , ' complex64' , rand );
139
+ console .log ( x .toString () );
140
140
141
141
// Compute the sum of the absolute values of real and imaginary components:
142
- var out = scasum ( cx .length , cx , 1 );
142
+ var out = scasum ( x .length , x , 1 );
143
143
console .log ( out );
144
144
```
145
145
@@ -173,47 +173,47 @@ console.log( out );
173
173
#include " stdlib/blas/base/scasum.h"
174
174
```
175
175
176
- #### c_scasum( N, \* CX , strideX )
176
+ #### c_scasum( N, \* X , strideX )
177
177
178
178
Computes the sum of the absolute values of the real and imaginary components of a single-precision complex floating-point vector.
179
179
180
180
``` c
181
- const float cx [] = { 0.3f, 0.1f, 0.5f, 0.0f, 0.0f, 0.5f, 0.0f, 0.2f };
181
+ const float X [] = { 0.3f, 0.1f, 0.5f, 0.0f, 0.0f, 0.5f, 0.0f, 0.2f };
182
182
183
- float out = c_scasum( 4, (void * )cx , 1 );
183
+ float out = c_scasum( 4, (void * )X , 1 );
184
184
// returns 1.6f
185
185
```
186
186
187
187
The function accepts the following arguments:
188
188
189
189
- **N**: `[in] CBLAS_INT` number of indexed elements.
190
- - **CX **: `[in] void*` input array.
191
- - **strideX**: `[in] CBLAS_INT` index increment for `CX `.
190
+ - **X **: `[in] void*` input array.
191
+ - **strideX**: `[in] CBLAS_INT` index increment for `X `.
192
192
193
193
```c
194
- float c_scasum( const CBLAS_INT N, const void *CX , const CBLAS_INT strideX );
194
+ float c_scasum( const CBLAS_INT N, const void *X , const CBLAS_INT strideX );
195
195
```
196
196
197
- #### c_scasum_ndarray( N, \* CX , strideX, offsetX )
197
+ #### c_scasum_ndarray( N, \* X , strideX, offsetX )
198
198
199
199
Computes the sum of the absolute values of the real and imaginary components of a single-precision complex floating-point vector using alternative indexing semantics.
200
200
201
201
``` c
202
- const float cx [] = { 0.3f, 0.1f, 0.5f, 0.0f, 0.0f, 0.5f, 0.0f, 0.2f };
202
+ const float X [] = { 0.3f, 0.1f, 0.5f, 0.0f, 0.0f, 0.5f, 0.0f, 0.2f };
203
203
204
- float out = c_scasum_ndarray( 4, (void * )cx , 1, 0 );
204
+ float out = c_scasum_ndarray( 4, (void * )X , 1, 0 );
205
205
// returns 1.6f
206
206
```
207
207
208
208
The function accepts the following arguments:
209
209
210
210
- **N**: `[in] CBLAS_INT` number of indexed elements.
211
- - **CX **: `[in] void*` input array.
212
- - **strideX**: `[in] CBLAS_INT` index increment for `CX `.
213
- - **offsetX**: `[in] CBLAS_INT` starting index for `CX `.
211
+ - **X **: `[in] void*` input array.
212
+ - **strideX**: `[in] CBLAS_INT` index increment for `X `.
213
+ - **offsetX**: `[in] CBLAS_INT` starting index for `X `.
214
214
215
215
```c
216
- float c_scasum_ndarray( const CBLAS_INT N, const void *CX , const CBLAS_INT strideX, const CBLAS_INT offsetX );
216
+ float c_scasum_ndarray( const CBLAS_INT N, const void *X , const CBLAS_INT strideX, const CBLAS_INT offsetX );
217
217
```
218
218
219
219
</section >
@@ -240,7 +240,7 @@ float c_scasum_ndarray( const CBLAS_INT N, const void *CX, const CBLAS_INT strid
240
240
241
241
int main ( void ) {
242
242
// Create a strided array of interleaved real and imaginary components:
243
- const float cx [ ] = { 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f };
243
+ const float X [ ] = { 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f };
244
244
245
245
// Specify the number of elements:
246
246
const int N = 4;
@@ -249,13 +249,13 @@ int main( void ) {
249
249
const int strideX = 1;
250
250
251
251
// Compute the sum of the absolute values of real and imaginary components:
252
- float out = c_scasum( N, (void *)cx , strideX );
252
+ float out = c_scasum( N, (void *)X , strideX );
253
253
254
254
// Print the result:
255
255
printf( "out: %f\n", out );
256
256
257
257
// Compute the sum of the absolute values of real and imaginary components using alternative indexing semantics:
258
- out = c_scasum_ndarray( N, (void *)cx , -strideX, N-1 );
258
+ out = c_scasum_ndarray( N, (void *)X , -strideX, N-1 );
259
259
260
260
// Print the result:
261
261
printf( "out: %f\n", out );
0 commit comments