@@ -36,42 +36,38 @@ limitations under the License.
3636var dminsorted = require ( ' @stdlib/stats/base/dminsorted' );
3737```
3838
39- #### dminsorted( N, x, stride )
39+ #### dminsorted( N, x, strideX )
4040
4141Computes the minimum value of a sorted double-precision floating-point strided array ` x ` .
4242
4343``` javascript
4444var Float64Array = require ( ' @stdlib/array/float64' );
4545
4646var x = new Float64Array ( [ 1.0 , 2.0 , 3.0 ] );
47- var N = x .length ;
4847
49- var v = dminsorted ( N , x, 1 );
48+ var v = dminsorted ( x . length , x, 1 );
5049// returns 1.0
5150
5251x = new Float64Array ( [ 3.0 , 2.0 , 1.0 ] );
53- N = x .length ;
5452
55- v = dminsorted ( N , x, 1 );
53+ v = dminsorted ( x . length , x, 1 );
5654// returns 1.0
5755```
5856
5957The function has the following parameters:
6058
6159- ** N** : number of indexed elements.
6260- ** x** : sorted input [ ` Float64Array ` ] [ @stdlib/array/float64 ] .
63- - ** stride ** : index increment for ` x ` .
61+ - ** strideX ** : stride length for ` x ` .
6462
65- The ` N ` and ` stride ` parameters determine which elements in ` x ` are accessed at runtime. For example, to compute the minimum 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 minimum value of every other element in ` x ` ,
6664
6765``` javascript
6866var Float64Array = require ( ' @stdlib/array/float64' );
69- var floor = require ( ' @stdlib/math/base/special/floor' );
7067
7168var x = new Float64Array ( [ 1.0 , 2.0 , 2.0 , - 7.0 , 3.0 , 3.0 , 4.0 , 2.0 ] );
72- var N = floor ( x .length / 2 );
7369
74- var v = dminsorted ( N , x, 2 );
70+ var v = dminsorted ( 4 , x, 2 );
7571// returns 1.0
7672```
7773
@@ -81,45 +77,39 @@ Note that indexing is relative to the first index. To introduce an offset, use [
8177
8278``` javascript
8379var Float64Array = require ( ' @stdlib/array/float64' );
84- var floor = require ( ' @stdlib/math/base/special/floor' );
8580
8681var x0 = new Float64Array ( [ 2.0 , 1.0 , 2.0 , 2.0 , - 2.0 , 2.0 , 3.0 , 4.0 ] );
8782var x1 = new Float64Array ( x0 .buffer , x0 .BYTES_PER_ELEMENT * 1 ); // start at 2nd element
8883
89- var N = floor ( x0 .length / 2 );
90-
91- var v = dminsorted ( N , x1, 2 );
84+ var v = dminsorted ( 4 , x1, 2 );
9285// returns 1.0
9386```
9487
95- #### dminsorted.ndarray( N, x, stride, offset )
88+ #### dminsorted.ndarray( N, x, strideX, offsetX )
9689
9790Computes the minimum value of a sorted double-precision floating-point strided array using alternative indexing semantics.
9891
9992``` javascript
10093var Float64Array = require ( ' @stdlib/array/float64' );
10194
10295var x = new Float64Array ( [ 1.0 , 2.0 , 3.0 ] );
103- var N = x .length ;
10496
105- var v = dminsorted .ndarray ( N , x, 1 , 0 );
97+ var v = dminsorted .ndarray ( x . length , x, 1 , 0 );
10698// returns 1.0
10799```
108100
109101The function has the following additional parameters:
110102
111- - ** offset ** : starting index for ` x ` .
103+ - ** offsetX ** : starting index for ` x ` .
112104
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 minimum 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 minimum value for every other element in ` x ` starting from the second element
114106
115107``` javascript
116108var Float64Array = require ( ' @stdlib/array/float64' );
117- var floor = require ( ' @stdlib/math/base/special/floor' );
118109
119110var x = new Float64Array ( [ 2.0 , 1.0 , 2.0 , 2.0 , - 2.0 , 2.0 , 3.0 , 4.0 ] );
120- var N = floor ( x .length / 2 );
121111
122- var v = dminsorted .ndarray ( N , x, 2 , 1 );
112+ var v = dminsorted .ndarray ( 4 , x, 2 , 1 );
123113// returns 1.0
124114```
125115
@@ -145,16 +135,13 @@ var v = dminsorted.ndarray( N, x, 2, 1 );
145135<!-- eslint no-undef: "error" -->
146136
147137``` javascript
148- var Float64Array = require ( ' @stdlib/array/float64 ' );
138+ var linspace = require ( ' @stdlib/array/linspace ' );
149139var dminsorted = require ( ' @stdlib/stats/base/dminsorted' );
150140
151- var x;
152- var i;
153-
154- x = new Float64Array ( 10 );
155- for ( i = 0 ; i < x .length ; i++ ) {
156- x[ i ] = i - 5.0 ;
157- }
141+ var options = {
142+ ' dtype' : ' float64'
143+ };
144+ var x = linspace ( - 5.0 , 5.0 , 10 , options );
158145console .log ( x );
159146
160147var v = dminsorted ( x .length , x, 1 );
@@ -165,6 +152,107 @@ console.log( v );
165152
166153<!-- /.examples -->
167154
155+ <!-- C usage documentation. -->
156+
157+ <section class =" usage " >
158+
159+ ### Usage
160+
161+ ``` c
162+ #include " stdlib/stats/base/dminsorted.h"
163+ ```
164+
165+ #### stdlib_strided_dminsorted( N, \* X, strideX )
166+
167+ Computes the minimum value of a sorted double-precision floating-point strided array.
168+
169+ ``` c
170+ const double x[] = { 1.0, 2.0, 3.0 };
171+
172+ double v = stdlib_strided_dmax( 3, x, 1 );
173+ // returns 1.0
174+ ```
175+
176+ The function accepts the following arguments:
177+
178+ - **N**: `[in] CBLAS_INT` number of indexed elements.
179+ - **X**: `[in] double*` input array.
180+ - **strideX**: `[in] CBLAS_INT` stride length for `X`.
181+
182+ ```c
183+ double stdlib_strided_dminsorted( const CBLAS_INT N, const double *X, const CBLAS_INT strideX );
184+ ```
185+
186+ #### stdlib_strided_dminsorted_ndarray( N, \* X, strideX, offsetX )
187+
188+ Computes the minimum value of a sorted double-precision floating-point strided array using alternative indexing semantics.
189+
190+ ``` c
191+ const double x[] = { 1.0, 2.0, 3.0 };
192+
193+ double v = stdlib_strided_dminsorted_ndarray( 3, x, 1, 0 );
194+ // returns 1.0
195+ ```
196+
197+ The function accepts the following arguments:
198+
199+ - **N**: `[in] CBLAS_INT` number of indexed elements.
200+ - **X**: `[in] double*` input array.
201+ - **strideX**: `[in] CBLAS_INT` stride length for `X`.
202+ - **offsetX**: `[in] CBLAS_INT` starting index for `X`.
203+
204+ ```c
205+ double stdlib_strided_dminsorted_ndarray( const CBLAS_INT N, const double *X, const CBLAS_INT strideX, const CBLAS_INT offsetX );
206+ ```
207+
208+ </section >
209+
210+ <!-- /.usage -->
211+
212+ <!-- C API usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
213+
214+ <section class =" notes " >
215+
216+ </section >
217+
218+ <!-- /.notes -->
219+
220+ <!-- C API usage examples. -->
221+
222+ <section class =" examples " >
223+
224+ ### Examples
225+
226+ ``` c
227+ #include " stdlib/stats/base/dminsorted.h"
228+ #include < stdio.h>
229+
230+ int main ( void ) {
231+ // Create a strided array:
232+ const double x[ ] = { 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 };
233+
234+ // Specify the number of elements:
235+ const int N = 4;
236+
237+ // Specify the stride length:
238+ const int strideX = 2;
239+
240+ // Compute the minimum value:
241+ double v = stdlib_strided_dminsorted( N, x, strideX );
242+
243+ // Print the result:
244+ printf( "min: %lf\n", v );
245+ }
246+ ```
247+
248+ </section>
249+
250+ <!-- /.examples -->
251+
252+ </section>
253+
254+ <!-- /.c -->
255+
168256<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. -->
169257
170258<section class="related">
0 commit comments