From 924dc48318f06bb4aeafb86bcd6c2a7c237bf553 Mon Sep 17 00:00:00 2001 From: headlessNode Date: Sat, 18 Jul 2026 12:51:52 +0500 Subject: [PATCH 1/2] feat: add blas/ext/base/ndarray/gany --- 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_pkg_readmes status: passed - task: lint_markdown_docs status: na - task: lint_markdown status: na - task: lint_package_json status: passed - task: lint_repl_help status: passed - task: lint_javascript_src status: passed - task: lint_javascript_cli status: na - task: lint_javascript_examples status: passed - task: lint_javascript_tests status: passed - task: lint_javascript_benchmarks status: passed - 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 --- --- .../blas/ext/base/ndarray/gany/README.md | 110 +++++++++++++ .../base/ndarray/gany/benchmark/benchmark.js | 102 ++++++++++++ .../blas/ext/base/ndarray/gany/docs/repl.txt | 24 +++ .../base/ndarray/gany/docs/types/index.d.ts | 50 ++++++ .../ext/base/ndarray/gany/docs/types/test.ts | 57 +++++++ .../ext/base/ndarray/gany/examples/index.js | 31 ++++ .../blas/ext/base/ndarray/gany/lib/index.js | 43 +++++ .../blas/ext/base/ndarray/gany/lib/main.js | 60 +++++++ .../blas/ext/base/ndarray/gany/package.json | 67 ++++++++ .../blas/ext/base/ndarray/gany/test/test.js | 155 ++++++++++++++++++ 10 files changed, 699 insertions(+) create mode 100644 lib/node_modules/@stdlib/blas/ext/base/ndarray/gany/README.md create mode 100644 lib/node_modules/@stdlib/blas/ext/base/ndarray/gany/benchmark/benchmark.js create mode 100644 lib/node_modules/@stdlib/blas/ext/base/ndarray/gany/docs/repl.txt create mode 100644 lib/node_modules/@stdlib/blas/ext/base/ndarray/gany/docs/types/index.d.ts create mode 100644 lib/node_modules/@stdlib/blas/ext/base/ndarray/gany/docs/types/test.ts create mode 100644 lib/node_modules/@stdlib/blas/ext/base/ndarray/gany/examples/index.js create mode 100644 lib/node_modules/@stdlib/blas/ext/base/ndarray/gany/lib/index.js create mode 100644 lib/node_modules/@stdlib/blas/ext/base/ndarray/gany/lib/main.js create mode 100644 lib/node_modules/@stdlib/blas/ext/base/ndarray/gany/package.json create mode 100644 lib/node_modules/@stdlib/blas/ext/base/ndarray/gany/test/test.js diff --git a/lib/node_modules/@stdlib/blas/ext/base/ndarray/gany/README.md b/lib/node_modules/@stdlib/blas/ext/base/ndarray/gany/README.md new file mode 100644 index 000000000000..b8793f4651de --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/ndarray/gany/README.md @@ -0,0 +1,110 @@ + + +# gany + +> Test whether at least one element in a one-dimensional ndarray is truthy. + +
+ +
+ + + +
+ +## Usage + +```javascript +var gany = require( '@stdlib/blas/ext/base/ndarray/gany' ); +``` + +#### gany( arrays ) + +Tests whether at least one element in a one-dimensional ndarray is truthy. + +```javascript +var vector = require( '@stdlib/ndarray/vector/ctor' ); + +var x = vector( [ 0.0, 0.0, 1.0, 1.0 ], 'generic' ); + +var v = gany( [ x ] ); +// returns true +``` + +The function has the following parameters: + +- **arrays**: array-like object containing the following ndarrays: + + - a one-dimensional input ndarray. + +
+ + + +
+ +## Notes + +- If provided an empty one-dimensional ndarray, the function returns `false`. + +
+ + + +
+ +## Examples + + + +```javascript +var discreteUniform = require( '@stdlib/random/discrete-uniform' ); +var ndarray2array = require( '@stdlib/ndarray/to-array' ); +var gany = require( '@stdlib/blas/ext/base/ndarray/gany' ); + +var x = discreteUniform( [ 10 ], 0, 1, { + 'dtype': 'generic' +}); +console.log( ndarray2array( x ) ); + +var v = gany( [ x ] ); +console.log( v ); +``` + +
+ + + + + + + + + + + + + + diff --git a/lib/node_modules/@stdlib/blas/ext/base/ndarray/gany/benchmark/benchmark.js b/lib/node_modules/@stdlib/blas/ext/base/ndarray/gany/benchmark/benchmark.js new file mode 100644 index 000000000000..5b64c82805c8 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/ndarray/gany/benchmark/benchmark.js @@ -0,0 +1,102 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 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. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var bench = require( '@stdlib/bench' ); +var zeros = require( '@stdlib/ndarray/zeros' ); +var pow = require( '@stdlib/math/base/special/pow' ); +var format = require( '@stdlib/string/format' ); +var pkg = require( './../package.json' ).name; +var gany = require( './../lib' ); + + +// VARIABLES // + +var options = { + 'dtype': 'generic' +}; + + +// FUNCTIONS // + +/** +* Creates a benchmark function. +* +* @private +* @param {PositiveInteger} len - array length +* @returns {Function} benchmark function +*/ +function createBenchmark( len ) { + var x = zeros( [ len ], options ); + return benchmark; + + /** + * Benchmark function. + * + * @private + * @param {Benchmark} b - benchmark instance + */ + function benchmark( b ) { + var out; + var i; + + b.tic(); + for ( i = 0; i < b.iterations; i++ ) { + out = gany( [ x ] ); + if ( typeof out !== 'boolean' ) { + b.fail( 'should return a boolean' ); + } + } + b.toc(); + if ( typeof out !== 'boolean' ) { + b.fail( 'should return a boolean' ); + } + b.pass( 'benchmark finished' ); + b.end(); + } +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var len; + var min; + var max; + var f; + var i; + + min = 1; // 10^min + max = 6; // 10^max + + for ( i = min; i <= max; i++ ) { + len = pow( 10, i ); + f = createBenchmark( len ); + bench( format( '%s:len=%d', pkg, len ), f ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/blas/ext/base/ndarray/gany/docs/repl.txt b/lib/node_modules/@stdlib/blas/ext/base/ndarray/gany/docs/repl.txt new file mode 100644 index 000000000000..3f9ca488f940 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/ndarray/gany/docs/repl.txt @@ -0,0 +1,24 @@ + +{{alias}}( arrays ) + Tests whether at least one element in a one-dimensional ndarray is truthy. + + If provided an empty one-dimensional ndarray, the function returns `false`. + + Parameters + ---------- + arrays: ArrayLikeObject + Array-like object containing a one-dimensional input ndarray. + + Returns + ------- + bool: boolean + Boolean indicating whether at least one element is truthy. + + Examples + -------- + > var x = {{alias:@stdlib/ndarray/vector/ctor}}( [ 0.0, 0.0, 1.0, 1.0 ], 'generic' ); + > {{alias}}( [ x ] ) + true + + See Also + -------- diff --git a/lib/node_modules/@stdlib/blas/ext/base/ndarray/gany/docs/types/index.d.ts b/lib/node_modules/@stdlib/blas/ext/base/ndarray/gany/docs/types/index.d.ts new file mode 100644 index 000000000000..c6d2d340bceb --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/ndarray/gany/docs/types/index.d.ts @@ -0,0 +1,50 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2026 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. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +// TypeScript Version: 4.1 + +/// + +import { ndarray } from '@stdlib/types/ndarray'; + +/** +* Tests whether at least one element in a one-dimensional ndarray is truthy. +* +* ## Notes +* +* - The function expects the following ndarrays: +* +* - a one-dimensional input ndarray. +* +* @param arrays - array-like object containing ndarrays +* @returns boolean indicating whether at least one element is truthy +* +* @example +* var vector = require( '@stdlib/ndarray/vector/ctor' ); +* +* var x = vector( [ 0.0, 0.0, 1.0, 1.0 ], 'generic' ); +* +* var v = gany( [ x ] ); +* // returns true +*/ +declare function gany( arrays: [ ndarray ] ): boolean; + + +// EXPORTS // + +export = gany; diff --git a/lib/node_modules/@stdlib/blas/ext/base/ndarray/gany/docs/types/test.ts b/lib/node_modules/@stdlib/blas/ext/base/ndarray/gany/docs/types/test.ts new file mode 100644 index 000000000000..316d7155e415 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/ndarray/gany/docs/types/test.ts @@ -0,0 +1,57 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2026 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. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* eslint-disable space-in-parens */ + +import zeros = require( '@stdlib/ndarray/zeros' ); +import gany = require( './index' ); + + +// TESTS // + +// The function returns a boolean... +{ + const x = zeros( [ 10 ], { + 'dtype': 'generic' + }); + + gany( [ x ] ); // $ExpectType boolean +} + +// The compiler throws an error if the function is provided a first argument which is not an array of ndarrays... +{ + gany( '10' ); // $ExpectError + gany( 10 ); // $ExpectError + gany( true ); // $ExpectError + gany( false ); // $ExpectError + gany( null ); // $ExpectError + gany( undefined ); // $ExpectError + gany( [] ); // $ExpectError + gany( {} ); // $ExpectError + gany( ( x: number ): number => x ); // $ExpectError +} + +// The compiler throws an error if the function is provided an unsupported number of arguments... +{ + const x = zeros( [ 10 ], { + 'dtype': 'generic' + }); + + gany(); // $ExpectError + gany( [ x ], {} ); // $ExpectError +} diff --git a/lib/node_modules/@stdlib/blas/ext/base/ndarray/gany/examples/index.js b/lib/node_modules/@stdlib/blas/ext/base/ndarray/gany/examples/index.js new file mode 100644 index 000000000000..7d0b875de3b1 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/ndarray/gany/examples/index.js @@ -0,0 +1,31 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 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. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +var discreteUniform = require( '@stdlib/random/discrete-uniform' ); +var ndarray2array = require( '@stdlib/ndarray/to-array' ); +var gany = require( './../lib' ); + +var x = discreteUniform( [ 10 ], 0, 1, { + 'dtype': 'generic' +}); +console.log( ndarray2array( x ) ); + +var v = gany( [ x ] ); +console.log( v ); diff --git a/lib/node_modules/@stdlib/blas/ext/base/ndarray/gany/lib/index.js b/lib/node_modules/@stdlib/blas/ext/base/ndarray/gany/lib/index.js new file mode 100644 index 000000000000..e6db1fbd3aff --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/ndarray/gany/lib/index.js @@ -0,0 +1,43 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 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. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +/** +* Test whether at least one element in a one-dimensional ndarray is truthy. +* +* @module @stdlib/blas/ext/base/ndarray/gany +* +* @example +* var vector = require( '@stdlib/ndarray/vector/ctor' ); +* var gany = require( '@stdlib/blas/ext/base/ndarray/gany' ); +* +* var x = vector( [ 0.0, 0.0, 1.0, 1.0 ], 'generic' ); +* +* var v = gany( [ x ] ); +* // returns true +*/ + +// MODULES // + +var main = require( './main.js' ); + + +// EXPORTS // + +module.exports = main; diff --git a/lib/node_modules/@stdlib/blas/ext/base/ndarray/gany/lib/main.js b/lib/node_modules/@stdlib/blas/ext/base/ndarray/gany/lib/main.js new file mode 100644 index 000000000000..23f6b3583f51 --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/ndarray/gany/lib/main.js @@ -0,0 +1,60 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 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. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var numelDimension = require( '@stdlib/ndarray/base/numel-dimension' ); +var getStride = require( '@stdlib/ndarray/base/stride' ); +var getOffset = require( '@stdlib/ndarray/base/offset' ); +var getData = require( '@stdlib/ndarray/base/data-buffer' ); +var strided = require( '@stdlib/blas/ext/base/gany' ).ndarray; + + +// MAIN // + +/** +* Tests whether at least one element in a one-dimensional ndarray is truthy. +* +* ## Notes +* +* - The function expects the following ndarrays: +* +* - a one-dimensional input ndarray. +* +* @param {ArrayLikeObject} arrays - array-like object containing ndarrays +* @returns {boolean} boolean indicating whether at least one element is truthy +* +* @example +* var vector = require( '@stdlib/ndarray/vector/ctor' ); +* +* var x = vector( [ 0.0, 0.0, 1.0, 1.0 ], 'generic' ); +* +* var v = gany( [ x ] ); +* // returns true +*/ +function gany( arrays ) { + var x = arrays[ 0 ]; + return strided( numelDimension( x, 0 ), getData( x ), getStride( x, 0 ), getOffset( x ) ); // eslint-disable-line max-len +} + + +// EXPORTS // + +module.exports = gany; diff --git a/lib/node_modules/@stdlib/blas/ext/base/ndarray/gany/package.json b/lib/node_modules/@stdlib/blas/ext/base/ndarray/gany/package.json new file mode 100644 index 000000000000..7935ede3d12d --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/ndarray/gany/package.json @@ -0,0 +1,67 @@ +{ + "name": "@stdlib/blas/ext/base/ndarray/gany", + "version": "0.0.0", + "description": "Test whether at least one element in a one-dimensional ndarray is truthy.", + "license": "Apache-2.0", + "author": { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + }, + "contributors": [ + { + "name": "The Stdlib Authors", + "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" + } + ], + "main": "./lib", + "directories": { + "benchmark": "./benchmark", + "doc": "./docs", + "example": "./examples", + "lib": "./lib", + "test": "./test" + }, + "types": "./docs/types", + "scripts": {}, + "homepage": "https://github.com/stdlib-js/stdlib", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/stdlib.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "dependencies": {}, + "devDependencies": {}, + "engines": { + "node": ">=0.10.0", + "npm": ">2.7.0" + }, + "os": [ + "aix", + "darwin", + "freebsd", + "linux", + "macos", + "openbsd", + "sunos", + "win32", + "windows" + ], + "keywords": [ + "stdlib", + "stdmath", + "mathematics", + "math", + "blas", + "extended", + "any", + "gany", + "truthy", + "boolean", + "strided", + "ndarray", + "generic" + ], + "__stdlib__": {} +} diff --git a/lib/node_modules/@stdlib/blas/ext/base/ndarray/gany/test/test.js b/lib/node_modules/@stdlib/blas/ext/base/ndarray/gany/test/test.js new file mode 100644 index 000000000000..2612996acc0f --- /dev/null +++ b/lib/node_modules/@stdlib/blas/ext/base/ndarray/gany/test/test.js @@ -0,0 +1,155 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) 2026 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. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +'use strict'; + +// MODULES // + +var tape = require( 'tape' ); +var ndarray = require( '@stdlib/ndarray/base/ctor' ); +var gany = require( './../lib' ); + + +// FUNCTIONS // + +/** +* Returns a one-dimensional ndarray. +* +* @private +* @param {Collection} buffer - underlying data buffer +* @param {NonNegativeInteger} length - number of indexed elements +* @param {integer} stride - stride length +* @param {NonNegativeInteger} offset - index offset +* @returns {ndarray} one-dimensional ndarray +*/ +function vector( buffer, length, stride, offset ) { + return new ndarray( 'generic', buffer, [ length ], [ stride ], offset, 'row-major' ); +} + + +// TESTS // + +tape( 'main export is a function', function test( t ) { + t.ok( true, __filename ); + t.strictEqual( typeof gany, 'function', 'main export is a function' ); + t.end(); +}); + +tape( 'the function has an arity of 1', function test( t ) { + t.strictEqual( gany.length, 1, 'has expected arity' ); + t.end(); +}); + +tape( 'the function tests whether at least one element in a one-dimensional ndarray is truthy', function test( t ) { + var x; + var v; + + x = [ 0, 0, 1, 1 ]; + v = gany( [ vector( x, 4, 1, 0 ) ] ); + t.strictEqual( v, true, 'returns expected value' ); + + x = [ 0, 0, 0, 0, 0 ]; + v = gany( [ vector( x, 5, 1, 0 ) ] ); + t.strictEqual( v, false, 'returns expected value' ); + + x = [ 1, 0, 0 ]; + v = gany( [ vector( x, 3, 1, 0 ) ] ); + t.strictEqual( v, true, 'returns expected value' ); + + x = [ -0, 0, -0 ]; + v = gany( [ vector( x, 3, 1, 0 ) ] ); + t.strictEqual( v, false, 'returns expected value' ); + + x = [ -1, 0, 0 ]; + v = gany( [ vector( x, 3, 1, 0 ) ] ); + t.strictEqual( v, true, 'returns expected value' ); + + t.end(); +}); + +tape( 'if provided an empty ndarray, the function returns `false`', function test( t ) { + var x; + var v; + + x = []; + + v = gany( [ vector( x, 0, 1, 0 ) ] ); + t.strictEqual( v, false, 'returns expected value' ); + + t.end(); +}); + +tape( 'the function supports one-dimensional ndarrays having non-unit strides', function test( t ) { + var x; + var v; + + x = [ + 0, // 0 + 1, + 0, // 1 + 1, + 0, // 2 + 1, + 0, // 3 + 1 + ]; + v = gany( [ vector( x, 4, 2, 0 ) ] ); + + t.strictEqual( v, false, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports one-dimensional ndarrays having negative strides', function test( t ) { + var x; + var v; + + x = [ + 1, // 3 + 0, + 0, // 2 + 0, + 0, // 1 + 0, + 0, // 0 + 0 + ]; + v = gany( [ vector( x, 4, -2, 6 ) ] ); + + t.strictEqual( v, true, 'returns expected value' ); + t.end(); +}); + +tape( 'the function supports one-dimensional ndarrays having non-zero offsets', function test( t ) { + var x; + var v; + + x = [ + 1, + 0, // 0 + 1, + 0, // 1 + 1, + 0, // 2 + 1, + 0 // 3 + ]; + v = gany( [ vector( x, 4, 2, 1 ) ] ); + t.strictEqual( v, false, 'returns expected value' ); + + t.end(); +}); From bec5867ac5ee9fd7c8a38e8743bf2828698a1ddd Mon Sep 17 00:00:00 2001 From: Athan Date: Sat, 18 Jul 2026 15:42:18 -0700 Subject: [PATCH 2/2] Apply suggestions from code review Co-authored-by: Athan Signed-off-by: Athan --- .../@stdlib/blas/ext/base/ndarray/gany/README.md | 5 +++-- .../@stdlib/blas/ext/base/ndarray/gany/docs/repl.txt | 2 ++ .../@stdlib/blas/ext/base/ndarray/gany/docs/types/index.d.ts | 2 ++ .../@stdlib/blas/ext/base/ndarray/gany/examples/index.js | 4 ++-- .../@stdlib/blas/ext/base/ndarray/gany/lib/main.js | 2 ++ 5 files changed, 11 insertions(+), 4 deletions(-) diff --git a/lib/node_modules/@stdlib/blas/ext/base/ndarray/gany/README.md b/lib/node_modules/@stdlib/blas/ext/base/ndarray/gany/README.md index b8793f4651de..93224365e357 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/ndarray/gany/README.md +++ b/lib/node_modules/@stdlib/blas/ext/base/ndarray/gany/README.md @@ -64,6 +64,7 @@ The function has the following parameters: ## Notes - If provided an empty one-dimensional ndarray, the function returns `false`. +- The function explicitly treats `NaN` values as falsy. @@ -76,11 +77,11 @@ The function has the following parameters: ```javascript -var discreteUniform = require( '@stdlib/random/discrete-uniform' ); +var bernoulli = require( '@stdlib/random/bernoulli' ); var ndarray2array = require( '@stdlib/ndarray/to-array' ); var gany = require( '@stdlib/blas/ext/base/ndarray/gany' ); -var x = discreteUniform( [ 10 ], 0, 1, { +var x = bernoulli( [ 10 ], 0.2, { 'dtype': 'generic' }); console.log( ndarray2array( x ) ); diff --git a/lib/node_modules/@stdlib/blas/ext/base/ndarray/gany/docs/repl.txt b/lib/node_modules/@stdlib/blas/ext/base/ndarray/gany/docs/repl.txt index 3f9ca488f940..3ca50a62fb9d 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/ndarray/gany/docs/repl.txt +++ b/lib/node_modules/@stdlib/blas/ext/base/ndarray/gany/docs/repl.txt @@ -4,6 +4,8 @@ If provided an empty one-dimensional ndarray, the function returns `false`. + The function explicitly treats `NaN` values as falsy. + Parameters ---------- arrays: ArrayLikeObject diff --git a/lib/node_modules/@stdlib/blas/ext/base/ndarray/gany/docs/types/index.d.ts b/lib/node_modules/@stdlib/blas/ext/base/ndarray/gany/docs/types/index.d.ts index c6d2d340bceb..4a27c4cd4e99 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/ndarray/gany/docs/types/index.d.ts +++ b/lib/node_modules/@stdlib/blas/ext/base/ndarray/gany/docs/types/index.d.ts @@ -31,6 +31,8 @@ import { ndarray } from '@stdlib/types/ndarray'; * * - a one-dimensional input ndarray. * +* - The function explicitly treats `NaN` values as falsy. +* * @param arrays - array-like object containing ndarrays * @returns boolean indicating whether at least one element is truthy * diff --git a/lib/node_modules/@stdlib/blas/ext/base/ndarray/gany/examples/index.js b/lib/node_modules/@stdlib/blas/ext/base/ndarray/gany/examples/index.js index 7d0b875de3b1..3e13b180d746 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/ndarray/gany/examples/index.js +++ b/lib/node_modules/@stdlib/blas/ext/base/ndarray/gany/examples/index.js @@ -18,11 +18,11 @@ 'use strict'; -var discreteUniform = require( '@stdlib/random/discrete-uniform' ); +var bernoulli = require( '@stdlib/random/bernoulli' ); var ndarray2array = require( '@stdlib/ndarray/to-array' ); var gany = require( './../lib' ); -var x = discreteUniform( [ 10 ], 0, 1, { +var x = bernoulli( [ 10 ], 0.2, { 'dtype': 'generic' }); console.log( ndarray2array( x ) ); diff --git a/lib/node_modules/@stdlib/blas/ext/base/ndarray/gany/lib/main.js b/lib/node_modules/@stdlib/blas/ext/base/ndarray/gany/lib/main.js index 23f6b3583f51..8a57813a8ab9 100644 --- a/lib/node_modules/@stdlib/blas/ext/base/ndarray/gany/lib/main.js +++ b/lib/node_modules/@stdlib/blas/ext/base/ndarray/gany/lib/main.js @@ -38,6 +38,8 @@ var strided = require( '@stdlib/blas/ext/base/gany' ).ndarray; * * - a one-dimensional input ndarray. * +* - The function explicitly treats `NaN` values as falsy. +* * @param {ArrayLikeObject} arrays - array-like object containing ndarrays * @returns {boolean} boolean indicating whether at least one element is truthy *