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