|
1 | 1 |
|
2 |
| -{{alias}}( N, x, strideX, y, strideY ) |
3 |
| - Computes the squared absolute value for each element in `x` and assigns the |
4 |
| - results to elements in `y`. |
| 2 | +{{alias}}( N, dtypeX, strideX, dtypeY, strideY ) |
| 3 | + Computes the squared absolute value for each element in a strided array `x` |
| 4 | + and assigns the results to elements in a strided array `y`. |
5 | 5 |
|
6 | 6 | The `N` and `stride` parameters determine which elements in `x` and `y` are
|
7 | 7 | accessed at runtime.
|
|
14 | 14 | N: integer
|
15 | 15 | Number of indexed elements.
|
16 | 16 |
|
| 17 | + dtypeX: string |
| 18 | + Data type for `x`. |
| 19 | + |
17 | 20 | x: ArrayLikeObject
|
18 | 21 | Input array.
|
19 | 22 |
|
20 | 23 | strideX: integer
|
21 | 24 | Index increment for `x`.
|
22 | 25 |
|
| 26 | + dtypeY: string |
| 27 | + Data type for `y`. |
| 28 | + |
23 | 29 | y: ArrayLikeObject
|
24 | 30 | Destination array.
|
25 | 31 |
|
|
34 | 40 | Examples
|
35 | 41 | --------
|
36 | 42 | // Standard usage:
|
37 |
| - > var x = new {{alias:@stdlib/array/float64}}( [ -1.0, -2.0, -3.0, -4.0 ] ); |
| 43 | + > var x = new {{alias:@stdlib/array/float64}}( [ -2.0, 1.0, 3.0, -5.0 ] ); |
38 | 44 | > var y = new {{alias:@stdlib/array/float64}}( [ 0.0, 0.0, 0.0, 0.0 ] );
|
39 |
| - > {{alias}}( x.length, x, 1, y, 1 ) |
40 |
| - <Float64Array>[ 1.0, 4.0, 9.0, 16.0 ] |
| 45 | + > {{alias}}( x.length, 'float64', x, 1, 'float64', y, 1 ) |
| 46 | + <Float64Array>[ 4.0, 1.0, 9.0, 25.0 ] |
41 | 47 |
|
42 | 48 | // Using `N` and `stride` parameters:
|
43 |
| - > var N = {{alias:@stdlib/math/base/special/floor}}( x.length / 2 ); |
44 | 49 | > y = new {{alias:@stdlib/array/float64}}( [ 0.0, 0.0, 0.0, 0.0 ] );
|
45 |
| - > {{alias}}( N, x, 2, y, -1 ) |
46 |
| - <Float64Array>[ 9.0, 1.0, 0.0, 0.0 ] |
| 50 | + > {{alias}}( 2, 'float64', x, 2, 'float64', y, -1 ) |
| 51 | + <Float64Array>[ 9.0, 4.0, 0.0, 0.0 ] |
47 | 52 |
|
48 | 53 | // Using view offsets:
|
49 |
| - > var x0 = new {{alias:@stdlib/array/float64}}( [ -1.0, -2.0, -3.0, -4.0 ] ); |
| 54 | + > var x0 = new {{alias:@stdlib/array/float64}}( [ -2.0, 1.0, 3.0, -5.0 ] ); |
50 | 55 | > var y0 = new {{alias:@stdlib/array/float64}}( [ 0.0, 0.0, 0.0, 0.0 ] );
|
51 | 56 | > var x1 = new {{alias:@stdlib/array/float64}}( x0.buffer, x0.BYTES_PER_ELEMENT*1 );
|
52 | 57 | > var y1 = new {{alias:@stdlib/array/float64}}( y0.buffer, y0.BYTES_PER_ELEMENT*2 );
|
53 |
| - > N = {{alias:@stdlib/math/base/special/floor}}( x0.length / 2 ); |
54 |
| - > {{alias}}( N, x1, -2, y1, 1 ) |
55 |
| - <Float64Array>[ 16.0, 4.0 ] |
| 58 | + > {{alias}}( 2, 'float64', x1, -2, 'float64', y1, 1 ) |
| 59 | + <Float64Array>[ 25.0, 1.0 ] |
56 | 60 | > y0
|
57 |
| - <Float64Array>[ 0.0, 0.0, 16.0, 4.0 ] |
| 61 | + <Float64Array>[ 0.0, 0.0, 25.0, 1.0 ] |
58 | 62 |
|
59 | 63 |
|
60 |
| -{{alias}}.ndarray( N, x, strideX, offsetX, y, strideY, offsetY ) |
61 |
| - Computes the squared absolute value for each element in `x` and assigns the |
62 |
| - results to elements in `y` using alternative indexing semantics. |
| 64 | +{{alias}}.ndarray( N, dtypeX, x, strideX, offsetX, dtypeY, y, strideY, offsetY ) |
| 65 | + Computes the squared absolute value for each element in a strided array `x` |
| 66 | + and assigns the results to elements in a strided array `y` using |
| 67 | + alternative indexing semantics. |
63 | 68 |
|
64 | 69 | While typed array views mandate a view offset based on the underlying
|
65 | 70 | buffer, the `offsetX` and `offsetY` parameters support indexing semantics
|
|
70 | 75 | N: integer
|
71 | 76 | Number of indexed elements.
|
72 | 77 |
|
| 78 | + dtypeX: string |
| 79 | + Data type for `x`. |
| 80 | + |
73 | 81 | x: ArrayLikeObject
|
74 | 82 | Input array.
|
75 | 83 |
|
|
79 | 87 | offsetX: integer
|
80 | 88 | Starting index for `x`.
|
81 | 89 |
|
| 90 | + dtypeY: string |
| 91 | + Data type for `y`. |
| 92 | + |
82 | 93 | y: ArrayLikeObject
|
83 | 94 | Destination array.
|
84 | 95 |
|
|
96 | 107 | Examples
|
97 | 108 | --------
|
98 | 109 | // Standard usage:
|
99 |
| - > var x = new {{alias:@stdlib/array/float64}}( [ -1.0, -2.0, -3.0, -4.0 ] ); |
| 110 | + > var x = new {{alias:@stdlib/array/float64}}( [ -2.0, 1.0, 3.0, -5.0 ] ); |
100 | 111 | > var y = new {{alias:@stdlib/array/float64}}( [ 0.0, 0.0, 0.0, 0.0 ] );
|
101 |
| - > {{alias}}.ndarray( x.length, x, 1, 0, y, 1, 0 ) |
102 |
| - <Float64Array>[ 1.0, 4.0, 9.0, 16.0 ] |
| 112 | + > {{alias}}.ndarray( x.length, 'float64', x, 1, 0, 'float64', y, 1, 0 ) |
| 113 | + <Float64Array>[ 4.0, 1.0, 9.0, 25.0 ] |
103 | 114 |
|
104 | 115 | // Advanced indexing:
|
105 |
| - > x = new {{alias:@stdlib/array/float64}}( [ -1.0, -2.0, -3.0, -4.0 ] ); |
| 116 | + > x = new {{alias:@stdlib/array/float64}}( [ -2.0, 1.0, 3.0, -5.0 ] ); |
106 | 117 | > y = new {{alias:@stdlib/array/float64}}( [ 0.0, 0.0, 0.0, 0.0 ] );
|
107 |
| - > var N = {{alias:@stdlib/math/base/special/floor}}( x.length / 2 ); |
108 |
| - > {{alias}}.ndarray( N, x, 2, 1, y, -1, y.length-1 ) |
109 |
| - <Float64Array>[ 0.0, 0.0, 16.0, 4.0 ] |
| 118 | + > {{alias}}.ndarray( 2, 'float64', x, 2, 1, 'float64', y, -1, y.length-1 ) |
| 119 | + <Float64Array>[ 0.0, 0.0, 25.0, 1.0 ] |
110 | 120 |
|
111 | 121 | See Also
|
112 | 122 | --------
|
|
0 commit comments