From e961c58b46341e2d4d332ca8f4d4dc33b81d6728 Mon Sep 17 00:00:00 2001 From: Samarth Kolarkar Date: Fri, 19 Dec 2025 13:05:18 +0530 Subject: [PATCH] docs(stats/range): update documentation --- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: passed - task: lint_package_json status: na - task: lint_repl_help status: passed - task: lint_javascript_src status: passed - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: passed - task: lint_typescript_tests status: passed - task: lint_license_headers status: passed --- --- .../@stdlib/stats/range/README.md | 49 ++++--------------- .../@stdlib/stats/range/docs/repl.txt | 9 ++-- .../@stdlib/stats/range/docs/types/index.d.ts | 20 ++------ .../@stdlib/stats/range/lib/index.js | 5 +- .../@stdlib/stats/range/lib/main.js | 5 +- 5 files changed, 19 insertions(+), 69 deletions(-) diff --git a/lib/node_modules/@stdlib/stats/range/README.md b/lib/node_modules/@stdlib/stats/range/README.md index 2a58479400d6..122b0ac129f1 100644 --- a/lib/node_modules/@stdlib/stats/range/README.md +++ b/lib/node_modules/@stdlib/stats/range/README.md @@ -48,10 +48,7 @@ var array = require( '@stdlib/ndarray/array' ); var x = array( [ -1.0, 2.0, -3.0 ] ); var y = range( x ); -// returns - -var v = y.get(); -// returns 5.0 +// returns [ 5.0 ] ``` The function has the following parameters: @@ -68,81 +65,58 @@ The function accepts the following options: By default, the function performs a reduction over all elements in a provided input [ndarray][@stdlib/ndarray/ctor]. To perform a reduction over specific dimensions, provide a `dims` option. ```javascript -var ndarray2array = require( '@stdlib/ndarray/to-array' ); var array = require( '@stdlib/ndarray/array' ); var x = array( [ -1.0, 2.0, -3.0, 4.0 ], { 'shape': [ 2, 2 ], 'order': 'row-major' }); -var v = ndarray2array( x ); -// returns [ [ -1.0, 2.0 ], [ -3.0, 4.0 ] ] +// returns [ [ -1.0, 2.0 ], [ -3.0, 4.0 ] ] var y = range( x, { 'dims': [ 0 ] }); -// returns - -v = ndarray2array( y ); -// returns [ 2.0, 2.0 ] +// returns [ 2.0, 2.0 ] y = range( x, { 'dims': [ 1 ] }); -// returns - -v = ndarray2array( y ); -// returns [ 3.0, 7.0 ] +// returns [ 3.0, 7.0 ] y = range( x, { 'dims': [ 0, 1 ] }); -// returns - -v = y.get(); -// returns 7.0 +// returns [ 7.0 ] ``` By default, the function excludes reduced dimensions from the output [ndarray][@stdlib/ndarray/ctor]. To include the reduced dimensions as singleton dimensions, set the `keepdims` option to `true`. ```javascript -var ndarray2array = require( '@stdlib/ndarray/to-array' ); var array = require( '@stdlib/ndarray/array' ); var x = array( [ -1.0, 2.0, -3.0, 4.0 ], { 'shape': [ 2, 2 ], 'order': 'row-major' }); - -var v = ndarray2array( x ); -// returns [ [ -1.0, 2.0 ], [ -3.0, 4.0 ] ] +// returns [ [ -1.0, 2.0 ], [ -3.0, 4.0 ] ] var y = range( x, { 'dims': [ 0 ], 'keepdims': true }); -// returns - -v = ndarray2array( y ); -// returns [ [ 2.0, 2.0 ] ] +// returns [ [ 2.0, 2.0 ] ] y = range( x, { 'dims': [ 1 ], 'keepdims': true }); -// returns - -v = ndarray2array( y ); -// returns [ [ 3.0 ], [ 7.0 ] ] +// returns [ [ 3.0 ], [ 7.0 ] ] y = range( x, { 'dims': [ 0, 1 ], 'keepdims': true }); -// returns - -v = ndarray2array( y ); -// returns [ [ 7.0 ] ] +// returns [ [ 7.0 ] ] ``` By default, the function returns an [ndarray][@stdlib/ndarray/ctor] having a [data type][@stdlib/ndarray/dtypes] determined by the function's output data type [policy][@stdlib/ndarray/output-dtype-policies]. To override the default behavior, set the `dtype` option. @@ -176,10 +150,7 @@ var x = array( [ -1.0, 2.0, -3.0 ] ); var y = zeros( [] ); var out = range.assign( x, y ); -// returns - -var v = out.get(); -// returns 5.0 +// returns [ 5.0 ] var bool = ( out === y ); // returns true diff --git a/lib/node_modules/@stdlib/stats/range/docs/repl.txt b/lib/node_modules/@stdlib/stats/range/docs/repl.txt index 2850eeedd519..88045718bbbf 100644 --- a/lib/node_modules/@stdlib/stats/range/docs/repl.txt +++ b/lib/node_modules/@stdlib/stats/range/docs/repl.txt @@ -30,9 +30,8 @@ Examples -------- > var x = {{alias:@stdlib/ndarray/array}}( [ -1.0, 2.0, -3.0, -4.0 ] ); - > var y = {{alias}}( x ); - > var v = y.get() - 6.0 + > var y = {{alias}}( x ) + [ 6.0 ] {{alias}}.assign( x, out[, options] ) @@ -65,11 +64,9 @@ > var x = {{alias:@stdlib/ndarray/array}}( [ -1.0, 2.0, -3.0, -4.0 ] ); > var out = {{alias:@stdlib/ndarray/zeros}}( [] ); > var y = {{alias}}.assign( x, out ) - + [ 6.0 ] > var bool = ( out === y ) true - > var v = out.get() - 6.0 See Also -------- diff --git a/lib/node_modules/@stdlib/stats/range/docs/types/index.d.ts b/lib/node_modules/@stdlib/stats/range/docs/types/index.d.ts index cf81e777b478..5924abba8cb4 100644 --- a/lib/node_modules/@stdlib/stats/range/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/stats/range/docs/types/index.d.ts @@ -75,10 +75,7 @@ interface Unary { * var x = array( [ -1.0, 2.0, -3.0 ] ); * * var y = range( x ); - * // returns - * - * var v = y.get(); - * // returns 5.0 + * // returns [ 5.0 ] */ ( x: InputArray, options?: Options ): OutputArray; // NOTE: we lose type specificity here, but retaining specificity would likely be difficult and/or tedious to completely enumerate, as the output ndarray data type is dependent on how `x` interacts with output data type policy and whether that policy has been overridden by `options.dtype`. @@ -98,10 +95,7 @@ interface Unary { * var y = zeros( [] ); * * var out = range.assign( x, y ); - * // returns - * - * var v = out.get(); - * // returns 5.0 + * // returns [ 5.0 ] * * var bool = ( out === y ); * // returns true @@ -122,10 +116,7 @@ interface Unary { * var x = array( [ -1.0, 2.0, -3.0 ] ); * * var y = range( x ); -* // returns -* -* var v = y.get(); -* // returns 5.0 +* // returns [ 5.0 ] * * @example * var array = require( '@stdlib/ndarray/array' ); @@ -135,10 +126,7 @@ interface Unary { * var y = zeros( [] ); * * var out = range.assign( x, y ); -* // returns -* -* var v = out.get(); -* // returns 5.0 +* // returns [ 5.0 ] * * var bool = ( out === y ); * // returns true diff --git a/lib/node_modules/@stdlib/stats/range/lib/index.js b/lib/node_modules/@stdlib/stats/range/lib/index.js index 87205f06226c..44d496141b45 100644 --- a/lib/node_modules/@stdlib/stats/range/lib/index.js +++ b/lib/node_modules/@stdlib/stats/range/lib/index.js @@ -45,10 +45,7 @@ * * // Perform reduction: * var out = range( x ); -* // returns -* -* var v = out.get(); -* // returns 9.0 +* // returns [ 9.0 ] */ // MODULES // diff --git a/lib/node_modules/@stdlib/stats/range/lib/main.js b/lib/node_modules/@stdlib/stats/range/lib/main.js index 81d3221a517f..509a18bcb17e 100644 --- a/lib/node_modules/@stdlib/stats/range/lib/main.js +++ b/lib/node_modules/@stdlib/stats/range/lib/main.js @@ -88,10 +88,7 @@ var table = { * * // Perform reduction: * var out = range( x ); -* // returns -* -* var v = out.get(); -* // returns 9.0 +* // returns [ 9.0 ] */ var range = factory( table, [ idtypes ], odtypes, policies );