Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 14 additions & 30 deletions lib/node_modules/@stdlib/stats/base/dnanrange/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,14 @@ The function has the following parameters:
- **x**: input [`Float64Array`][@stdlib/array/float64].
- **strideX**: index increment for `x`.

The `N` and stride parameters determine which elements in the strided array are accessed at runtime. For example, to compute the [range][range] of every other element in `x`,
The `N` and `stride` parameters determine which elements in `x` are accessed at runtime. For example, to compute the [range][range] of every other element in `x`,

```javascript
var Float64Array = require( '@stdlib/array/float64' );

var x = new Float64Array( [ 1.0, 2.0, -7.0, -2.0, 4.0, 3.0, NaN, NaN ] );

var v = dnanrange( 4, x, 2 );
var v = dnanrange( 5, x, 2 );
// returns 11.0
```

Expand All @@ -78,7 +78,7 @@ var Float64Array = require( '@stdlib/array/float64' );
var x0 = new Float64Array( [ 2.0, 1.0, -2.0, -2.0, 3.0, 4.0, NaN, NaN ] );
var x1 = new Float64Array( x0.buffer, x0.BYTES_PER_ELEMENT*1 ); // start at 2nd element

var v = dnanrange( 4, x1, 2 );
var v = dnanrange( 5, x1, 2 );
// returns 6.0
```

Expand All @@ -91,13 +91,13 @@ var Float64Array = require( '@stdlib/array/float64' );

var x = new Float64Array( [ 1.0, -2.0, NaN, 2.0 ] );

var v = dnanrange.ndarray( x.length, x, 1, 0 );
var v = dnanrange.ndarray( 5, x, 1, 0 );
// returns 4.0
```

The function has the following additional parameters:

- **offsetX**: starting index for `x`.
- **offset**: starting index for `x`.

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 [range][range] for every other element in `x` starting from the second element

Expand All @@ -106,7 +106,7 @@ var Float64Array = require( '@stdlib/array/float64' );

var x = new Float64Array( [ 2.0, 1.0, -2.0, -2.0, 3.0, 4.0, NaN, NaN ] );

var v = dnanrange.ndarray( 4, x, 2, 1 );
var v = dnanrange.ndarray( 5, x, 2, 1 );
// returns 6.0
```

Expand Down Expand Up @@ -157,22 +157,6 @@ console.log( v );

<!-- /.examples -->

<!-- C interface documentation. -->

* * *

<section class="c">

## C APIs

<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->

<section class="intro">

</section>

<!-- /.intro -->

<!-- C usage documentation. -->

<section class="usage">
Expand All @@ -185,13 +169,13 @@ console.log( v );

#### stdlib_strided_dnanrange( N, \*X, strideX )

Computes the [range][range] of a double-precision floating-point strided array `x`, ignoring `NaN` values.
Calculate the range value of a double-precision floating-point strided array `x`, ignoring `NaN` values.

```c
const double x[] = { 1.0, 0.0/0.0, 3.0, -4.0 };
const double x[] = { 1.0, -2.0, -3.0, 4.0, -5.0, -6.0, 7.0, 8.0, 0.0/0.0, 0.0/0.0 };

double v = stdlib_strided_dnanrange( 4, x, 1 );
// returns 7.0
double v = stdlib_strided_dnanrange( 5, x, 2 );
// returns 6.0
```

The function accepts the following arguments:
Expand All @@ -206,13 +190,13 @@ double stdlib_strided_dnanrange( const CBLAS_INT N, const double *X, const CBLAS

#### stdlib_strided_dnanrange_ndarray( N, \*X, strideX, offsetX )

Computes the [range][range] of a double-precision floating-point strided array, ignoring `NaN` values and using alternative indexing semantics.
Computes the range value of a double-precision floating-point strided array, ignoring `NaN` values and using alternative indexing semantics.

```c
const double x[] = { 1.0, 0.0/0.0, 3.0, -4.0 };
const double x[] = { 1.0, -2.0, -3.0, 4.0, -5.0, -6.0, 7.0, 8.0, 0.0/0.0, 0.0/0.0 };

double v = stdlib_strided_dnanrange_ndarray( 4, x, 1, 0 );
// returns 7.0
double v = stdlib_strided_dnanrange_ndarray( 5, x, 2, 0 );
// returns 6.0
```

The function accepts the following arguments:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ var dnanrange = require( './../lib/dnanrange.js' );
/**
* Returns a random value or `NaN`.
*
* @private
* @returns {number} random number or `NaN`
* @returns {number} Random number or `NaN`
*/
function rand() {
if ( bernoulli( 0.2 ) ) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,7 @@ var opts = {
/**
* Returns a random value or `NaN`.
*
* @private
* @returns {number} random number or `NaN`
* @returns {number} Random number or `NaN`
*/
function rand() {
if ( bernoulli( 0.2 ) ) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ var dnanrange = require( './../lib/ndarray.js' );
/**
* Returns a random value or `NaN`.
*
* @private
* @returns {number} random number or `NaN`
* @returns {number} Random number or `NaN`
*/
function rand() {
if ( bernoulli( 0.2 ) ) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,7 @@ var opts = {
/**
* Returns a random value or `NaN`.
*
* @private
* @returns {number} random number or `NaN`
* @returns {number} Random number or `NaN`
*/
function rand() {
if ( bernoulli( 0.2 ) ) {
Expand Down
10 changes: 5 additions & 5 deletions lib/node_modules/@stdlib/stats/base/dnanrange/docs/repl.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
Computes the range of a double-precision floating-point strided array,
ignoring `NaN` values.

The `N` and stride parameters determine which elements in `x` are accessed
at runtime.
The `N` and stride parameters determine which elements in the strided array
are accessed at runtime.

Indexing is relative to the first index. To introduce an offset, use a typed
array view.
Expand All @@ -20,7 +20,7 @@
Input array.

strideX: integer
Stride Length.
Stride length.

Returns
-------
Expand Down Expand Up @@ -51,7 +51,7 @@
ignoring `NaN` values and using alternative indexing semantics.

While typed array views mandate a view offset based on the underlying
buffer, the `offset` parameter supports indexing semantics based on a
buffer, the offset parameter supports indexing semantics based on a
starting index.

Parameters
Expand All @@ -63,7 +63,7 @@
Input array.

strideX: integer
Stride Length.
Stride length.

offsetX: integer
Starting index.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ extern "C" {
double API_SUFFIX(stdlib_strided_dnanrange)( const CBLAS_INT N, const double *X, const CBLAS_INT strideX );

/**
* Computes the range of a double-precision floating-point strided array, ignoring `NaN` values.
* Computes the range of a double-precision floating-point strided array, ignoring `NaN` values and using alternative indexing semantics.
*/
double API_SUFFIX(stdlib_strided_dnanrange_ndarray)( const CBLAS_INT N, const double *X, const CBLAS_INT strideX, const CBLAS_INT offsetX );

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

// MAIN //

/**

Check failure on line 28 in lib/node_modules/@stdlib/stats/base/dnanrange/lib/ndarray.native.js

View workflow job for this annotation

GitHub Actions / Lint Changed Files

Displayed return value is `5.0`, but expected `6` instead
* Computes the range of a double-precision floating-point strided array, ignoring `NaN` values.
*
* @param {PositiveInteger} N - number of indexed elements
Expand All @@ -40,7 +40,7 @@
* var x = new Float64Array( [ 2.0, 1.0, 2.0, -2.0, -2.0, 2.0, 3.0, 4.0, NaN, NaN ] );
*
* var v = dnanrange( 5, x, 2, 1 );
* // returns 6.0
* // returns 5.0
*/
function dnanrange( N, x, strideX, offsetX ) {
return addon.ndarray( N, x, strideX, offsetX );
Expand Down
6 changes: 4 additions & 2 deletions lib/node_modules/@stdlib/stats/base/dnanrange/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,16 @@
"confs": [
{
"task": "build",
"wasm": false,
"wasm":false,
"src": [
"./src/main.c"
],
"include": [
"./include"
],
"libraries": [],
"libraries": [
"-lm"
],
"libpath": [],
"dependencies": [
"@stdlib/blas/base/shared",
Expand Down
2 changes: 1 addition & 1 deletion lib/node_modules/@stdlib/stats/base/dnanrange/src/addon.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* @license Apache-2.0
*
* Copyright (c) 2024 The Stdlib Authors.
* Copyright (c) 2020 The Stdlib Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
10 changes: 5 additions & 5 deletions lib/node_modules/@stdlib/stats/base/dnanrange/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ double API_SUFFIX(stdlib_strided_dnanrange)( const CBLAS_INT N, const double *X,
}

/**
* Computes the range of a double-precision floating-point strided array, ignoring `NaN` values.
* Computes the range of a double-precision floating-point strided array, ignoring `NaN` values and using alternative indexing semantics.
*
* @param N number of indexed elements
* @param X input array
Expand All @@ -44,18 +44,18 @@ double API_SUFFIX(stdlib_strided_dnanrange)( const CBLAS_INT N, const double *X,
* @return output value
*/
double API_SUFFIX(stdlib_strided_dnanrange_ndarray)( const CBLAS_INT N, const double *X, const CBLAS_INT strideX, const CBLAS_INT offsetX ) {
CBLAS_INT ix;
CBLAS_INT i;
double max;
double min;
CBLAS_INT ix;
CBLAS_INT i;
double v;

if ( N <= 0 ) {
return 0.0 / 0.0; // NaN
}
if ( N == 1 || strideX == 0 ) {
if ( stdlib_base_is_nan( X[ 0 ] ) ) {
return X[ offsetX ];
if ( stdlib_base_is_nan( X[ offsetX ] ) ) {
return X[ 0 ];
}
return 0.0;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ tape( 'the function supports an `offset` parameter', opts, function test( t ) {
]);

v = dnanrange( 5, x, 2, 1 );
t.strictEqual( v, 6.0, 'returns expected value' );
t.strictEqual( v, 5.0, 'returns expected value' );

t.end();
});
Loading