|
| 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 |
| 5 | + |
| 6 | + The `N` and `stride` parameters determine which elements in `x` are used |
| 7 | + to compute the sum. |
| 8 | + |
| 9 | + Indexing is relative to the first index. To introduce an offset, use typed |
| 10 | + array views. |
| 11 | + |
| 12 | + If `N` is less than or equal to `0`, the function returns `0`. |
| 13 | + |
| 14 | + Parameters |
| 15 | + ---------- |
| 16 | + N: integer |
| 17 | + Number of indexed elements. |
| 18 | + |
| 19 | + x: Complex128Array |
| 20 | + Input array. |
| 21 | + |
| 22 | + stride: integer |
| 23 | + Index increment. |
| 24 | + |
| 25 | + Returns |
| 26 | + ------- |
| 27 | + sum: number |
| 28 | + Sum of absolute values. |
| 29 | + |
| 30 | + Examples |
| 31 | + -------- |
| 32 | + // Standard usage: |
| 33 | + > var x = new {{alias:@stdlib/array/complex128}}( [ -2.0, 1.0, 3.0, -5.0, 4.0, 0.0 ] ); |
| 34 | + > var s = {{alias}}( x.length, x, 1 ) |
| 35 | + 15.0 |
| 36 | + |
| 37 | + // Sum every other value: |
| 38 | + > s = {{alias}}( 2, x, 2 ) |
| 39 | + 7.0 |
| 40 | + |
| 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 ] ); |
| 43 | + > var x1 = new {{alias:@stdlib/array/complex128}}( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); |
| 44 | + > s = {{alias}}( 2, x1, 2 ) |
| 45 | + 22.0 |
| 46 | + |
| 47 | + |
| 48 | +{{alias}}.ndarray( N, x, stride, offset ) |
| 49 | + Compute the sum of the absolute values of each element in a |
| 50 | + double-precision complex floating-point vector using alternative indexing |
| 51 | + semantics. |
| 52 | + |
| 53 | + While typed array views mandate a view offset based on the underlying |
| 54 | + buffer, the `offset` parameter supports indexing semantics based on a |
| 55 | + starting index. |
| 56 | + |
| 57 | + Parameters |
| 58 | + ---------- |
| 59 | + N: integer |
| 60 | + Number of indexed elements. |
| 61 | + |
| 62 | + x: Complex128Array |
| 63 | + Input array. |
| 64 | + |
| 65 | + stride: integer |
| 66 | + Index increment. |
| 67 | + |
| 68 | + offset: integer |
| 69 | + Starting index. |
| 70 | + |
| 71 | + Returns |
| 72 | + ------- |
| 73 | + sum: number |
| 74 | + Sum of absolute values. |
| 75 | + |
| 76 | + Examples |
| 77 | + -------- |
| 78 | + // 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 s = {{alias}}.ndarray( x.length, x, 1, 0 ) |
| 81 | + 19.0 |
| 82 | + |
| 83 | + // Sum the last three elements: |
| 84 | + > x = new {{alias:@stdlib/array/complex128}}( [ 1.0, -2.0, 3.0, -4.0, 5.0, -6.0, 7.0, -8.0 ] ); |
| 85 | + > s = {{alias}}.ndarray( 3, x, -1, x.length-1 ) |
| 86 | + 33.0 |
| 87 | + |
| 88 | + See Also |
| 89 | + -------- |
| 90 | + |
0 commit comments