Skip to content
Open
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
11 changes: 8 additions & 3 deletions lib/node_modules/@stdlib/stats/strided/dnanmin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,9 @@ console.log( v );
Calculate the minimum value of a double-precision floating-point strided array, ignoring `NaN` values.

```c
const double x[] = { 1.0, -2.0, 0.0 / 0.0, -4.0 };
#include "stdlib/constants/float64/nan.h"

const double x[] = { 1.0, -2.0, STDLIB_CONSTANT_FLOAT64_NAN, -4.0 };

double v = stdlib_strided_dnanmin( 4, x, 1 );
// returns -4.0
Expand All @@ -207,7 +209,9 @@ double stdlib_strided_dnanmin( const CBLAS_INT N, const double *X, const CBLAS_I
Computes the minimum value of a double-precision floating-point strided array, ignoring `NaN` values and using alternative indexing semantics.

```c
const double x[] = { 1.0, -2.0, 0.0 / 0.0, -4.0 };
#include "stdlib/constants/float64/nan.h"

const double x[] = { 1.0, -2.0, STDLIB_CONSTANT_FLOAT64_NAN, -4.0 };

double v = stdlib_strided_dnanmin_ndarray( 4, x, 1, 0 );
// returns -4.0
Expand Down Expand Up @@ -244,12 +248,13 @@ double stdlib_strided_dnanmin_ndarray( const CBLAS_INT N, const double *X, const

```c
#include "stdlib/stats/strided/dnanmin.h"
#include "stdlib/constants/float64/nan.h"
#include <stdint.h>
#include <stdio.h>

int main( void ) {
// Create a strided array:
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 };
const double x[] = { 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, STDLIB_CONSTANT_FLOAT64_NAN, STDLIB_CONSTANT_FLOAT64_NAN };

// Specify the number of elements:
const int N = 5;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
*/

#include "stdlib/stats/strided/dnanmin.h"
#include "stdlib/constants/float64/nan.h"
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
Expand Down Expand Up @@ -104,7 +105,7 @@ static double benchmark1( int iterations, int len ) {
x = (double *) malloc( len * sizeof( double ) );
for ( i = 0; i < len; i++ ) {
if ( rand_double() < 0.2 ) {
x[ i ] = 0.0 / 0.0; // NaN
x[ i ] = STDLIB_CONSTANT_FLOAT64_NAN;
} else {
x[ i ] = ( rand_double() * 20000.0 ) - 10000.0;
}
Expand Down Expand Up @@ -144,7 +145,7 @@ static double benchmark2( int iterations, int len ) {
x = (double *) malloc( len * sizeof( double ) );
for ( i = 0; i < len; i++ ) {
if ( rand_double() < 0.2 ) {
x[ i ] = 0.0 / 0.0; // NaN
x[ i ] = STDLIB_CONSTANT_FLOAT64_NAN;
} else {
x[ i ] = ( rand_double() * 20000.0 ) - 10000.0;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,13 @@
*/

#include "stdlib/stats/strided/dnanmin.h"
#include "stdlib/constants/float64/nan.h"
#include <stdint.h>
#include <stdio.h>

int main( void ) {
// Create a strided array:
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 };
const double x[] = { 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, STDLIB_CONSTANT_FLOAT64_NAN, STDLIB_CONSTANT_FLOAT64_NAN };

// Specify the number of elements:
const int N = 5;
Expand Down
4 changes: 4 additions & 0 deletions lib/node_modules/@stdlib/stats/strided/dnanmin/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
"libraries": [],
"libpath": [],
"dependencies": [
"@stdlib/constants/float64/nan",
"@stdlib/math/base/assert/is-nan",
"@stdlib/math/base/assert/is-negative-zero",
"@stdlib/blas/base/shared",
Expand All @@ -61,6 +62,7 @@
"libraries": [],
"libpath": [],
"dependencies": [
"@stdlib/constants/float64/nan",
"@stdlib/math/base/assert/is-nan",
"@stdlib/math/base/assert/is-negative-zero",
"@stdlib/blas/base/shared",
Expand All @@ -79,6 +81,7 @@
"libraries": [],
"libpath": [],
"dependencies": [
"@stdlib/constants/float64/nan",
"@stdlib/math/base/assert/is-nan",
"@stdlib/math/base/assert/is-negative-zero",
"@stdlib/blas/base/shared",
Expand All @@ -97,6 +100,7 @@
"libraries": [],
"libpath": [],
"dependencies": [
"@stdlib/constants/float64/nan",
"@stdlib/math/base/assert/is-nan",
"@stdlib/math/base/assert/is-negative-zero",
"@stdlib/blas/base/shared",
Expand Down
5 changes: 3 additions & 2 deletions lib/node_modules/@stdlib/stats/strided/dnanmin/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
*/

#include "stdlib/stats/strided/dnanmin.h"
#include "stdlib/constants/float64/nan.h"
#include "stdlib/math/base/assert/is_nan.h"
#include "stdlib/math/base/assert/is_negative_zero.h"
#include "stdlib/strided/base/stride2offset.h"
Expand Down Expand Up @@ -51,7 +52,7 @@ double API_SUFFIX(stdlib_strided_dnanmin_ndarray)( const CBLAS_INT N, const doub
double v;

if ( N <= 0 ) {
return 0.0 / 0.0; // NaN
return STDLIB_CONSTANT_FLOAT64_NAN;
}
if ( N == 1 || strideX == 0 ) {
return X[ offsetX ];
Expand All @@ -65,7 +66,7 @@ double API_SUFFIX(stdlib_strided_dnanmin_ndarray)( const CBLAS_INT N, const doub
ix += strideX;
}
if ( i == N ) {
return 0.0 / 0.0; // NaN
return STDLIB_CONSTANT_FLOAT64_NAN;
}
min = v;
i += 1;
Expand Down