|
1 | 1 |
|
2 |
| -{{alias}}( N, x, stride ) |
3 |
| - Compute the sum of the absolute values of each element in a |
4 |
| - double-precision complex floating-point vector |
| 2 | +{{alias}}( N, x, strideX ) |
| 3 | + Computes the sum of the absolute values of each element in a |
| 4 | + double-precision complex floating-point vector. |
5 | 5 |
|
6 |
| - The `N` and `stride` parameters determine which elements in `x` are used |
| 6 | + The `N` and `strideX` parameters determine which elements in `x` are used |
7 | 7 | to compute the sum.
|
8 | 8 |
|
9 | 9 | Indexing is relative to the first index. To introduce an offset, use typed
|
|
19 | 19 | x: Complex128Array
|
20 | 20 | Input array.
|
21 | 21 |
|
22 |
| - stride: integer |
| 22 | + strideX: integer |
23 | 23 | Index increment.
|
24 | 24 |
|
25 | 25 | Returns
|
|
30 | 30 | Examples
|
31 | 31 | --------
|
32 | 32 | // Standard usage:
|
33 |
| - > var x = new {{alias:@stdlib/array/complex128}}( [ -2.0, 1.0, 3.0, -5.0, 4.0, 0.0 ] ); |
| 33 | + > var x = new {{alias:@stdlib/array/complex128}}( [ -2.0, 1.0, 3.0, -5.0 ]); |
34 | 34 | > var s = {{alias}}( x.length, x, 1 )
|
35 |
| - 15.0 |
| 35 | + 11.0 |
36 | 36 |
|
37 |
| - // Sum every other value: |
| 37 | + // Advanced indexing: |
| 38 | + > var x = new {{alias:@stdlib/array/complex128}}( [ -2.0, 1.0, 3.0, -5.0, 4.0, 0.0 ] ); |
38 | 39 | > s = {{alias}}( 2, x, 2 )
|
39 | 40 | 7.0
|
40 | 41 |
|
41 |
| - // Use view offset; e.g., starting at 2nd element: |
42 |
| - > var x0 = new {{alias:@stdlib/array/complex128}}( [ 1.0, -2.0, 3.0, -4.0, 5.0, -6.0, 7.0, -8.0 ] ); |
| 42 | + // Using typed array views: |
| 43 | + > var x0 = new {{alias:@stdlib/array/complex128}}( [ 1.0, -2.0, 3.0, -4.0, 5.0, -6.0 ] ); |
43 | 44 | > var x1 = new {{alias:@stdlib/array/complex128}}( x0.buffer, x0.BYTES_PER_ELEMENT*1 );
|
44 |
| - > s = {{alias}}( 2, x1, 2 ) |
45 |
| - 22.0 |
| 45 | + > s = {{alias}}( 2, x1, 1 ) |
| 46 | + 18.0 |
46 | 47 |
|
47 | 48 |
|
48 |
| -{{alias}}.ndarray( N, x, stride, offset ) |
49 |
| - Compute the sum of the absolute values of each element in a |
| 49 | +{{alias}}.ndarray( N, x, strideX, offsetX ) |
| 50 | + Computes the sum of the absolute values of each element in a |
50 | 51 | double-precision complex floating-point vector using alternative indexing
|
51 | 52 | semantics.
|
52 | 53 |
|
53 | 54 | While typed array views mandate a view offset based on the underlying
|
54 |
| - buffer, the `offset` parameter supports indexing semantics based on a |
| 55 | + buffer, the `offsetX` parameter supports indexing semantics based on a |
55 | 56 | starting index.
|
56 | 57 |
|
57 | 58 | Parameters
|
|
62 | 63 | x: Complex128Array
|
63 | 64 | Input array.
|
64 | 65 |
|
65 |
| - stride: integer |
| 66 | + strideX: integer |
66 | 67 | Index increment.
|
67 | 68 |
|
68 |
| - offset: integer |
| 69 | + offsetX: integer |
69 | 70 | Starting index.
|
70 | 71 |
|
71 | 72 | Returns
|
|
76 | 77 | Examples
|
77 | 78 | --------
|
78 | 79 | // Standard usage:
|
79 |
| - > var x = new {{alias:@stdlib/array/complex128}}( [ -2.0, 1.0, 3.0, -5.0, 4.0, 0.0, -1.0, -3.0 ] ); |
| 80 | + > var x = new {{alias:@stdlib/array/complex128}}( [ -2.0, 1.0, 3.0, -5.0 ] ); |
80 | 81 | > var s = {{alias}}.ndarray( x.length, x, 1, 0 )
|
81 |
| - 19.0 |
| 82 | + 11.0 |
82 | 83 |
|
83 |
| - // Sum the last three elements: |
| 84 | + // Advanced indexing: |
84 | 85 | > x = new {{alias:@stdlib/array/complex128}}( [ 1.0, -2.0, 3.0, -4.0, 5.0, -6.0, 7.0, -8.0 ] );
|
85 | 86 | > s = {{alias}}.ndarray( 3, x, -1, x.length-1 )
|
86 | 87 | 33.0
|
|
0 commit comments