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 value of every other element in `x`,
63
+
The `N` and stride parameters determine which elements in the strided array are accessed at runtime. For example, to compute the maximum value of every other element in `x`,
The function has the following additional parameters:
110
102
111
-
-**offset**: starting index for `x`.
103
+
-**offsetX**: starting index for `x`.
112
104
113
-
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 value for every other value in `x` starting from the second value
105
+
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 value for every other element in `x` starting from the second element
var smaxsorted =require( '@stdlib/stats/base/smaxsorted' );
150
140
151
-
var x;
152
-
var i;
153
-
154
-
x =newFloat32Array( 10 );
155
-
for ( i =0; i <x.length; i++ ) {
156
-
x[ i ] = i -5.0;
157
-
}
141
+
var options = {
142
+
'dtype':'float32'
143
+
};
144
+
var x =linspace( -5.0, 5.0, 10, options );
158
145
console.log( x );
159
146
160
147
var v =smaxsorted( x.length, x, 1 );
@@ -165,6 +152,123 @@ console.log( v );
165
152
166
153
<!-- /.examples -->
167
154
155
+
<!-- C interface documentation. -->
156
+
157
+
* * *
158
+
159
+
<sectionclass="c">
160
+
161
+
## C APIs
162
+
163
+
<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->
164
+
165
+
<sectionclass="intro">
166
+
167
+
</section>
168
+
169
+
<!-- /.intro -->
170
+
171
+
<!-- C usage documentation. -->
172
+
173
+
<sectionclass="usage">
174
+
175
+
### Usage
176
+
177
+
```c
178
+
#include"stdlib/stats/base/smaxsorted.h"
179
+
```
180
+
181
+
#### stdlib_strided_smaxsorted( N, \*X, strideX )
182
+
183
+
Computes the maximum value of a sorted single-precision floating-point strided array.
184
+
185
+
```c
186
+
constfloat x[] = { 1.0f, 2.0f, 3.0f };
187
+
188
+
float v = stdlib_strided_smaxsorted( 3, x, 1 );
189
+
// returns 3.0f
190
+
```
191
+
192
+
The function accepts the following arguments:
193
+
194
+
- **N**: `[in] CBLAS_INT` number of indexed elements.
195
+
- **X**: `[in] float*` input array.
196
+
- **strideX**: `[in] CBLAS_INT` stride length for `X`.
0 commit comments