@@ -30,33 +30,33 @@ limitations under the License.
30
30
var dznrm2 = require ( ' @stdlib/blas/base/dznrm2' );
31
31
```
32
32
33
- #### dznrm2( N, zx , strideX )
33
+ #### dznrm2( N, x , strideX )
34
34
35
35
Computes the L2-norm of a complex double-precision floating-point vector.
36
36
37
37
``` javascript
38
38
var Complex128Array = require ( ' @stdlib/array/complex128' );
39
39
40
- var zx = new Complex128Array ( [ 0.3 , 0.1 , 0.5 , 0.0 , 0.0 , 0.5 , 0.0 , 0.2 ] );
40
+ var x = new Complex128Array ( [ 0.3 , 0.1 , 0.5 , 0.0 , 0.0 , 0.5 , 0.0 , 0.2 ] );
41
41
42
- var norm = dznrm2 ( 4 , zx , 1 );
42
+ var norm = dznrm2 ( 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
- - ** zx ** : input [ ` Complex128Array ` ] [ @stdlib/array/complex128 ] .
50
- - ** strideX** : index increment for ` zx ` .
49
+ - ** x ** : input [ ` Complex128Array ` ] [ @stdlib/array/complex128 ] .
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 Complex128Array = require ( ' @stdlib/array/complex128' );
56
56
57
- var zx = new Complex128Array ( [ - 2.0 , 1.0 , 3.0 , - 5.0 , 4.0 , 0.0 , - 1.0 , - 3.0 ] );
57
+ var x = new Complex128Array ( [ - 2.0 , 1.0 , 3.0 , - 5.0 , 4.0 , 0.0 , - 1.0 , - 3.0 ] );
58
58
59
- var norm = dznrm2 ( 2 , zx , 2 );
59
+ var norm = dznrm2 ( 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 Complex128Array = require ( ' @stdlib/array/complex128' );
67
67
68
68
// Initial array:
69
- var zx0 = new Complex128Array ( [ 1.0 , - 2.0 , 3.0 , - 4.0 , 5.0 , - 6.0 ] );
69
+ var x0 = new Complex128Array ( [ 1.0 , - 2.0 , 3.0 , - 4.0 , 5.0 , - 6.0 ] );
70
70
71
71
// Create an offset view:
72
- var zx1 = new Complex128Array ( zx0 .buffer , zx0 .BYTES_PER_ELEMENT * 1 ); // start at 2nd element
72
+ var x1 = new Complex128Array ( x0 .buffer , x0 .BYTES_PER_ELEMENT * 1 ); // start at 2nd element
73
73
74
74
// Compute the L2-norm:
75
- var norm = dznrm2 ( 2 , zx1 , 1 );
75
+ var norm = dznrm2 ( 2 , x1 , 1 );
76
76
// returns ~9.3
77
77
```
78
78
79
- #### dznrm2.ndarray( N, zx , strideX, offset )
79
+ #### dznrm2.ndarray( N, x , strideX, offset )
80
80
81
81
Computes the L2-norm of a complex double-precision floating-point vector using alternative indexing semantics.
82
82
83
83
``` javascript
84
84
var Complex128Array = require ( ' @stdlib/array/complex128' );
85
85
86
- var zx = new Complex128Array ( [ 0.3 , 0.1 , 0.5 , 0.0 , 0.0 , 0.5 , 0.0 , 0.2 ] );
86
+ var x = new Complex128Array ( [ 0.3 , 0.1 , 0.5 , 0.0 , 0.0 , 0.5 , 0.0 , 0.2 ] );
87
87
88
- var norm = dznrm2 .ndarray ( 4 , zx , 1 , 0 );
88
+ var norm = dznrm2 .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 Complex128Array = require ( ' @stdlib/array/complex128' );
100
100
101
- var zx = new Complex128Array ( [ 1.0 , - 2.0 , 3.0 , - 4.0 , 5.0 , - 6.0 ] );
101
+ var x = new Complex128Array ( [ 1.0 , - 2.0 , 3.0 , - 4.0 , 5.0 , - 6.0 ] );
102
102
103
- var norm = dznrm2 .ndarray ( 2 , zx , 1 , 1 );
103
+ var norm = dznrm2 .ndarray ( 2 , x , 1 , 1 );
104
104
// returns ~9.3
105
105
```
106
106
@@ -135,11 +135,11 @@ function rand() {
135
135
return new Complex128 ( discreteUniform ( 0 , 10 ), discreteUniform ( - 5 , 5 ) );
136
136
}
137
137
138
- var zx = filledarrayBy ( 10 , ' complex128' , rand );
139
- console .log ( zx .toString () );
138
+ var x = filledarrayBy ( 10 , ' complex128' , rand );
139
+ console .log ( x .toString () );
140
140
141
141
// Computes the L2-norm:
142
- var norm = dznrm2 ( zx .length , zx , 1 );
142
+ var norm = dznrm2 ( x .length , x , 1 );
143
143
console .log ( norm );
144
144
```
145
145
@@ -173,47 +173,47 @@ console.log( norm );
173
173
#include " stdlib/blas/base/dznrm2.h"
174
174
```
175
175
176
- #### c_dznrm2( N, \* ZX , strideX )
176
+ #### c_dznrm2( N, \* X , strideX )
177
177
178
178
Computes the L2-norm of a complex double-precision floating-point vector.
179
179
180
180
``` c
181
- const double zx [] = { 0.3, 0.1, 0.5, 0.0, 0.0, 0.5, 0.0, 0.2 };
181
+ const double X [] = { 0.3, 0.1, 0.5, 0.0, 0.0, 0.5, 0.0, 0.2 };
182
182
183
- double norm = c_dznrm2( 4, (void * )zx , 1 );
183
+ double norm = c_dznrm2( 4, (void * )X , 1 );
184
184
// returns 0.8
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
- - **ZX **: `[in] void*` input array.
191
- - **strideX**: `[in] CBLAS_INT` index increment for `ZX `.
190
+ - **X **: `[in] void*` input array.
191
+ - **strideX**: `[in] CBLAS_INT` index increment for `X `.
192
192
193
193
```c
194
- double c_dznrm2( const CBLAS_INT N, const void *ZX , const CBLAS_INT strideX );
194
+ double c_dznrm2( const CBLAS_INT N, const void *X , const CBLAS_INT strideX );
195
195
```
196
196
197
- #### c_dznrm2_ndarray( N, \* ZX , strideX, offsetX )
197
+ #### c_dznrm2_ndarray( N, \* X , strideX, offsetX )
198
198
199
199
Computes the L2-norm of a complex double-precision floating-point vector using alternative indexing semantics.
200
200
201
201
``` c
202
- const double zx [] = { 0.3, 0.1, 0.5, 0.0, 0.0, 0.5, 0.0, 0.2 };
202
+ const double X [] = { 0.3, 0.1, 0.5, 0.0, 0.0, 0.5, 0.0, 0.2 };
203
203
204
- double norm = c_dznrm2_ndarray( 4, (void * )zx , 1, 0 );
204
+ double norm = c_dznrm2_ndarray( 4, (void * )X , 1, 0 );
205
205
// returns 0.8
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
- - **ZX **: `[in] void*` input array.
212
- - **strideX**: `[in] CBLAS_INT` index increment for `ZX `.
213
- - **offsetX**: `[in] CBLAS_INT` starting index for `ZX `.
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
- double c_dznrm2_ndarray( const CBLAS_INT N, const void *ZX , const CBLAS_INT strideX, const CBLAS_INT offsetX );
216
+ double c_dznrm2_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 @@ double c_dznrm2_ndarray( const CBLAS_INT N, const void *ZX, const CBLAS_INT stri
240
240
241
241
int main ( void ) {
242
242
// Create a strided array of interleaved real and imaginary components:
243
- const double zx [ ] = { 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 };
243
+ const double X [ ] = { 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 };
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 L2-norm:
252
- double norm = c_dznrm2( N, (void *)zx , strideX );
252
+ double norm = c_dznrm2( N, (void *)X , strideX );
253
253
254
254
// Print the result:
255
255
printf( "L2-norm: %lf\n", norm );
256
256
257
257
// Compute the L2-norm using alternative indexing semantics:
258
- norm = c_dznrm2_ndarray( N, (void *)zx , -strideX, N-1 );
258
+ norm = c_dznrm2_ndarray( N, (void *)X , -strideX, N-1 );
259
259
260
260
// Print the result:
261
261
printf( "L2-norm: %lf\n", norm );
0 commit comments