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
60 changes: 30 additions & 30 deletions lib/node_modules/@stdlib/stats/base/ndarray/dmeanors/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -204,49 +204,49 @@ double stdlib_stats_dmeanors( const struct ndarray *arrays[] );
#include <stdio.h>

int main( void ) {
// Create a data buffer:
const double data[] = { 1.0, -2.0, 3.0, -4.0, 5.0, -6.0, 7.0, -8.0 };
// Create a data buffer:
const double data[] = { 1.0, -2.0, 3.0, -4.0, 5.0, -6.0, 7.0, -8.0 };

// Specify the number of array dimensions:
const int64_t ndims = 1;
// Specify the number of array dimensions:
const int64_t ndims = 1;

// Specify the array shape:
int64_t shape[] = { 4 };
int64_t shape[] = { 4 };

// Specify the array strides:
int64_t strides[] = { 2*STDLIB_NDARRAY_FLOAT64_BYTES_PER_ELEMENT };
// Specify the array strides:
int64_t strides[] = { 2*STDLIB_NDARRAY_FLOAT64_BYTES_PER_ELEMENT };

// Specify the byte offset:
const int64_t offset = 0;
// Specify the byte offset:
const int64_t offset = 0;

// Specify the array order:
const enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR;
// Specify the array order:
const enum STDLIB_NDARRAY_ORDER order = STDLIB_NDARRAY_ROW_MAJOR;

// Specify the index mode:
const enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR;
// Specify the index mode:
const enum STDLIB_NDARRAY_INDEX_MODE imode = STDLIB_NDARRAY_INDEX_ERROR;

// Specify the subscript index modes:
int8_t submodes[] = { STDLIB_NDARRAY_INDEX_ERROR };
const int64_t nsubmodes = 1;
// Specify the subscript index modes:
int8_t submodes[] = { STDLIB_NDARRAY_INDEX_ERROR };
const int64_t nsubmodes = 1;

// Create an ndarray:
struct ndarray *x = stdlib_ndarray_allocate( STDLIB_NDARRAY_FLOAT64, (uint8_t *)data, ndims, shape, strides, offset, order, imode, nsubmodes, submodes );
if ( x == NULL ) {
fprintf( stderr, "Error allocating memory.\n" );
exit( 1 );
}
// Create an ndarray:
struct ndarray *x = stdlib_ndarray_allocate( STDLIB_NDARRAY_FLOAT64, (uint8_t *)data, ndims, shape, strides, offset, order, imode, nsubmodes, submodes );
if ( x == NULL ) {
fprintf( stderr, "Error allocating memory.\n" );
exit( 1 );
}

// Define a list of ndarrays:
const struct ndarray *arrays[] = { x };
// Define a list of ndarrays:
const struct ndarray *arrays[] = { x };

// Compute the arithmetic mean value:
double v = stdlib_stats_dmeanors( arrays );
// Compute the arithmetic mean value:
double v = stdlib_stats_dmeanors( arrays );

// Print the result:
printf( "mean: %lf\n", v );
// Print the result:
printf( "mean: %lf\n", v );

// Free allocated memory:
stdlib_ndarray_free( x );
// Free allocated memory:
stdlib_ndarray_free( x );
}
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ function createBenchmark( len ) {
b.tic();
for ( i = 0; i < b.iterations; i++ ) {
v = dnanstdevch( [ x, correction ] );
if ( typeof v !== 'number' ) {
b.fail( 'should return a number' );
if ( isnan( v ) ) {
b.fail( 'should not return NaN' );
}
}
b.toc();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ The function has the following parameters:
- **mask**: mask [`Uint8Array`][@stdlib/array/uint8]. If a `mask` array element is `0`, the corresponding element in `x` is considered valid and **included** in computation. If a `mask` array element is `1`, the corresponding element in `x` is considered invalid/missing and **excluded** from computation.
- **strideMask**: stride length for `mask`.

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

```javascript
var Float32Array = require( '@stdlib/array/float32' );
Expand Down