diff --git a/lib/node_modules/@stdlib/stats/base/nanmaxabs/README.md b/lib/node_modules/@stdlib/stats/base/nanmaxabs/README.md index b3499b7733da..3a61a42d1c17 100644 --- a/lib/node_modules/@stdlib/stats/base/nanmaxabs/README.md +++ b/lib/node_modules/@stdlib/stats/base/nanmaxabs/README.md @@ -2,7 +2,7 @@ @license Apache-2.0 -Copyright (c) 2020 The Stdlib Authors. +Copyright (c) 2025 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. @@ -36,7 +36,7 @@ limitations under the License. var nanmaxabs = require( '@stdlib/stats/base/nanmaxabs' ); ``` -#### nanmaxabs( N, x, stride ) +#### nanmaxabs( N, x, strideX ) Computes the maximum absolute value of a strided array `x`, ignoring `NaN` values. @@ -52,7 +52,7 @@ The function has the following parameters: - **N**: number of indexed elements. - **x**: input [`Array`][mdn-array] or [`typed array`][mdn-typed-array]. -- **stride**: index increment for `x`. +- **strideX**: stride length for `x`. The `N` and `stride` parameters determine which elements in `x` are accessed at runtime. For example, to compute the maximum absolute value of every other element in `x`, @@ -83,7 +83,7 @@ var v = nanmaxabs( N, x1, 2 ); // returns 4.0 ``` -#### nanmaxabs.ndarray( N, x, stride, offset ) +#### nanmaxabs.ndarray( N, x, strideX, offsetX ) Computes the maximum absolute value of a strided array, ignoring `NaN` values and using alternative indexing semantics. @@ -97,7 +97,7 @@ var v = nanmaxabs.ndarray( N, x, 1, 0 ); The function has the following additional parameters: -- **offset**: starting index for `x`. +- **offsetX**: 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 maximum absolute value for every other value in `x` starting from the second value @@ -120,7 +120,7 @@ var v = nanmaxabs.ndarray( N, x, 2, 1 ); ## Notes - If `N <= 0`, both functions return `NaN`. -- Depending on the environment, the typed versions ([`dnanmaxabs`][@stdlib/stats/strided/dnanmaxabs], [`snanmaxabs`][@stdlib/stats/base/snanmaxabs], etc.) are likely to be significantly more performant. +- Depending on the environment, the typed versions ([`dnanmaxabs`][@stdlib/stats/strided/dnanmaxabs], [`snanmaxabs`][@stdlib/stats/strided/snanmaxabs], etc.) are likely to be significantly more performant. @@ -133,22 +133,19 @@ var v = nanmaxabs.ndarray( N, x, 2, 1 ); ```javascript -var randu = require( '@stdlib/random/base/randu' ); -var round = require( '@stdlib/math/base/special/round' ); -var Float64Array = require( '@stdlib/array/float64' ); +var uniform = require( '@stdlib/random/base/uniform' ); +var filledarrayBy = require( '@stdlib/array/filled-by' ); +var bernoulli = require( '@stdlib/random/base/bernoulli' ); var nanmaxabs = require( '@stdlib/stats/base/nanmaxabs' ); -var x; -var i; - -x = new Float64Array( 10 ); -for ( i = 0; i < x.length; i++ ) { - if ( randu() < 0.2 ) { - x[ i ] = NaN; - } else { - x[ i ] = round( (randu()*100.0) - 50.0 ); +function rand() { + if ( bernoulli( 0.8 ) < 1 ) { + return NaN; } + return uniform( -50.0, 50.0 ); } + +var x = filledarrayBy( 10, 'float64', rand ); console.log( x ); var v = nanmaxabs( x.length, x, 1 ); @@ -171,7 +168,7 @@ console.log( v ); - [`@stdlib/stats/base/maxabs`][@stdlib/stats/base/maxabs]: calculate the maximum absolute value of a strided array. - [`@stdlib/stats/base/nanmax`][@stdlib/stats/base/nanmax]: calculate the maximum value of a strided array, ignoring NaN values. - [`@stdlib/stats/base/nanminabs`][@stdlib/stats/base/nanminabs]: calculate the minimum absolute value of a strided array, ignoring NaN values. -- [`@stdlib/stats/base/snanmaxabs`][@stdlib/stats/base/snanmaxabs]: calculate the maximum absolute value of a single-precision floating-point strided array, ignoring NaN values. +- [`@stdlib/stats/strided/snanmaxabs`][@stdlib/stats/strided/snanmaxabs]: calculate the maximum absolute value of a single-precision floating-point strided array, ignoring NaN values. @@ -182,7 +179,7 @@ console.log( v );