You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The `N` and `stride` parameters determine which elements in `x` are accessed at runtime. For example, to compute the maximum absolute value of every other element in `x`,
58
+
The `N` and stride parameters determine which elements in the strided array are accessed at runtime. For example, to compute the maximum absolute value of every other element in `x`,
var floor =require( '@stdlib/math/base/special/floor' );
79
75
80
76
var x0 =newFloat32Array( [ 2.0, 1.0, -2.0, -2.0, 3.0, 4.0, NaN, NaN ] );
81
77
var x1 =newFloat32Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); // start at 2nd element
82
78
83
-
varN=floor( x0.length/2 );
84
-
85
-
var v =snanmaxabs( N, x1, 2 );
79
+
var v =snanmaxabs( 4, x1, 2 );
86
80
// returns 4.0
87
81
```
88
82
89
-
#### snanmaxabs.ndarray( N, x, stride, offset )
83
+
#### snanmaxabs.ndarray( N, x, strideX, offsetX )
90
84
91
85
Computes the maximum absolute value of a single-precision floating-point strided array, ignoring `NaN` values and using alternative indexing semantics.
var x =newFloat32Array( [ 1.0, -2.0, NaN, 2.0 ] );
97
-
varN=x.length;
98
91
99
-
var v =snanmaxabs.ndarray( N, x, 1, 0 );
92
+
var v =snanmaxabs.ndarray( x.length, x, 1, 0 );
100
93
// returns 2.0
101
94
```
102
95
103
96
The function has the following additional parameters:
104
97
105
-
-**offset**: starting index for `x`.
98
+
-**offsetX**: starting index for `x`.
106
99
107
-
While [`typed array`][mdn-typed-array] views mandate a view offset based on the underlying `buffer`, the `offset` parameter supports indexing semantics based on a starting index. For example, to calculate the maximum absolute value for every other value in `x` starting from the second value
100
+
While [`typed array`][mdn-typed-array] views mandate a view offset based on the underlying buffer, the offset parameter supports indexing semantics based on a starting index. For example, to calculate the maximum absolute value for every other element in `x` starting from the second element
var floor =require( '@stdlib/math/base/special/floor' );
112
104
113
105
var x =newFloat32Array( [ 2.0, 1.0, -2.0, -2.0, 3.0, 4.0, NaN, NaN ] );
114
-
varN=floor( x.length/2 );
115
106
116
-
var v =snanmaxabs.ndarray( N, x, 2, 1 );
107
+
var v =snanmaxabs.ndarray( 4, x, 2, 1 );
117
108
// returns 4.0
118
109
```
119
110
@@ -164,6 +155,123 @@ console.log( v );
164
155
165
156
<!-- /.examples -->
166
157
158
+
<!-- C interface documentation. -->
159
+
160
+
* * *
161
+
162
+
<sectionclass="c">
163
+
164
+
## C APIs
165
+
166
+
<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->
167
+
168
+
<sectionclass="intro">
169
+
170
+
</section>
171
+
172
+
<!-- /.intro -->
173
+
174
+
<!-- C usage documentation. -->
175
+
176
+
<sectionclass="usage">
177
+
178
+
### Usage
179
+
180
+
```c
181
+
#include"stdlib/stats/base/snanmaxabs.h"
182
+
```
183
+
184
+
#### stdlib_strided_snanmaxabs( N, \*X, strideX )
185
+
186
+
Computes the maximum absolute value of a single-precision floating-point strided array `x`, ignoring `NaN` values.
#### stdlib_strided_snanmaxabs_ndarray( N, \*X, strideX, offsetX )
206
+
207
+
Computes the maximum absolute value of a single-precision floating-point strided array, ignoring `NaN` values and using alternative indexing semantics.
0 commit comments