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
@@ -48,9 +48,9 @@ The function has the following parameters:
48
48
-**N**: number of indexed elements.
49
49
-**order**: sort order. If `order < 0.0`, the input strided array is sorted in **decreasing** order. If `order > 0.0`, the input strided array is sorted in **increasing** order. If `order == 0.0`, the input strided array is left unchanged.
The function has the following additional parameters:
94
94
95
-
-**offset**: starting index.
95
+
-**offsetX**: starting index.
96
96
97
-
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 access only the last three elements of `x`
97
+
While [`typed array`][mdn-typed-array] views mandate a view offset based on the underlying buffer, the offset parameter supports indexing semantics based on starting a index. For example, to access only the last three elements:
var discreteUniform =require( '@stdlib/random/array/discrete-uniform' );
137
135
var dsorthp =require( '@stdlib/blas/ext/base/dsorthp' );
138
136
139
-
var rand;
140
-
var sign;
141
-
var x;
142
-
var i;
143
-
144
-
x =newFloat64Array( 10 );
145
-
for ( i =0; i <x.length; i++ ) {
146
-
rand =round( randu()*100.0 );
147
-
sign =randu();
148
-
if ( sign <0.5 ) {
149
-
sign =-1.0;
150
-
} else {
151
-
sign =1.0;
152
-
}
153
-
x[ i ] = sign * rand;
154
-
}
137
+
var x =discreteUniform( 10, -100, 100, {
138
+
'dtype':'float64'
139
+
});
155
140
console.log( x );
156
141
157
142
dsorthp( x.length, -1.0, x, -1 );
@@ -164,6 +149,126 @@ console.log( x );
164
149
165
150
* * *
166
151
152
+
<sectionclass="c">
153
+
154
+
## C APIs
155
+
156
+
<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->
157
+
158
+
<sectionclass="intro">
159
+
160
+
</section>
161
+
162
+
<!-- /.intro -->
163
+
164
+
<!-- C usage documentation. -->
165
+
166
+
<sectionclass="usage">
167
+
168
+
### Usage
169
+
170
+
```c
171
+
#include"stdlib/blas/ext/base/dsorthp.h"
172
+
```
173
+
174
+
#### stdlib_strided_dsorthp( N, order, \*X, strideX )
175
+
176
+
Sorts a double-precision floating-point strided array using heapsort.
177
+
178
+
```c
179
+
double x[] = { 1.0, -2.0, 3.0, -4.0 };
180
+
181
+
stdlib_strided_dsorthp( 2, -1.0, x, 1 );
182
+
```
183
+
184
+
The function accepts the following arguments:
185
+
186
+
- **N**: `[in] CBLAS_INT` number of indexed elements.
187
+
- **order**: `[in] double` sort order. If `order < 0.0`, the input strided array `x` is sorted in **decreasing** order. If `order > 0.0`, the input strided array `x` is sorted in **increasing** order. If `order == 0.0`, the input strided arrays are left unchanged.
- **N**: `[in] CBLAS_INT` number of indexed elements.
212
+
- **order**: `[in] double` sort order.
213
+
- **X**: `[inout] double*` input array. If `order < 0.0`, the input strided array `x` is sorted in **decreasing** order. If `order > 0.0`, the input strided array `x` is sorted in **increasing** order. If `order == 0.0`, the input strided arrays are left unchanged.
0 commit comments