Skip to content

Commit 4da0494

Browse files
committed
Auto-generated commit
1 parent 2804e45 commit 4da0494

File tree

19 files changed

+339
-185
lines changed

19 files changed

+339
-185
lines changed

CHANGELOG.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,28 @@ This release closes the following issue:
102102

103103
<!-- /.package -->
104104

105+
<section class="package" id="blas-ext-base-drev-unreleased">
106+
107+
#### [@stdlib/blas/ext/base/drev](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/blas/ext/base/drev)
108+
109+
<details>
110+
111+
<section class="features">
112+
113+
##### Features
114+
115+
- [`ee9a830`](https://github.com/stdlib-js/stdlib/commit/ee9a8300ba0f24dabe4b7b67ffb3bbe94f251b36) - add C `ndarray` API and refactor `blas/ext/base/drev` [(#3071)](https://github.com/stdlib-js/stdlib/pull/3071)
116+
117+
</section>
118+
119+
<!-- /.features -->
120+
121+
</details>
122+
123+
</section>
124+
125+
<!-- /.package -->
126+
105127
<section class="package" id="blas-ext-base-dsnannsumors-unreleased">
106128

107129
#### [@stdlib/blas/ext/base/dsnannsumors](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/blas/ext/base/dsnannsumors)
@@ -160,6 +182,7 @@ A total of 3 people contributed to this release. Thank you to the following cont
160182

161183
<details>
162184

185+
- [`ee9a830`](https://github.com/stdlib-js/stdlib/commit/ee9a8300ba0f24dabe4b7b67ffb3bbe94f251b36) - **feat:** add C `ndarray` API and refactor `blas/ext/base/drev` [(#3071)](https://github.com/stdlib-js/stdlib/pull/3071) _(by Muhammad Haris)_
163186
- [`a341f85`](https://github.com/stdlib-js/stdlib/commit/a341f857ab541502a4e2b0b4b805c41e68e46fd6) - **feat:** add C `ndarray` API and refactor `blas/ext/base/dsnannsumors` [(#3086)](https://github.com/stdlib-js/stdlib/pull/3086) _(by Muhammad Haris)_
164187
- [`af8d471`](https://github.com/stdlib-js/stdlib/commit/af8d471a7e01113f814a78fc411c7949b69ca1f3) - **feat:** add C `ndarray` API and refactor `blas/ext/base/dnannsumors` [(#2991)](https://github.com/stdlib-js/stdlib/pull/2991) _(by Muhammad Haris)_
165188
- [`796d76a`](https://github.com/stdlib-js/stdlib/commit/796d76a43a378cd5496e4222baac2bde1658e6da) - **feat:** add C `ndarray` API and refactor `blas/ext/base/dnansum` [(#3052)](https://github.com/stdlib-js/stdlib/pull/3052) _(by Muhammad Haris)_

ext/base/drev/README.md

Lines changed: 127 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ limitations under the License.
3030
var drev = require( '@stdlib/blas/ext/base/drev' );
3131
```
3232

33-
#### drev( N, x, stride )
33+
#### drev( N, x, strideX )
3434

3535
Reverses a double-precision floating-point strided array `x` in-place.
3636

@@ -47,9 +47,9 @@ The function has the following parameters:
4747

4848
- **N**: number of indexed elements.
4949
- **x**: input [`Float64Array`][@stdlib/array/float64].
50-
- **stride**: index increment.
50+
- **strideX**: stride length for `x`.
5151

52-
The `N` and stride parameters determine which elements in the strided array are accessed at runtime. For example, to reverse every other element
52+
The `N` and stride parameters determine which elements in the strided array are accessed at runtime. For example, to reverse every other element:
5353

5454
```javascript
5555
var Float64Array = require( '@stdlib/array/float64' );
@@ -76,7 +76,7 @@ drev( 3, x1, 2 );
7676
// x0 => <Float64Array>[ 1.0, -6.0, 3.0, -4.0, 5.0, -2.0 ]
7777
```
7878

79-
#### drev.ndarray( N, x, stride, offset )
79+
#### drev.ndarray( N, x, strideX, offsetX )
8080

8181
Reverses a double-precision floating-point strided array `x` in-place using alternative indexing semantics.
8282

@@ -91,9 +91,9 @@ drev.ndarray( x.length, x, 1, 0 );
9191

9292
The function has the following additional parameters:
9393

94-
- **offset**: starting index.
94+
- **offsetX**: starting index for `x`.
9595

96-
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 the strided array
96+
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 the strided array:
9797

9898
```javascript
9999
var Float64Array = require( '@stdlib/array/float64' );
@@ -126,11 +126,12 @@ drev.ndarray( 3, x, 1, x.length-3 );
126126
<!-- eslint no-undef: "error" -->
127127

128128
```javascript
129-
var discreteUniform = require( '@stdlib/random/base/discrete-uniform' ).factory;
130-
var filledarrayBy = require( '@stdlib/array/filled-by' );
129+
var discreteUniform = require( '@stdlib/random/array/discrete-uniform' );
131130
var drev = require( '@stdlib/blas/ext/base/drev' );
132131

133-
var x = filledarrayBy( 10, 'float64', discreteUniform( -100.0, 100.0 ) );
132+
var x = discreteUniform( 10, -100, 100, {
133+
'dtype': 'float64'
134+
});
134135
console.log( x );
135136

136137
drev( x.length, x, 1 );
@@ -141,6 +142,123 @@ console.log( x );
141142

142143
<!-- /.examples -->
143144

145+
<!-- C interface documentation. -->
146+
147+
* * *
148+
149+
<section class="c">
150+
151+
## C APIs
152+
153+
<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->
154+
155+
<section class="intro">
156+
157+
</section>
158+
159+
<!-- /.intro -->
160+
161+
<!-- C usage documentation. -->
162+
163+
<section class="usage">
164+
165+
### Usage
166+
167+
```c
168+
#include "stdlib/blas/ext/base/drev.h"
169+
```
170+
171+
#### stdlib_strided_drev( N, \*X, strideX )
172+
173+
Reverses a double-precision floating-point strided array `X` in-place.
174+
175+
```c
176+
double x[] = { 1.0, 2.0, 3.0, 4.0 };
177+
178+
stdlib_strided_drev( 4, x, 1 );
179+
```
180+
181+
The function accepts the following arguments:
182+
183+
- **N**: `[in] CBLAS_INT` number of indexed elements.
184+
- **X**: `[in] double*` input array.
185+
- **strideX**: `[in] CBLAS_INT` stride length for `X`.
186+
187+
```c
188+
double stdlib_strided_drev( const CBLAS_INT N, double *X, const CBLAS_INT strideX );
189+
```
190+
191+
#### stdlib_strided_drev_ndarray( N, \*X, strideX, offsetX )
192+
193+
Reverses a double-precision floating-point strided array `X` in-place using alternative indexing semantics.
194+
195+
```c
196+
double x[] = { 1.0, 2.0, 3.0, 4.0 };
197+
198+
stdlib_strided_drev_ndarray( 4, x, 1, 0 );
199+
```
200+
201+
The function accepts the following arguments:
202+
203+
- **N**: `[in] CBLAS_INT` number of indexed elements.
204+
- **X**: `[in] double*` input array.
205+
- **strideX**: `[in] CBLAS_INT` stride length for `X`.
206+
- **offsetX**: `[in] CBLAS_INT` starting index for `X`.
207+
208+
```c
209+
void stdlib_strided_drev_ndarray( const CBLAS_INT N, double *X, const CBLAS_INT strideX, const CBLAS_INT offsetX );
210+
```
211+
212+
</section>
213+
214+
<!-- /.usage -->
215+
216+
<!-- C API usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
217+
218+
<section class="notes">
219+
220+
</section>
221+
222+
<!-- /.notes -->
223+
224+
<!-- C API usage examples. -->
225+
226+
<section class="examples">
227+
228+
### Examples
229+
230+
```c
231+
#include "stdlib/blas/ext/base/drev.h"
232+
#include <stdio.h>
233+
234+
int main( void ) {
235+
// Create a strided array:
236+
double x[] = { 1.0, -2.0, 3.0, -4.0, 5.0, -6.0, 7.0, -8.0 };
237+
238+
// Specify the number of elements:
239+
const int N = 8;
240+
241+
// Specify a stride:
242+
const int strideX = 1;
243+
244+
// Reverse the array:
245+
stdlib_strided_drev( N, x, strideX );
246+
247+
// Print the result:
248+
for ( int i = 0; i < 8; i++ ) {
249+
printf( "x[ %i ] = %lf\n", i, x[ i ] );
250+
}
251+
}
252+
```
253+
254+
</section>
255+
256+
<!-- /.examples -->
257+
258+
</section>
259+
260+
<!-- /.c -->
261+
144262
<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. -->
145263
146264
<section class="related">

ext/base/drev/benchmark/benchmark.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@
2121
// MODULES //
2222

2323
var bench = require( '@stdlib/bench' );
24-
var uniform = require( '@stdlib/random/base/uniform' ).factory;
25-
var filledarrayBy = require( '@stdlib/array/filled-by' );
24+
var uniform = require( '@stdlib/random/array/uniform' );
2625
var isnan = require( '@stdlib/math/base/assert/is-nan' );
2726
var pow = require( '@stdlib/math/base/special/pow' );
2827
var pkg = require( './../package.json' ).name;
@@ -31,7 +30,9 @@ var drev = require( './../lib/drev.js' );
3130

3231
// VARIABLES //
3332

34-
var rand = uniform( -10.0, 10.0 );
33+
var options = {
34+
'dtype': 'float64'
35+
};
3536

3637

3738
// FUNCTIONS //
@@ -44,7 +45,7 @@ var rand = uniform( -10.0, 10.0 );
4445
* @returns {Function} benchmark function
4546
*/
4647
function createBenchmark( len ) {
47-
var x = filledarrayBy( len, 'float64', rand );
48+
var x = uniform( len, -10.0, 10.0, options );
4849
return benchmark;
4950

5051
function benchmark( b ) {

ext/base/drev/benchmark/benchmark.native.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@
2222

2323
var resolve = require( 'path' ).resolve;
2424
var bench = require( '@stdlib/bench' );
25-
var uniform = require( '@stdlib/random/base/uniform' ).factory;
26-
var filledarrayBy = require( '@stdlib/array/filled-by' );
25+
var uniform = require( '@stdlib/random/array/uniform' );
2726
var isnan = require( '@stdlib/math/base/assert/is-nan' );
2827
var pow = require( '@stdlib/math/base/special/pow' );
2928
var tryRequire = require( '@stdlib/utils/try-require' );
@@ -36,7 +35,9 @@ var drev = tryRequire( resolve( __dirname, './../lib/drev.native.js' ) );
3635
var opts = {
3736
'skip': ( drev instanceof Error )
3837
};
39-
var rand = uniform( -10.0, 10.0 );
38+
var options = {
39+
'dtype': 'float64'
40+
};
4041

4142

4243
// FUNCTIONS //
@@ -49,7 +50,7 @@ var rand = uniform( -10.0, 10.0 );
4950
* @returns {Function} benchmark function
5051
*/
5152
function createBenchmark( len ) {
52-
var x = filledarrayBy( len, 'float64', rand );
53+
var x = uniform( len, -10.0, 10.0, options );
5354
return benchmark;
5455

5556
function benchmark( b ) {

ext/base/drev/benchmark/benchmark.ndarray.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@
2121
// MODULES //
2222

2323
var bench = require( '@stdlib/bench' );
24-
var uniform = require( '@stdlib/random/base/uniform' ).factory;
25-
var filledarrayBy = require( '@stdlib/array/filled-by' );
24+
var uniform = require( '@stdlib/random/array/uniform' );
2625
var isnan = require( '@stdlib/math/base/assert/is-nan' );
2726
var pow = require( '@stdlib/math/base/special/pow' );
2827
var pkg = require( './../package.json' ).name;
@@ -31,7 +30,9 @@ var drev = require( './../lib/ndarray.js' );
3130

3231
// VARIABLES //
3332

34-
var rand = uniform( -10.0, 10.0 );
33+
var options = {
34+
'dtype': 'float64'
35+
};
3536

3637

3738
// FUNCTIONS //
@@ -44,7 +45,7 @@ var rand = uniform( -10.0, 10.0 );
4445
* @returns {Function} benchmark function
4546
*/
4647
function createBenchmark( len ) {
47-
var x = filledarrayBy( len, 'float64', rand );
48+
var x = uniform( len, -10.0, 10.0, options );
4849
return benchmark;
4950

5051
function benchmark( b ) {

ext/base/drev/benchmark/benchmark.ndarray.native.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@
2222

2323
var resolve = require( 'path' ).resolve;
2424
var bench = require( '@stdlib/bench' );
25-
var uniform = require( '@stdlib/random/base/uniform' ).factory;
26-
var filledarrayBy = require( '@stdlib/array/filled-by' );
25+
var uniform = require( '@stdlib/random/array/uniform' );
2726
var isnan = require( '@stdlib/math/base/assert/is-nan' );
2827
var pow = require( '@stdlib/math/base/special/pow' );
2928
var tryRequire = require( '@stdlib/utils/try-require' );
@@ -36,7 +35,9 @@ var drev = tryRequire( resolve( __dirname, './../lib/ndarray.native.js' ) );
3635
var opts = {
3736
'skip': ( drev instanceof Error )
3837
};
39-
var rand = uniform( -10.0, 10.0 );
38+
var options = {
39+
'dtype': 'float64'
40+
};
4041

4142

4243
// FUNCTIONS //
@@ -49,7 +50,7 @@ var rand = uniform( -10.0, 10.0 );
4950
* @returns {Function} benchmark function
5051
*/
5152
function createBenchmark( len ) {
52-
var x = filledarrayBy( len, 'float64', rand );
53+
var x = uniform( len, -10.0, 10.0, options );
5354
return benchmark;
5455

5556
function benchmark( b ) {

0 commit comments

Comments
 (0)