@@ -30,33 +30,33 @@ limitations under the License.
30
30
var scnrm2 = require ( ' @stdlib/blas/base/scnrm2' );
31
31
```
32
32
33
- #### scnrm2( N, cx , strideX )
33
+ #### scnrm2( N, x , strideX )
34
34
35
35
Computes the L2-norm of a complex single-precision 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 norm = scnrm2 ( 4 , cx , 1 );
42
+ var norm = scnrm2 ( 4 , x , 1 );
43
43
// returns ~0.8
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 norm = scnrm2 ( 2 , cx , 2 );
59
+ var norm = scnrm2 ( 2 , x , 2 );
60
60
// returns ~4.6
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-norm:
75
- var norm = scnrm2 ( 2 , cx1 , 1 );
75
+ var norm = scnrm2 ( 2 , x1 , 1 );
76
76
// returns ~9.3
77
77
```
78
78
79
- #### scnrm2.ndarray( N, cx , strideX, offset )
79
+ #### scnrm2.ndarray( N, x , strideX, offset )
80
80
81
81
Computes the L2-norm of a complex single-precision 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 norm = scnrm2 .ndarray ( 4 , cx , 1 , 0 );
88
+ var norm = scnrm2 .ndarray ( 4 , x , 1 , 0 );
89
89
// returns ~0.8
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 norm = scnrm2 .ndarray ( 2 , cx , 1 , 1 );
103
+ var norm = scnrm2 .ndarray ( 2 , x , 1 , 1 );
104
104
// returns ~9.3
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 L2-norm:
142
- var norm = scnrm2 ( cx .length , cx , 1 );
142
+ var norm = scnrm2 ( x .length , x , 1 );
143
143
console .log ( norm );
144
144
```
145
145
@@ -173,46 +173,46 @@ console.log( norm );
173
173
#include " stdlib/blas/base/scnrm2.h"
174
174
```
175
175
176
- #### c_scnrm2( N, \* CX , strideX )
176
+ #### c_scnrm2( N, \* X , strideX )
177
177
178
178
Computes the L2-norm of a complex single-precision 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 norm = c_scnrm2( 4, (void * )cx , 1 );
183
+ float norm = c_scnrm2( 4, (void * )X , 1 );
184
184
// returns 0.8f
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_scnrm2( const CBLAS_INT N, const void *CX , const CBLAS_INT strideX );
194
+ float c_scnrm2( const CBLAS_INT N, const void *X , const CBLAS_INT strideX );
195
195
```
196
196
197
- #### c_scnrm2_ndarray( N, \* CX , strideX, offsetX )
197
+ #### c_scnrm2_ndarray( N, \* X , strideX, offsetX )
198
198
199
199
Computes the L2-norm of a complex single-precision 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 norm = c_scnrm2_ndarray( 4, (void * )cx , 1, 0 );
204
+ float norm = c_scnrm2_ndarray( 4, (void * )X , 1, 0 );
205
205
// returns 0.8f
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 `.
211
+ - **X **: `[in] void*` input array.
212
+ - **strideX**: `[in] CBLAS_INT` index increment for `X `.
213
213
214
214
```c
215
- float c_scnrm2_ndarray( const CBLAS_INT N, const void *CX , const CBLAS_INT strideX, const CBLAS_INT offsetX );
215
+ float c_scnrm2_ndarray( const CBLAS_INT N, const void *X , const CBLAS_INT strideX, const CBLAS_INT offsetX );
216
216
```
217
217
218
218
</section >
@@ -239,7 +239,7 @@ float c_scnrm2_ndarray( const CBLAS_INT N, const void *CX, const CBLAS_INT strid
239
239
240
240
int main ( void ) {
241
241
// Create a strided array of interleaved real and imaginary components:
242
- const float cx [ ] = { 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f };
242
+ const float X [ ] = { 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f };
243
243
244
244
// Specify the number of elements:
245
245
const int N = 4;
@@ -248,13 +248,13 @@ int main( void ) {
248
248
const int strideX = 1;
249
249
250
250
// Compute the L2-norm:
251
- float norm = c_scnrm2( N, (void *)cx , strideX );
251
+ float norm = c_scnrm2( N, (void *)X , strideX );
252
252
253
253
// Print the result:
254
254
printf( "L2-norm: %f\n", norm );
255
255
256
256
// Compute the L2-norm using alternative indexing semantics:
257
- norm = c_scnrm2_ndarray( N, (void *)cx , -strideX, N-1 );
257
+ norm = c_scnrm2_ndarray( N, (void *)X , -strideX, N-1 );
258
258
259
259
// Print the result:
260
260
printf( "L2-norm: %f\n", norm );
0 commit comments