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 `x` are accessed at runtime. For example, to compute the maximum absolute value of every other element in `x`,
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 smaxabs =require( '@stdlib/stats/base/smaxabs' );
132
+
var discreteUniform =require( '@stdlib/random/array/discrete-uniform' );
145
133
146
-
var x;
147
-
var i;
134
+
var smaxabs =require( '@stdlib/stats/base/smaxabs' );
148
135
149
-
x =newFloat32Array( 10 );
150
-
for ( i =0; i <x.length; i++ ) {
151
-
x[ i ] =round( (randu()*100.0) -50.0 );
152
-
}
136
+
var x =discreteUniform( 10, -50, 50, {
137
+
'dtype':'float32'
138
+
});
153
139
console.log( x );
154
140
155
141
var v =smaxabs( x.length, x, 1 );
@@ -160,6 +146,123 @@ console.log( v );
160
146
161
147
<!-- /.examples -->
162
148
149
+
<!-- C interface documentation. -->
150
+
151
+
* * *
152
+
153
+
<sectionclass="c">
154
+
155
+
## C APIs
156
+
157
+
<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->
158
+
159
+
<sectionclass="intro">
160
+
161
+
</section>
162
+
163
+
<!-- /.intro -->
164
+
165
+
<!-- C usage documentation. -->
166
+
167
+
<sectionclass="usage">
168
+
169
+
### Usage
170
+
171
+
```c
172
+
#include"stdlib/stats/base/smaxabs.h"
173
+
```
174
+
175
+
#### stdlib_strided_smaxabs( N, \*X, strideX )
176
+
177
+
Computes the maximum absolute value of a single-precision floating-point strided array.
178
+
179
+
```c
180
+
constfloat x[] = { 1.0f, -2.0f, 3.0f, -4.0f };
181
+
182
+
float v = stdlib_strided_smaxabs( 4, x, 1 );
183
+
// returns 4.0f
184
+
```
185
+
186
+
The function accepts the following arguments:
187
+
188
+
- **N**: `[in] CBLAS_INT` number of indexed elements.
189
+
- **X**: `[in] float*` input array.
190
+
- **strideX**: `[in] CBLAS_INT` stride length for `X`.
0 commit comments