From ce2e22bb6394b33d4ae735badaf064e65f0e32a1 Mon Sep 17 00:00:00 2001 From: GUNJ JOSHI Date: Tue, 8 Oct 2024 21:03:17 +0530 Subject: [PATCH 01/13] build: update scaffolding for creating unary math strided packages --- .../data/README__md.txt | 6 +- .../data/benchmark/benchmark__js.txt | 6 +- .../data/benchmark/benchmark__native__js.txt | 6 +- .../data/benchmark/benchmark__ndarray__js.txt | 6 +- .../benchmark__ndarray__native__js.txt | 6 +- .../data/benchmark/c/Makefile.txt | 2 + .../data/benchmark/c/benchmark__length__c.txt | 8 +- .../data/binding__gyp.txt | 2 + .../data/docs/types/index__d__ts.txt | 2 + .../data/docs/types/test__ts.txt | 2 + .../data/examples/c/Makefile.txt | 2 + .../data/examples/c/example__c.txt | 2 + .../data/examples/index__js.txt | 2 + .../data/include/alias__h.txt | 2 + .../data/include__gypi.txt | 2 + .../data/lib/alias__js.txt | 2 + .../data/lib/alias__native__js.txt | 2 + .../data/lib/index__js.txt | 2 + .../data/lib/main__js.txt | 2 + .../data/lib/native__js.txt | 2 + .../data/lib/ndarray__js.txt | 2 + .../data/lib/ndarray__native__js.txt | 2 + .../data/src/Makefile.txt | 2 + .../data/src/addon__c.txt | 2 + .../data/src/alias__c.txt | 2 + .../data/test/test__alias__js.txt | 2 + .../data/test/test__alias__native__js.txt | 2 + .../data/test/test__js.txt | 2 + .../data/test/test__ndarray__js.txt | 2 + .../data/test/test__ndarray__native__js.txt | 2 + .../scripts/data.json | 149 ++++++++++ .../scripts/generate_data.js | 79 +++++ .../scripts/runner.js | 279 ++++++++++++++++++ .../scripts/scaffold.sh | 66 +++-- 34 files changed, 618 insertions(+), 41 deletions(-) create mode 100644 lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/scripts/data.json create mode 100644 lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/scripts/generate_data.js create mode 100644 lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/scripts/runner.js diff --git a/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/README__md.txt b/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/README__md.txt index f44744eaf80e..d571bdb70627 100644 --- a/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/README__md.txt +++ b/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/README__md.txt @@ -18,6 +18,8 @@ limitations under the License. --> + + # {{ALIAS}} > {{PKG_DESC}} @@ -135,7 +137,7 @@ var y = new {{TYPED_ARRAY_CTOR}}( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] ); ```javascript -var uniform = require( '@stdlib/random/base/uniform' ); +var random = require( '@stdlib/random/base/random' ); var {{TYPED_ARRAY_CTOR}} = require( '@stdlib/array/{{TYPED_ARRAY_DTYPE}}' ); var {{ALIAS}} = require( '@{{PKG}}' ); @@ -144,7 +146,7 @@ var y = new {{TYPED_ARRAY_CTOR}}( 10 ); var i; for ( i = 0; i < x.length; i++ ) { - x[ i ] = uniform( {{C_RAND_MIN}}, {{C_RAND_MAX}} ); + x[ i ] = random( {{C_RAND_MIN}}, {{C_RAND_MAX}} ); } console.log( x ); console.log( y ); diff --git a/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/benchmark/benchmark__js.txt b/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/benchmark/benchmark__js.txt index 6725f2de57ca..da1194763ae7 100644 --- a/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/benchmark/benchmark__js.txt +++ b/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/benchmark/benchmark__js.txt @@ -16,12 +16,14 @@ * limitations under the License. */ +/* THIS IS A GENERATED FILE. DO NOT EDIT DIRECTLY. */ + 'use strict'; // MODULES // var bench = require( '@stdlib/bench' ); -var uniform = require( '@stdlib/random/base/uniform' ).factory; +var random = require( '@stdlib/random/base/random' ).factory; var isnan{{C_TYPE_SUFFIX}} = require( '@stdlib/math/base/assert/is-nan{{C_TYPE_SUFFIX}}' ); var pow = require( '@stdlib/math/base/special/pow' ); var {{TYPED_ARRAY_CTOR}} = require( '@stdlib/array/{{TYPED_ARRAY_DTYPE}}' ); @@ -31,7 +33,7 @@ var {{ALIAS}} = require( './../lib/main.js' ); // VARIABLES // -var rand = uniform( {{C_RAND_MIN}}, {{C_RAND_MAX}} ); +var rand = random( {{C_RAND_MIN}}, {{C_RAND_MAX}} ); // FUNCTIONS // diff --git a/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/benchmark/benchmark__native__js.txt b/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/benchmark/benchmark__native__js.txt index b61216acebbb..7beef6d1ab78 100644 --- a/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/benchmark/benchmark__native__js.txt +++ b/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/benchmark/benchmark__native__js.txt @@ -16,13 +16,15 @@ * limitations under the License. */ +/* THIS IS A GENERATED FILE. DO NOT EDIT DIRECTLY. */ + 'use strict'; // MODULES // var resolve = require( 'path' ).resolve; var bench = require( '@stdlib/bench' ); -var uniform = require( '@stdlib/random/base/uniform' ).factory; +var random = require( '@stdlib/random/base/random' ).factory; var isnan{{C_TYPE_SUFFIX}} = require( '@stdlib/math/base/assert/is-nan{{C_TYPE_SUFFIX}}' ); var pow = require( '@stdlib/math/base/special/pow' ); var {{TYPED_ARRAY_CTOR}} = require( '@stdlib/array/{{TYPED_ARRAY_DTYPE}}' ); @@ -36,7 +38,7 @@ var {{ALIAS}} = tryRequire( resolve( __dirname, './../lib/{{ALIAS_SNAKECASE}}.na var opts = { 'skip': ( {{ALIAS}} instanceof Error ) }; -var rand = uniform( {{C_RAND_MIN}}, {{C_RAND_MAX}} ); +var rand = random( {{C_RAND_MIN}}, {{C_RAND_MAX}} ); // FUNCTIONS // diff --git a/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/benchmark/benchmark__ndarray__js.txt b/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/benchmark/benchmark__ndarray__js.txt index 24aa1f188250..906dc58a271e 100644 --- a/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/benchmark/benchmark__ndarray__js.txt +++ b/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/benchmark/benchmark__ndarray__js.txt @@ -16,12 +16,14 @@ * limitations under the License. */ +/* THIS IS A GENERATED FILE. DO NOT EDIT DIRECTLY. */ + 'use strict'; // MODULES // var bench = require( '@stdlib/bench' ); -var uniform = require( '@stdlib/random/base/uniform' ).factory; +var random = require( '@stdlib/random/base/random' ).factory; var isnan{{C_TYPE_SUFFIX}} = require( '@stdlib/math/base/assert/is-nan{{C_TYPE_SUFFIX}}' ); var pow = require( '@stdlib/math/base/special/pow' ); var {{TYPED_ARRAY_CTOR}} = require( '@stdlib/array/{{TYPED_ARRAY_DTYPE}}' ); @@ -31,7 +33,7 @@ var {{ALIAS}} = require( './../lib/ndarray.js' ); // VARIABLES // -var rand = uniform( {{C_RAND_MIN}}, {{C_RAND_MAX}} ); +var rand = random( {{C_RAND_MIN}}, {{C_RAND_MAX}} ); // FUNCTIONS // diff --git a/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/benchmark/benchmark__ndarray__native__js.txt b/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/benchmark/benchmark__ndarray__native__js.txt index e37bb8fb755a..31ea98eccf73 100644 --- a/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/benchmark/benchmark__ndarray__native__js.txt +++ b/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/benchmark/benchmark__ndarray__native__js.txt @@ -16,13 +16,15 @@ * limitations under the License. */ +/* THIS IS A GENERATED FILE. DO NOT EDIT DIRECTLY. */ + 'use strict'; // MODULES // var resolve = require( 'path' ).resolve; var bench = require( '@stdlib/bench' ); -var uniform = require( '@stdlib/random/base/uniform' ).factory; +var random = require( '@stdlib/random/base/random' ).factory; var isnan{{C_TYPE_SUFFIX}} = require( '@stdlib/math/base/assert/is-nan{{C_TYPE_SUFFIX}}' ); var pow = require( '@stdlib/math/base/special/pow' ); var {{TYPED_ARRAY_CTOR}} = require( '@stdlib/array/{{TYPED_ARRAY_DTYPE}}' ); @@ -36,7 +38,7 @@ var {{ALIAS}} = tryRequire( resolve( __dirname, './../lib/ndarray.native.js' ) ) var opts = { 'skip': ( {{ALIAS}} instanceof Error ) }; -var rand = uniform( {{C_RAND_MIN}}, {{C_RAND_MAX}} ); +var rand = random( {{C_RAND_MIN}}, {{C_RAND_MAX}} ); // FUNCTIONS // diff --git a/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/benchmark/c/Makefile.txt b/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/benchmark/c/Makefile.txt index 93073ba41e89..9410f95fd3ca 100644 --- a/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/benchmark/c/Makefile.txt +++ b/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/benchmark/c/Makefile.txt @@ -16,6 +16,8 @@ # limitations under the License. #/ +# THIS IS A GENERATED FILE. DO NOT EDIT DIRECTLY. + # VARIABLES # ifndef VERBOSE diff --git a/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/benchmark/c/benchmark__length__c.txt b/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/benchmark/c/benchmark__length__c.txt index b87f559d63a9..5e18928eda37 100644 --- a/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/benchmark/c/benchmark__length__c.txt +++ b/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/benchmark/c/benchmark__length__c.txt @@ -16,6 +16,8 @@ * limitations under the License. */ +/* THIS IS A GENERATED FILE. DO NOT EDIT DIRECTLY. */ + /** * Benchmark `{{ALIAS_SNAKECASE}}`. */ @@ -85,7 +87,7 @@ double tic() { * * @param a minimum value * @param b maximum value -* @return random number +* @return random number */ double rand_uniform( double a, double b ) { double x; @@ -102,7 +104,7 @@ double rand_uniform( double a, double b ) { * * @param a minimum value * @param b maximum value -* @return random number +* @return random number */ float rand_uniformf( float a, float b ) { return (float)rand_uniform( (double)a, (double)b ); @@ -113,7 +115,7 @@ float rand_uniformf( float a, float b ) { * * @param iterations number of iterations * @param len array length -* @return elapsed time in seconds +* @return elapsed time in seconds */ double benchmark( int iterations, int len ) { double elapsed; diff --git a/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/binding__gyp.txt b/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/binding__gyp.txt index 7f5fd3dface7..0762d20fb24a 100644 --- a/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/binding__gyp.txt +++ b/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/binding__gyp.txt @@ -14,6 +14,8 @@ # See the License for the specific language governing permissions and # limitations under the License. +# THIS IS A GENERATED FILE. DO NOT EDIT DIRECTLY. + # A `.gyp` file for building a Node.js native add-on. # # [1]: https://gyp.gsrc.io/docs/InputFormatReference.md diff --git a/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/docs/types/index__d__ts.txt b/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/docs/types/index__d__ts.txt index 381379d8bf7b..03591c0f5f44 100644 --- a/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/docs/types/index__d__ts.txt +++ b/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/docs/types/index__d__ts.txt @@ -16,6 +16,8 @@ * limitations under the License. */ +/* THIS IS A GENERATED FILE. DO NOT EDIT DIRECTLY. */ + // TypeScript Version: 4.1 /** diff --git a/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/docs/types/test__ts.txt b/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/docs/types/test__ts.txt index 7362eb6e92ea..03e0d3861c11 100644 --- a/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/docs/types/test__ts.txt +++ b/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/docs/types/test__ts.txt @@ -16,6 +16,8 @@ * limitations under the License. */ +/* THIS IS A GENERATED FILE. DO NOT EDIT DIRECTLY. */ + import {{ALIAS}} = require( './index' ); diff --git a/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/examples/c/Makefile.txt b/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/examples/c/Makefile.txt index e90df47594d9..746c2ee5bcf2 100644 --- a/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/examples/c/Makefile.txt +++ b/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/examples/c/Makefile.txt @@ -16,6 +16,8 @@ # limitations under the License. #/ +# THIS IS A GENERATED FILE. DO NOT EDIT DIRECTLY. + # VARIABLES # ifndef VERBOSE diff --git a/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/examples/c/example__c.txt b/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/examples/c/example__c.txt index 2d04cd9ac13e..61f92a5d118c 100644 --- a/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/examples/c/example__c.txt +++ b/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/examples/c/example__c.txt @@ -16,6 +16,8 @@ * limitations under the License. */ +/* THIS IS A GENERATED FILE. DO NOT EDIT DIRECTLY. */ + #include "{{PKG_INCLUDE}}.h" #include #include diff --git a/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/examples/index__js.txt b/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/examples/index__js.txt index 4354cbcb8a86..981278d2de59 100644 --- a/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/examples/index__js.txt +++ b/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/examples/index__js.txt @@ -16,6 +16,8 @@ * limitations under the License. */ +/* THIS IS A GENERATED FILE. DO NOT EDIT DIRECTLY. */ + 'use strict'; var uniform = require( '@stdlib/random/base/uniform' ); diff --git a/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/include/alias__h.txt b/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/include/alias__h.txt index 6abd68f28d53..8999ec31a2ae 100644 --- a/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/include/alias__h.txt +++ b/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/include/alias__h.txt @@ -16,6 +16,8 @@ * limitations under the License. */ +/* THIS IS A GENERATED FILE. DO NOT EDIT DIRECTLY. */ + #ifndef {{C_HEADER_GUARD}}_H #define {{C_HEADER_GUARD}}_H diff --git a/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/include__gypi.txt b/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/include__gypi.txt index 9fad714bbcf4..570b6a5a75fa 100644 --- a/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/include__gypi.txt +++ b/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/include__gypi.txt @@ -14,6 +14,8 @@ # See the License for the specific language governing permissions and # limitations under the License. +# THIS IS A GENERATED FILE. DO NOT EDIT DIRECTLY. + # A GYP include file for building a Node.js native add-on. # # Main documentation: diff --git a/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/lib/alias__js.txt b/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/lib/alias__js.txt index f21ee9027853..47ba1b4a8f3a 100644 --- a/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/lib/alias__js.txt +++ b/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/lib/alias__js.txt @@ -16,6 +16,8 @@ * limitations under the License. */ +/* THIS IS A GENERATED FILE. DO NOT EDIT DIRECTLY. */ + 'use strict'; // MODULES // diff --git a/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/lib/alias__native__js.txt b/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/lib/alias__native__js.txt index d445de089bc9..8858ae9f9ce9 100644 --- a/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/lib/alias__native__js.txt +++ b/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/lib/alias__native__js.txt @@ -16,6 +16,8 @@ * limitations under the License. */ +/* THIS IS A GENERATED FILE. DO NOT EDIT DIRECTLY. */ + 'use strict'; // MODULES // diff --git a/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/lib/index__js.txt b/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/lib/index__js.txt index 417fd0d7e531..297d211ec8ef 100644 --- a/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/lib/index__js.txt +++ b/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/lib/index__js.txt @@ -16,6 +16,8 @@ * limitations under the License. */ +/* THIS IS A GENERATED FILE. DO NOT EDIT DIRECTLY. */ + 'use strict'; /** diff --git a/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/lib/main__js.txt b/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/lib/main__js.txt index 019b9d5cccd0..51af4dd868e7 100644 --- a/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/lib/main__js.txt +++ b/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/lib/main__js.txt @@ -16,6 +16,8 @@ * limitations under the License. */ +/* THIS IS A GENERATED FILE. DO NOT EDIT DIRECTLY. */ + 'use strict'; // MODULES // diff --git a/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/lib/native__js.txt b/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/lib/native__js.txt index a2ae3f80f483..278fed21eef1 100644 --- a/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/lib/native__js.txt +++ b/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/lib/native__js.txt @@ -16,6 +16,8 @@ * limitations under the License. */ +/* THIS IS A GENERATED FILE. DO NOT EDIT DIRECTLY. */ + 'use strict'; // MODULES // diff --git a/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/lib/ndarray__js.txt b/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/lib/ndarray__js.txt index 2abdcb75701d..8aeab1da073f 100644 --- a/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/lib/ndarray__js.txt +++ b/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/lib/ndarray__js.txt @@ -16,6 +16,8 @@ * limitations under the License. */ +/* THIS IS A GENERATED FILE. DO NOT EDIT DIRECTLY. */ + 'use strict'; // MODULES // diff --git a/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/lib/ndarray__native__js.txt b/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/lib/ndarray__native__js.txt index 565e9a0ef037..7d96bb688414 100644 --- a/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/lib/ndarray__native__js.txt +++ b/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/lib/ndarray__native__js.txt @@ -16,6 +16,8 @@ * limitations under the License. */ +/* THIS IS A GENERATED FILE. DO NOT EDIT DIRECTLY. */ + 'use strict'; // MODULES // diff --git a/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/src/Makefile.txt b/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/src/Makefile.txt index a64cc31f1b68..ae754ac00082 100644 --- a/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/src/Makefile.txt +++ b/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/src/Makefile.txt @@ -16,6 +16,8 @@ # limitations under the License. #/ +# THIS IS A GENERATED FILE. DO NOT EDIT DIRECTLY. + # VARIABLES # ifndef VERBOSE diff --git a/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/src/addon__c.txt b/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/src/addon__c.txt index 956707e00f1e..c22298fbda28 100644 --- a/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/src/addon__c.txt +++ b/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/src/addon__c.txt @@ -16,6 +16,8 @@ * limitations under the License. */ +/* THIS IS A GENERATED FILE. DO NOT EDIT DIRECTLY. */ + #include "stdlib/strided/napi/{{STRIDED_APPLY_ALIAS}}.h" #include "{{UNARY_PKG_INCLUDE}}.h" diff --git a/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/src/alias__c.txt b/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/src/alias__c.txt index 28cc7d177f2b..e2dfd5c704ff 100644 --- a/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/src/alias__c.txt +++ b/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/src/alias__c.txt @@ -16,6 +16,8 @@ * limitations under the License. */ +/* THIS IS A GENERATED FILE. DO NOT EDIT DIRECTLY. */ + #include "{{PKG_INCLUDE}}.h" #include "stdlib/strided/base/{{STRIDED_APPLY_ALIAS}}.h" #include "{{UNARY_PKG_INCLUDE}}.h" diff --git a/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/test/test__alias__js.txt b/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/test/test__alias__js.txt index cbbb72b0ff6c..24712d362d1c 100644 --- a/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/test/test__alias__js.txt +++ b/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/test/test__alias__js.txt @@ -16,6 +16,8 @@ * limitations under the License. */ +/* THIS IS A GENERATED FILE. DO NOT EDIT DIRECTLY. */ + 'use strict'; // MODULES // diff --git a/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/test/test__alias__native__js.txt b/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/test/test__alias__native__js.txt index 898ca55b6d57..8e396efece53 100644 --- a/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/test/test__alias__native__js.txt +++ b/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/test/test__alias__native__js.txt @@ -16,6 +16,8 @@ * limitations under the License. */ +/* THIS IS A GENERATED FILE. DO NOT EDIT DIRECTLY. */ + 'use strict'; // MODULES // diff --git a/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/test/test__js.txt b/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/test/test__js.txt index 91db0ffb7032..c12481d5964b 100644 --- a/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/test/test__js.txt +++ b/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/test/test__js.txt @@ -16,6 +16,8 @@ * limitations under the License. */ +/* THIS IS A GENERATED FILE. DO NOT EDIT DIRECTLY. */ + 'use strict'; // MODULES // diff --git a/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/test/test__ndarray__js.txt b/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/test/test__ndarray__js.txt index 2ed6182307ad..0ecac6ca9dcf 100644 --- a/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/test/test__ndarray__js.txt +++ b/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/test/test__ndarray__js.txt @@ -16,6 +16,8 @@ * limitations under the License. */ +/* THIS IS A GENERATED FILE. DO NOT EDIT DIRECTLY. */ + 'use strict'; // MODULES // diff --git a/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/test/test__ndarray__native__js.txt b/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/test/test__ndarray__native__js.txt index 1e4b17df46ba..2ad50944ca3f 100644 --- a/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/test/test__ndarray__native__js.txt +++ b/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/test/test__ndarray__native__js.txt @@ -16,6 +16,8 @@ * limitations under the License. */ +/* THIS IS A GENERATED FILE. DO NOT EDIT DIRECTLY. */ + 'use strict'; // MODULES // diff --git a/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/scripts/data.json b/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/scripts/data.json new file mode 100644 index 000000000000..86110e6ba6df --- /dev/null +++ b/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/scripts/data.json @@ -0,0 +1,149 @@ +[ + { + "$schema": "math/base@v1.0", + "base_alias": "cbrt", + "alias": "cbrt", + "pkg_desc": "compute the cube root", + "desc": "computes the cube root", + "short_desc": "cube root", + "parameters": [ + { + "name": "x", + "desc": "input value", + "type": { + "javascript": "number", + "jsdoc": "number", + "c": "double", + "dtype": "float64" + }, + "domain": [ + { + "min": "-infinity", + "max": "infinity" + } + ], + "rand": { + "prng": "random/base/uniform", + "parameters": [ + -10, + 10 + ] + }, + "example_values": [ + 64, + 27, + 0, + 0, + -9, + 8, + -1, + 125, + -10.2, + 11.3, + -12.4, + 3.5, + -1.6, + 15.7, + -16, + 17.9, + -188, + 19.11, + -200, + 21.15 + ] + } + ], + "returns": { + "desc": "cube root", + "type": { + "javascript": "number", + "jsdoc": "number", + "c": "double", + "dtype": "float64" + } + }, + "keywords": [ + "cube", + "root", + "cbrt", + "cubic", + "power" + ], + "extra_keywords": [ + "math.cbrt" + ] + }, + { + "$schema": "math/base@v1.0", + "base_alias": "exp", + "alias": "exp", + "pkg_desc": "evaluate the natural exponential function", + "desc": "evaluates the natural exponential function", + "short_desc": "natural exponential function", + "parameters": [ + { + "name": "x", + "desc": "input value", + "type": { + "javascript": "number", + "jsdoc": "number", + "c": "double", + "dtype": "float64" + }, + "domain": [ + { + "min": "-infinity", + "max": "infinity" + } + ], + "rand": { + "prng": "random/base/uniform", + "parameters": [ + -10, + 10 + ] + }, + "example_values": [ + -1.2, + 2, + -3.1, + -4.7, + 5.5, + 6.7, + 8.9, + -10.2, + 11.3, + -12.4, + 13.5, + 14.6, + -15.7, + 16.8, + -17.9, + 18.1, + -19.11, + 20.12, + -21.15, + 23.78 + ] + } + ], + "returns": { + "desc": "function value", + "type": { + "javascript": "number", + "jsdoc": "number", + "c": "double", + "dtype": "float64" + } + }, + "keywords": [ + "natural", + "exponential", + "exp", + "power" + ], + "extra_keywords": [ + "math.exp" + ] + } +] diff --git a/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/scripts/generate_data.js b/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/scripts/generate_data.js new file mode 100644 index 000000000000..1cada68fe587 --- /dev/null +++ b/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/scripts/generate_data.js @@ -0,0 +1,79 @@ +#!/usr/bin/env node + +/** +* @license Apache-2.0 +* +* Copyright (c) 2024 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 resolve = require( 'path' ).resolve; +var findPkgs = require( '@stdlib/_tools/pkgs/find' ).sync; +var readJSON = require( '@stdlib/fs/read-json' ).sync; +var writeFile = require( '@stdlib/fs/write-file' ).sync; +var rootDir = require( '@stdlib/_tools/utils/root-dir' ); + + +// VARIABLES // + +var ROOT_DIR = rootDir(); +var opts = { + 'encoding': 'utf8' +}; + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var path; + var json; + var pkgs; + var out; + var o; + var i; + + // Resolve unary "special" math packages: + pkgs = findPkgs({ + 'dir': ROOT_DIR, + 'pattern': '**/math/base/special/*/package.json' + }); + + // Filter for package's containing scaffold metadata and which have unary APIs... + out = []; + for ( i = 0; i < pkgs.length; i++ ) { + path = resolve( ROOT_DIR, pkgs[i] ); + json = readJSON( resolve( path, 'package.json' ), opts ); + if ( json instanceof Error ) { + console.error( 'Encountered an error when attempting to read package: %s. Error: %s.', pkgs[ i ], json.message ); + continue; + } + o = json.__stdlib__; // eslint-disable-line no-underscore-dangle + if ( o && o.scaffold && o.scaffold.parameters.length === 1 ) { + out.push( o.scaffold ); + } + } + // Write the metadata to a local file for subsequent consumption by other scripts: + writeFile( resolve( __dirname, 'data.json' ), JSON.stringify( out, null, ' ' )+'\n', opts ); +} + +main(); diff --git a/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/scripts/runner.js b/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/scripts/runner.js new file mode 100644 index 000000000000..bd50d3fdf7ac --- /dev/null +++ b/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/scripts/runner.js @@ -0,0 +1,279 @@ +#!/usr/bin/env node + +/** +* @license Apache-2.0 +* +* Copyright (c) 2024 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 resolve = require( 'path' ).resolve; +var shell = require( 'child_process' ).execSync; // eslint-disable-line node/no-sync +var existsSync = require( '@stdlib/fs/exists' ).sync; +var objectKeys = require( '@stdlib/utils/keys' ); +var rootDir = require( '@stdlib/_tools/utils/root-dir' ); +var log = require( '@stdlib/console/log' ); +var capitalize = require( '@stdlib/string/capitalize' ); +var isInteger = require( '@stdlib/math/base/assert/is-integer' ); +var isRealFloatingDataType = require( '@stdlib/array/base/assert/is-real-floating-point-data-type' ); +var DATA = require( './data.json' ); + + +// VARIABLES // + +var CREATE_ONLY = 1; +var SCAFFOLD_SCRIPT = resolve( __dirname, 'scaffold.sh' ); +var ROOT_DIR = resolve( rootDir(), 'lib', 'node_modules' ); + + +// FUNCTIONS // + +/** +* Returns an `ALIAS` environment variable string. +* +* @private +* @param {string} alias - package alias +* @returns {string} environment variable string +* +* @example +* var s = aliasEnvVar( 'abs' ); +* // returns 'ALIAS=abs' +* +* @example +* var s = aliasEnvVar( 'absf' ); +* // returns 'ALIAS=absf' +*/ +function aliasEnvVar( alias ) { + return 'ALIAS=' + alias; +} + +/** +* Returns a `DESC` environment variable string. +* +* @private +* @param {string} desc - default description +* @returns {string} environment variable string +* +* @example +* var s = descEnvVar( 'computes the cube root' ); +* // returns 'DESC=\'computes the cube root\'' +*/ +function descEnvVar( desc ) { + return 'DESC=\'' + desc + '\''; +} + +/** +* Returns a `DESC_LINK_TEXT` environment variable string. +* +* @private +* @param {string} desc - short description +* @returns {string} environment variable string +* +* @example +* var s = linkTextEnvVar( 'cube root' ); +* // returns 'DESC_LINK_TEXT=\'cube root\'' +* +* @example +* var s = linkTextEnvVar( '' ); +* // returns '' +*/ +function linkTextEnvVar( desc ) { + if ( desc === '' ) { + return ''; + } + return 'DESC_LINK_TEXT=\'' + capitalize( desc ) + '\''; +} + +/** +* Returns a `KEYWORDS` environment variable string. +* +* @private +* @param {StringArray} keywords - list of keywords +* @returns {string} environment variable string +* +* @example +* var keywords = [ 'math', 'special' ]; +* +* var s = keywordsEnvVar( keywords ); +* // returns 'KEYWORDS=\'math,special\'' +*/ +function keywordsEnvVar( keywords ) { + return 'KEYWORDS=\'' + keywords.join( ',' ) + '\''; +} + +/** +* Returns a `C_X_VALUES_LEN_8` environment variable string. +* +* @private +* @param {NumberArray} values - example values +* @param {string} dtype - values data type +* @returns {string} environment variable string +* +* @example +* var values = [ 1, 2, 3, 4, 5, 6, 7, 8 ]; +* +* var s = valuesEnvVar( values, 'int32' ); +* // returns 'C_X_VALUES_LEN_8=\'1,2,3,4,5,6,7,8\'' +*/ +function valuesEnvVar( values, dtype ) { + var vals; + var v; + var i; + + if ( isRealFloatingDataType( dtype ) ) { + vals = []; + for ( i = 0; i < 8; i++ ) { + v = values[ i ]; + vals.push( v.toString() ); + if ( isInteger( v ) ) { + vals[ i ] += '.0'; + } + } + } else { + vals = values.slice( 0, 8 ); + } + return 'C_X_VALUES_LEN_8=\'' + vals.join( ',' ) + '\''; +} + +/** +* Returns a string containing environment variable for generating pseudorandom numbers. +* +* @private +* @param {Object} obj - configuration object +* @returns {string} environment variable string +* +* @example +* var o = { +* 'prng': 'random/base/uniform', +* 'parameters': [ -100, 100 ] +* }; +* +* var s = prngEnvVars( o ); +* // returns 'BASE_PRNG=\'uniform\',RAND_MIN=-100,RAND_MAX=100' +*/ +function prngEnvVars( obj ) { + var base; + var min; + var max; + var p; + + p = obj.prng.split( '/' ); + base = p[ p.length-1 ]; + min = obj.parameters[ 0 ]; + max = obj.parameters[ 1 ]; + if ( base === 'uniform' ) { + if ( isInteger( min ) ) { + min = min.toString() + '.0'; + } + if ( isInteger( max ) ) { + max = max.toString() + '.0'; + } + } else { + min = min.toString(); + max = max.toString(); + } + return [ + 'BASE_PRNG=\'' + base + '\'', + 'C_RAND_MIN=' + min, + 'C_RAND_MAX=' + max + ].join( ' ' ); +} + +/** +* Returns a `JAVASCRIPT_RETURN_TYPE` environment variable string. +* +* @private +* @param {string} dt - return type +* @returns {string} environment variable string +* +* @example +* var s = returnTypeEnvVar( 'number' ); +* // returns 'JAVASCRIPT_RETURN_TYPE=\'number\'' +*/ +function returnTypeEnvVar( dt ) { + return 'JAVASCRIPT_RETURN_TYPE=\'' + dt + '\''; +} + + +// MAIN // + +/** +* Main execution sequence. +* +* @private +*/ +function main() { + var keys; + var envs; + var cmd; + var p; + var k; + var v; + var o; + var i; + var j; + + for ( i = 0; i < DATA.length; i++ ) { + o = DATA[ i ]; + p = resolve( ROOT_DIR, '@stdlib/math/strided/special', o.alias, 'package.json' ); + if ( existsSync( p ) ) { + if ( CREATE_ONLY ) { + log( 'Package already exists. Skipping @%s...', 'stdlib/math/strided/special/' + o.alias ); + continue; + } + log( 'Updating package: @%s...', 'stdlib/math/strided/special/' + o.alias ); + } else { + log( 'Creating package: @%s...', 'stdlib/math/strided/special/' + o.alias ); + } + keys = objectKeys( o ); + envs = []; + for ( j = 0; j < keys.length; j++ ) { + k = keys[ j ]; + v = o[ k ]; + if ( k === 'alias' ) { + envs.push( aliasEnvVar( v ) ); + continue; + } + if ( k === 'desc' ) { + envs.push( descEnvVar( v ) ); + continue; + } + if ( k === 'short_desc' ) { + envs.push( linkTextEnvVar( v ) ); + continue; + } + if ( k === 'keywords' ) { + envs.push( keywordsEnvVar( v ) ); + continue; + } + if ( k === 'parameters' ) { + envs.push( valuesEnvVar( v[ 0 ].example_values, v[ 0 ].type.dtype ) ); // eslint-disable-line max-len + envs.push( prngEnvVars( v[ 0 ].rand ) ); + continue; + } + if ( k === 'returns' ) { + envs.push( returnTypeEnvVar( v.type.javascript ) ); + continue; + } + } + cmd = envs.join( ' ' ) + ' . ' + SCAFFOLD_SCRIPT; + shell( cmd ); + } +} + +main(); diff --git a/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/scripts/scaffold.sh b/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/scripts/scaffold.sh index 7dd8f794ef70..440d3f117fab 100755 --- a/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/scripts/scaffold.sh +++ b/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/scripts/scaffold.sh @@ -22,61 +22,65 @@ # # Environment Variables: # -# ALIAS Main export alias. -# PKG_DESC Package description. -# MODULE_DESC Module description. -# MAIN_DESC Main export description. -# TEST_DESC Test description. -# DESC_LINK_TEXT README link text. -# KEYWORDS List of keywords. -# C_RAND_MIN Minimum value for generated values. -# C_RAND_MAX Maximum value for generated values. -# C_X_VALUES_LEN_8 List of input values. +# ALIAS Main export alias. +# DESC Default description. +# PKG_DESC Package description. +# MODULE_DESC Module description. +# MAIN_DESC Main export description. +# TEST_DESC Test description. +# DESC_LINK_TEXT README link text. +# KEYWORDS List of keywords. +# BASE_PRNG Base name of the package for generating pseudorandom numbers. +# C_RAND_MIN Minimum value for generated values. +# C_RAND_MAX Maximum value for generated values. +# C_X_VALUES_LEN_8 List of input values. +# JAVASCRIPT_RETURN_TYPE JavaScript return value data type. # ## USER-DEFINED VARIABLES ## # Define the main export alias: -alias=${ALIAS:-'ddiracDelta'} +alias=${ALIAS:-'TODO'} # Define the package description: # shellcheck disable=SC2016 -pkg_desc=${PKG_DESC:-'Evaluate the Dirac delta function for each element in a STRIDED_TYPED_ARRAY.'} +pkg_desc=${PKG_DESC:-"${DESC:-'TODO'} for each element in a STRIDED_TYPED_ARRAY."} +pkg_desc=$(echo "${pkg_desc}" | awk '{print toupper(substr($0,1,1)) substr($0,2)}') # Define the module description: # shellcheck disable=SC2016 -module_desc=${MODULE_DESC:-'Evaluate the Dirac delta function for each element in a STRIDED_TYPED_ARRAY `x` and assign the results to elements in a STRIDED_TYPED_ARRAY `y`.'} +module_desc=${MODULE_DESC:-"${DESC:-'TODO'} for each element in a STRIDED_TYPED_ARRAY \`x\` and assign the results to elements in a STRIDED_TYPED_ARRAY \`y\`."} +module_desc=$(echo "${module_desc}" | awk '{print toupper(substr($0,1,1)) substr($0,2)}') # Define main export description: # shellcheck disable=SC2016 -main_desc=${MAIN_DESC:-'Evaluates the Dirac delta function for each element in a STRIDED_TYPED_ARRAY `x` and assigns the results to elements in a STRIDED_TYPED_ARRAY `y`.'} +main_desc=${MAIN_DESC:-"${DESC:-'TODO'} for each element in a STRIDED_TYPED_ARRAY \`x\` and assigns the results to elements in a STRIDED_TYPED_ARRAY \`y\`."} +main_desc=$(echo "${main_desc}" | awk '{print toupper(substr($0,1,1)) substr($0,2)}') # Define the test description: # shellcheck disable=SC2016 -test_desc=${TEST_DESC:-'evaluates the Dirac delta function for each element'} +test_desc=${TEST_DESC:-"${DESC:-'TODO'} for each element"} # Define description text (found in the README) which should be a link to the unary package (NOTE: to not include a link, set to an empty string): -desc_link_text=${DESC_LINK_TEXT:-'Dirac delta function'} +desc_link_text=${DESC_LINK_TEXT:-''} # Define a list of keywords: if [[ -z "${KEYWORDS:-}" ]]; then keywords=( - "stdmath" - "mathematics" - "math" - "dirac" - "delta" - "distribution" - "dist" - "continuous" - "kronecker" - "spike" - "impulse" + "stdmath" + "mathematics" + "math" ) else IFS=','; read -ra keywords <<< "${KEYWORDS}"; IFS=' '; fi +# Define the JavaScript return data type: +javascript_return_type=${JAVASCRIPT_RETURN_TYPE:-'number'} + +# Define a pseudorandom number generator for generating random values: +base_prng=${BASE_PRNG:-'uniform'} + # Define the minimum value of generated values when benchmarking and testing the implementation: c_rand_min=${C_RAND_MIN:-'-100.0'} @@ -140,7 +144,7 @@ this_dir="${base_dir}/@stdlib/_tools/scaffold/math-strided-real-typed-unary" wrap="${base_dir}/@stdlib/_tools/repl-txt/wrap-desc/bin/cli" # Define the unary function alias: -unary_alias="${alias:1}" +unary_alias="${alias}" if [ "${alias:0:1}" == "s" ]; then unary_alias="${unary_alias}f" fi @@ -459,6 +463,9 @@ find_and_replace "${regex}" regex="s/\\{\\{C_UNARY_ALIAS\\}\\}/${c_unary_alias}/g;" find_and_replace "${regex}" +regex="s/\\{\\{BASE_PRNG\\}\\}/${base_prng}/g;" +find_and_replace "${regex}" + regex="s/\\{\\{STRIDED_APPLY_ALIAS\\}\\}/${strided_apply_alias}/g;" find_and_replace "${regex}" @@ -489,6 +496,9 @@ find_and_replace "${regex}" regex="s/\\{\\{C_RAND_MAX\\}\\}/${c_rand_max}/g;" find_and_replace "${regex}" +regex="s/\\{\\{JAVASCRIPT_RETURN_TYPE\\}\\}/${javascript_return_type}/g;" +find_and_replace "${regex}" + keywords_sep='",\n "' if [ "${#keywords[*]}" -eq 0 ]; then words='' From 86ce5a7ac09c8447745734aed0e464bcea4173e9 Mon Sep 17 00:00:00 2001 From: GUNJ JOSHI Date: Sat, 19 Oct 2024 22:13:26 +0530 Subject: [PATCH 02/13] docs: make C benchmark functions static --- .../data/benchmark/c/benchmark__length__c.txt | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/benchmark/c/benchmark__length__c.txt b/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/benchmark/c/benchmark__length__c.txt index 5e18928eda37..dcab3b1d0725 100644 --- a/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/benchmark/c/benchmark__length__c.txt +++ b/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/benchmark/c/benchmark__length__c.txt @@ -37,7 +37,7 @@ /** * Prints the TAP version. */ -void print_version() { +static void print_version() { printf( "TAP version 13\n" ); } @@ -47,7 +47,7 @@ void print_version() { * @param total total number of tests * @param passing total number of passing tests */ -void print_summary( int total, int passing ) { +static void print_summary( int total, int passing ) { printf( "#\n" ); printf( "1..%d\n", total ); // TAP plan printf( "# total %d\n", total ); @@ -62,7 +62,7 @@ void print_summary( int total, int passing ) { * @param iterations number of iterations * @param elapsed elapsed time in seconds */ -void print_results( int iterations, double elapsed ) { +static void print_results( int iterations, double elapsed ) { double rate = (double)iterations / elapsed; printf( " ---\n" ); printf( " iterations: %d\n", iterations ); @@ -76,7 +76,7 @@ void print_results( int iterations, double elapsed ) { * * @return clock time */ -double tic() { +static double tic() { struct timeval now; gettimeofday( &now, NULL ); return (double)now.tv_sec + (double)now.tv_usec/1.0e6; @@ -89,7 +89,7 @@ double tic() { * @param b maximum value * @return random number */ -double rand_uniform( double a, double b ) { +static double rand_uniform( double a, double b ) { double x; int r; @@ -106,7 +106,7 @@ double rand_uniform( double a, double b ) { * @param b maximum value * @return random number */ -float rand_uniformf( float a, float b ) { +static float rand_uniformf( float a, float b ) { return (float)rand_uniform( (double)a, (double)b ); } @@ -117,7 +117,7 @@ float rand_uniformf( float a, float b ) { * @param len array length * @return elapsed time in seconds */ -double benchmark( int iterations, int len ) { +static double benchmark( int iterations, int len ) { double elapsed; {{C_TYPE}} x[ len ]; {{C_TYPE}} y[ len ]; From de57b66063c11cbb92115f94db5e2f7a498d0b7a Mon Sep 17 00:00:00 2001 From: GUNJ JOSHI Date: Mon, 21 Oct 2024 10:15:02 +0530 Subject: [PATCH 03/13] docs: correct return annotation --- .../scaffold/math-strided-real-typed-unary/scripts/runner.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/scripts/runner.js b/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/scripts/runner.js index bd50d3fdf7ac..84ccbb313f98 100644 --- a/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/scripts/runner.js +++ b/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/scripts/runner.js @@ -164,7 +164,7 @@ function valuesEnvVar( values, dtype ) { * }; * * var s = prngEnvVars( o ); -* // returns 'BASE_PRNG=\'uniform\',RAND_MIN=-100,RAND_MAX=100' +* // returns 'BASE_PRNG=\'uniform\' RAND_MIN=-100 RAND_MAX=100' */ function prngEnvVars( obj ) { var base; From 23a6f7ba79621206bc2ff03b7ad999d100d75f9f Mon Sep 17 00:00:00 2001 From: GUNJ JOSHI Date: Mon, 21 Oct 2024 10:29:33 +0530 Subject: [PATCH 04/13] style: fix indentation --- .../scripts/scaffold.sh | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/scripts/scaffold.sh b/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/scripts/scaffold.sh index 440d3f117fab..46ed36bdb16c 100755 --- a/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/scripts/scaffold.sh +++ b/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/scripts/scaffold.sh @@ -22,18 +22,18 @@ # # Environment Variables: # -# ALIAS Main export alias. +# ALIAS Main export alias. # DESC Default description. -# PKG_DESC Package description. -# MODULE_DESC Module description. -# MAIN_DESC Main export description. -# TEST_DESC Test description. -# DESC_LINK_TEXT README link text. -# KEYWORDS List of keywords. +# PKG_DESC Package description. +# MODULE_DESC Module description. +# MAIN_DESC Main export description. +# TEST_DESC Test description. +# DESC_LINK_TEXT README link text. +# KEYWORDS List of keywords. # BASE_PRNG Base name of the package for generating pseudorandom numbers. -# C_RAND_MIN Minimum value for generated values. -# C_RAND_MAX Maximum value for generated values. -# C_X_VALUES_LEN_8 List of input values. +# C_RAND_MIN Minimum value for generated values. +# C_RAND_MAX Maximum value for generated values. +# C_X_VALUES_LEN_8 List of input values. # JAVASCRIPT_RETURN_TYPE JavaScript return value data type. # From d947aaedae8fca7a660b717e0854545c507a131e Mon Sep 17 00:00:00 2001 From: GUNJ JOSHI Date: Mon, 21 Oct 2024 10:42:23 +0530 Subject: [PATCH 05/13] docs: use base_alias instead of alias --- .../scaffold/math-strided-real-typed-unary/scripts/runner.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/scripts/runner.js b/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/scripts/runner.js index 84ccbb313f98..ea3f163d2e15 100644 --- a/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/scripts/runner.js +++ b/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/scripts/runner.js @@ -245,7 +245,7 @@ function main() { for ( j = 0; j < keys.length; j++ ) { k = keys[ j ]; v = o[ k ]; - if ( k === 'alias' ) { + if ( k === 'base_alias' ) { envs.push( aliasEnvVar( v ) ); continue; } From 1b7b15654a720a81a90b647f873c45f64020b564 Mon Sep 17 00:00:00 2001 From: GUNJ JOSHI Date: Mon, 21 Oct 2024 11:04:50 +0530 Subject: [PATCH 06/13] docs: revert change in unary alias --- .../scaffold/math-strided-real-typed-unary/scripts/scaffold.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/scripts/scaffold.sh b/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/scripts/scaffold.sh index 46ed36bdb16c..473c61e741f5 100755 --- a/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/scripts/scaffold.sh +++ b/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/scripts/scaffold.sh @@ -144,7 +144,7 @@ this_dir="${base_dir}/@stdlib/_tools/scaffold/math-strided-real-typed-unary" wrap="${base_dir}/@stdlib/_tools/repl-txt/wrap-desc/bin/cli" # Define the unary function alias: -unary_alias="${alias}" +unary_alias="${alias:1}" if [ "${alias:0:1}" == "s" ]; then unary_alias="${unary_alias}f" fi From 56a155b1218e6cde710582aac2ea24737506b07f Mon Sep 17 00:00:00 2001 From: GUNJ JOSHI Date: Mon, 21 Oct 2024 14:37:18 +0530 Subject: [PATCH 07/13] docs: use random/array/uniform to generate example values --- .../math-strided-real-typed-unary/data/README__md.txt | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/README__md.txt b/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/README__md.txt index d571bdb70627..f837d43f71f7 100644 --- a/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/README__md.txt +++ b/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/README__md.txt @@ -137,17 +137,15 @@ var y = new {{TYPED_ARRAY_CTOR}}( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] ); ```javascript -var random = require( '@stdlib/random/base/random' ); +var random = require( '@stdlib/random/array/uniform' ); var {{TYPED_ARRAY_CTOR}} = require( '@stdlib/array/{{TYPED_ARRAY_DTYPE}}' ); var {{ALIAS}} = require( '@{{PKG}}' ); -var x = new {{TYPED_ARRAY_CTOR}}( 10 ); +var x = random( 10, {{C_RAND_MIN}}, {{C_RAND_MAX}}, { + 'dtype': '{{TYPED_ARRAY_DTYPE}}' +}); var y = new {{TYPED_ARRAY_CTOR}}( 10 ); -var i; -for ( i = 0; i < x.length; i++ ) { - x[ i ] = random( {{C_RAND_MIN}}, {{C_RAND_MAX}} ); -} console.log( x ); console.log( y ); From 3708e44e139cc0c2277649fe388edf3188c5b7a5 Mon Sep 17 00:00:00 2001 From: GUNJ JOSHI Date: Tue, 22 Oct 2024 11:49:13 +0530 Subject: [PATCH 08/13] bench: remove manual logic, use array packages --- .../data/README__md.txt | 3 ++- .../data/benchmark/benchmark__js.txt | 17 ++++++----------- .../data/benchmark/benchmark__native__js.txt | 13 ++++++------- .../data/benchmark/benchmark__ndarray__js.txt | 17 ++++++----------- .../benchmark__ndarray__native__js.txt | 13 ++++++------- 5 files changed, 26 insertions(+), 37 deletions(-) diff --git a/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/README__md.txt b/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/README__md.txt index f837d43f71f7..60d22e53a111 100644 --- a/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/README__md.txt +++ b/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/README__md.txt @@ -138,13 +138,14 @@ var y = new {{TYPED_ARRAY_CTOR}}( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] ); ```javascript var random = require( '@stdlib/random/array/uniform' ); +var zeros = require( '@stdlib/array/zeros' ); var {{TYPED_ARRAY_CTOR}} = require( '@stdlib/array/{{TYPED_ARRAY_DTYPE}}' ); var {{ALIAS}} = require( '@{{PKG}}' ); var x = random( 10, {{C_RAND_MIN}}, {{C_RAND_MAX}}, { 'dtype': '{{TYPED_ARRAY_DTYPE}}' }); -var y = new {{TYPED_ARRAY_CTOR}}( 10 ); +var y = zeros( 10, '{{TYPED_ARRAY_DTYPE}}' ); console.log( x ); console.log( y ); diff --git a/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/benchmark/benchmark__js.txt b/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/benchmark/benchmark__js.txt index da1194763ae7..3e4f3e133b5f 100644 --- a/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/benchmark/benchmark__js.txt +++ b/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/benchmark/benchmark__js.txt @@ -23,7 +23,8 @@ // MODULES // var bench = require( '@stdlib/bench' ); -var random = require( '@stdlib/random/base/random' ).factory; +var random = require( '@stdlib/random/array/uniform' ); +var zeros = require( '@stdlib/array/zeros' ); var isnan{{C_TYPE_SUFFIX}} = require( '@stdlib/math/base/assert/is-nan{{C_TYPE_SUFFIX}}' ); var pow = require( '@stdlib/math/base/special/pow' ); var {{TYPED_ARRAY_CTOR}} = require( '@stdlib/array/{{TYPED_ARRAY_DTYPE}}' ); @@ -31,11 +32,6 @@ var pkg = require( './../package.json' ).name; var {{ALIAS}} = require( './../lib/main.js' ); -// VARIABLES // - -var rand = random( {{C_RAND_MIN}}, {{C_RAND_MAX}} ); - - // FUNCTIONS // /** @@ -50,11 +46,10 @@ function createBenchmark( len ) { var y; var i; - x = new {{TYPED_ARRAY_CTOR}}( len ); - y = new {{TYPED_ARRAY_CTOR}}( len ); - for ( i = 0; i < x.length; i++ ) { - x[ i ] = rand(); - } + x = random( len, {{C_RAND_MIN}}, {{C_RAND_MAX}}, { + 'dtype': '{{TYPED_ARRAY_DTYPE}}' + }); + y = zeros( len, '{{TYPED_ARRAY_DTYPE}}' ); return benchmark; /** diff --git a/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/benchmark/benchmark__native__js.txt b/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/benchmark/benchmark__native__js.txt index 7beef6d1ab78..25a0c105235e 100644 --- a/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/benchmark/benchmark__native__js.txt +++ b/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/benchmark/benchmark__native__js.txt @@ -24,7 +24,8 @@ var resolve = require( 'path' ).resolve; var bench = require( '@stdlib/bench' ); -var random = require( '@stdlib/random/base/random' ).factory; +var random = require( '@stdlib/random/array/uniform' ); +var zeros = require( '@stdlib/array/zeros' ); var isnan{{C_TYPE_SUFFIX}} = require( '@stdlib/math/base/assert/is-nan{{C_TYPE_SUFFIX}}' ); var pow = require( '@stdlib/math/base/special/pow' ); var {{TYPED_ARRAY_CTOR}} = require( '@stdlib/array/{{TYPED_ARRAY_DTYPE}}' ); @@ -38,7 +39,6 @@ var {{ALIAS}} = tryRequire( resolve( __dirname, './../lib/{{ALIAS_SNAKECASE}}.na var opts = { 'skip': ( {{ALIAS}} instanceof Error ) }; -var rand = random( {{C_RAND_MIN}}, {{C_RAND_MAX}} ); // FUNCTIONS // @@ -55,11 +55,10 @@ function createBenchmark( len ) { var y; var i; - x = new {{TYPED_ARRAY_CTOR}}( len ); - y = new {{TYPED_ARRAY_CTOR}}( len ); - for ( i = 0; i < x.length; i++ ) { - x[ i ] = rand(); - } + x = random( len, {{C_RAND_MIN}}, {{C_RAND_MAX}}, { + 'dtype': '{{TYPED_ARRAY_DTYPE}}' + }); + y = zeros( len, '{{TYPED_ARRAY_DTYPE}}' ); return benchmark; /** diff --git a/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/benchmark/benchmark__ndarray__js.txt b/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/benchmark/benchmark__ndarray__js.txt index 906dc58a271e..ad158b9ce9fc 100644 --- a/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/benchmark/benchmark__ndarray__js.txt +++ b/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/benchmark/benchmark__ndarray__js.txt @@ -23,7 +23,8 @@ // MODULES // var bench = require( '@stdlib/bench' ); -var random = require( '@stdlib/random/base/random' ).factory; +var random = require( '@stdlib/random/array/uniform' ); +var zeros = require( '@stdlib/array/zeros' ); var isnan{{C_TYPE_SUFFIX}} = require( '@stdlib/math/base/assert/is-nan{{C_TYPE_SUFFIX}}' ); var pow = require( '@stdlib/math/base/special/pow' ); var {{TYPED_ARRAY_CTOR}} = require( '@stdlib/array/{{TYPED_ARRAY_DTYPE}}' ); @@ -31,11 +32,6 @@ var pkg = require( './../package.json' ).name; var {{ALIAS}} = require( './../lib/ndarray.js' ); -// VARIABLES // - -var rand = random( {{C_RAND_MIN}}, {{C_RAND_MAX}} ); - - // FUNCTIONS // /** @@ -50,11 +46,10 @@ function createBenchmark( len ) { var y; var i; - x = new {{TYPED_ARRAY_CTOR}}( len ); - y = new {{TYPED_ARRAY_CTOR}}( len ); - for ( i = 0; i < x.length; i++ ) { - x[ i ] = rand(); - } + x = random( len, {{C_RAND_MIN}}, {{C_RAND_MAX}}, { + 'dtype': '{{TYPED_ARRAY_DTYPE}}' + }); + y = zeros( len, '{{TYPED_ARRAY_DTYPE}}' ); return benchmark; /** diff --git a/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/benchmark/benchmark__ndarray__native__js.txt b/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/benchmark/benchmark__ndarray__native__js.txt index 31ea98eccf73..035de63af01e 100644 --- a/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/benchmark/benchmark__ndarray__native__js.txt +++ b/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/benchmark/benchmark__ndarray__native__js.txt @@ -24,7 +24,8 @@ var resolve = require( 'path' ).resolve; var bench = require( '@stdlib/bench' ); -var random = require( '@stdlib/random/base/random' ).factory; +var random = require( '@stdlib/random/array/uniform' ); +var zeros = require( '@stdlib/array/zeros' ); var isnan{{C_TYPE_SUFFIX}} = require( '@stdlib/math/base/assert/is-nan{{C_TYPE_SUFFIX}}' ); var pow = require( '@stdlib/math/base/special/pow' ); var {{TYPED_ARRAY_CTOR}} = require( '@stdlib/array/{{TYPED_ARRAY_DTYPE}}' ); @@ -38,7 +39,6 @@ var {{ALIAS}} = tryRequire( resolve( __dirname, './../lib/ndarray.native.js' ) ) var opts = { 'skip': ( {{ALIAS}} instanceof Error ) }; -var rand = random( {{C_RAND_MIN}}, {{C_RAND_MAX}} ); // FUNCTIONS // @@ -55,11 +55,10 @@ function createBenchmark( len ) { var y; var i; - x = new {{TYPED_ARRAY_CTOR}}( len ); - y = new {{TYPED_ARRAY_CTOR}}( len ); - for ( i = 0; i < x.length; i++ ) { - x[ i ] = rand(); - } + x = random( len, {{C_RAND_MIN}}, {{C_RAND_MAX}}, { + 'dtype': '{{TYPED_ARRAY_DTYPE}}' + }); + y = zeros( len, '{{TYPED_ARRAY_DTYPE}}' ); return benchmark; /** From f02a0d6e48d96155b917b34c7016de4bf191070d Mon Sep 17 00:00:00 2001 From: GUNJ JOSHI Date: Tue, 22 Oct 2024 13:17:07 +0530 Subject: [PATCH 09/13] bench: remove manual logic, use array packages --- .../data/examples/index__js.txt | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/examples/index__js.txt b/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/examples/index__js.txt index 981278d2de59..bd462f674073 100644 --- a/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/examples/index__js.txt +++ b/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/examples/index__js.txt @@ -20,17 +20,15 @@ 'use strict'; -var uniform = require( '@stdlib/random/base/uniform' ); +var random = require( '@stdlib/random/array/uniform' ); +var zeros = require( '@stdlib/array/zeros' ); var {{TYPED_ARRAY_CTOR}} = require( '@stdlib/array/{{TYPED_ARRAY_DTYPE}}' ); var {{ALIAS}} = require( './../lib' ); -var x = new {{TYPED_ARRAY_CTOR}}( 10 ); -var y = new {{TYPED_ARRAY_CTOR}}( 10 ); - -var i; -for ( i = 0; i < x.length; i++ ) { - x[ i ] = uniform( {{C_RAND_MIN}}, {{C_RAND_MAX}} ); -} +var x = random( 10, {{C_RAND_MIN}}, {{C_RAND_MAX}}, { + 'dtype': '{{TYPED_ARRAY_DTYPE}}' +}); +var y = zeros( 10, '{{TYPED_ARRAY_DTYPE}}' ); console.log( x ); console.log( y ); From 6bcd19cc23fbb12dfaef8692d0a4eec2d79ca8e2 Mon Sep 17 00:00:00 2001 From: GUNJ JOSHI Date: Sat, 26 Oct 2024 14:07:56 +0530 Subject: [PATCH 10/13] docs: add type suffixes --- .../data/examples/c/example__c.txt | 2 +- .../math-strided-real-typed-unary/data/src/alias__c.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/examples/c/example__c.txt b/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/examples/c/example__c.txt index 61f92a5d118c..a98721e9d9ac 100644 --- a/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/examples/c/example__c.txt +++ b/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/examples/c/example__c.txt @@ -27,7 +27,7 @@ int main( void ) { const {{C_TYPE}} x[] = { {{C_X_VALUES_LEN_8}} }; // Create an output strided array: - {{C_TYPE}} y[] = { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 }; + {{C_TYPE}} y[] = { 0.0{{C_TYPE_SUFFIX}}, 0.0{{C_TYPE_SUFFIX}}, 0.0{{C_TYPE_SUFFIX}}, 0.0{{C_TYPE_SUFFIX}}, 0.0{{C_TYPE_SUFFIX}}, 0.0{{C_TYPE_SUFFIX}}, 0.0{{C_TYPE_SUFFIX}}, 0.0{{C_TYPE_SUFFIX}} }; // Specify the number of elements: const int64_t N = 4; diff --git a/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/src/alias__c.txt b/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/src/alias__c.txt index e2dfd5c704ff..b58715c9a057 100644 --- a/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/src/alias__c.txt +++ b/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/src/alias__c.txt @@ -39,7 +39,7 @@ * const {{C_TYPE}} x[] = { {{C_X_VALUES_LEN_8}} }; * * // Create an output strided array: -* {{C_TYPE}} y[] = { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 }; +* {{C_TYPE}} y[] = { 0.0{{C_TYPE_SUFFIX}}, 0.0{{C_TYPE_SUFFIX}}, 0.0{{C_TYPE_SUFFIX}}, 0.0{{C_TYPE_SUFFIX}}, 0.0{{C_TYPE_SUFFIX}}, 0.0{{C_TYPE_SUFFIX}}, 0.0{{C_TYPE_SUFFIX}}, 0.0{{C_TYPE_SUFFIX}} }; * * // Specify the number of elements: * const int64_t N = 4; From 7e0f5837c99c17c1e43ba1bc4e4280094ba07e01 Mon Sep 17 00:00:00 2001 From: Athan Reines Date: Fri, 15 Nov 2024 01:28:49 -0800 Subject: [PATCH 11/13] refactor: update scaffold --- .../data/benchmark/c/benchmark__length__c.txt | 3 - .../data/examples/c/example__c.txt | 11 +- .../data/examples/index__js.txt | 4 +- .../data/include/alias__h.txt | 9 +- .../data/manifest__json.txt | 174 ++++++++++-------- .../data/src/addon__c.txt | 3 +- .../data/src/alias__c.txt | 56 ------ .../data/src/main__c.txt | 92 +++++++++ .../scripts/runner.js | 1 + .../scripts/scaffold.sh | 26 ++- 10 files changed, 227 insertions(+), 152 deletions(-) delete mode 100644 lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/src/alias__c.txt create mode 100644 lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/src/main__c.txt diff --git a/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/benchmark/c/benchmark__length__c.txt b/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/benchmark/c/benchmark__length__c.txt index dcab3b1d0725..9a423f3063a3 100644 --- a/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/benchmark/c/benchmark__length__c.txt +++ b/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/benchmark/c/benchmark__length__c.txt @@ -18,9 +18,6 @@ /* THIS IS A GENERATED FILE. DO NOT EDIT DIRECTLY. */ -/** -* Benchmark `{{ALIAS_SNAKECASE}}`. -*/ #include "{{PKG_INCLUDE}}.h" #include #include diff --git a/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/examples/c/example__c.txt b/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/examples/c/example__c.txt index a98721e9d9ac..495103b72137 100644 --- a/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/examples/c/example__c.txt +++ b/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/examples/c/example__c.txt @@ -19,7 +19,6 @@ /* THIS IS A GENERATED FILE. DO NOT EDIT DIRECTLY. */ #include "{{PKG_INCLUDE}}.h" -#include #include int main( void ) { @@ -29,12 +28,12 @@ int main( void ) { // Create an output strided array: {{C_TYPE}} y[] = { 0.0{{C_TYPE_SUFFIX}}, 0.0{{C_TYPE_SUFFIX}}, 0.0{{C_TYPE_SUFFIX}}, 0.0{{C_TYPE_SUFFIX}}, 0.0{{C_TYPE_SUFFIX}}, 0.0{{C_TYPE_SUFFIX}}, 0.0{{C_TYPE_SUFFIX}}, 0.0{{C_TYPE_SUFFIX}} }; - // Specify the number of elements: - const int64_t N = 4; + // Specify the number of indexed elements: + const int N = 4; - // Specify the stride lengths: - const int64_t strideX = 2; - const int64_t strideY = 2; + // Specify stride lengths: + const int strideX = 2; + const int strideY = 2; // Compute the results: stdlib_strided_{{ALIAS_SNAKECASE}}( N, x, strideX, y, strideY ); diff --git a/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/examples/index__js.txt b/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/examples/index__js.txt index bd462f674073..6155cfecfba1 100644 --- a/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/examples/index__js.txt +++ b/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/examples/index__js.txt @@ -22,14 +22,14 @@ var random = require( '@stdlib/random/array/uniform' ); var zeros = require( '@stdlib/array/zeros' ); -var {{TYPED_ARRAY_CTOR}} = require( '@stdlib/array/{{TYPED_ARRAY_DTYPE}}' ); var {{ALIAS}} = require( './../lib' ); var x = random( 10, {{C_RAND_MIN}}, {{C_RAND_MAX}}, { 'dtype': '{{TYPED_ARRAY_DTYPE}}' }); -var y = zeros( 10, '{{TYPED_ARRAY_DTYPE}}' ); console.log( x ); + +var y = zeros( 10, '{{TYPED_ARRAY_DTYPE}}' ); console.log( y ); {{ALIAS}}.ndarray( x.length, x, 1, 0, y, -1, y.length-1 ); diff --git a/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/include/alias__h.txt b/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/include/alias__h.txt index 8999ec31a2ae..b458541ca04b 100644 --- a/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/include/alias__h.txt +++ b/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/include/alias__h.txt @@ -21,7 +21,7 @@ #ifndef {{C_HEADER_GUARD}}_H #define {{C_HEADER_GUARD}}_H -#include +#include "stdlib/blas/base/shared.h" /* * If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. @@ -33,7 +33,12 @@ extern "C" { /** * {{C_MAIN_DESC}} */ -void stdlib_strided_{{ALIAS_SNAKECASE}}( const int64_t N, const {{C_TYPE}} *X, const int64_t strideX, {{C_TYPE}} *Y, const int64_t strideY ); +void stdlib_strided_{{ALIAS_SNAKECASE}}( const CBLAS_INT N, const {{C_TYPE}} *X, const CBLAS_INT strideX, {{C_TYPE}} *Y, const CBLAS_INT strideY ); + +/** +* {{C_NDARRAY_DESC}} +*/ +void stdlib_strided_{{ALIAS_SNAKECASE}}_ndarray( const CBLAS_INT N, const {{C_TYPE}} *X, const CBLAS_INT strideX, const CBLAS_INT offsetX, {{C_TYPE}} *Y, const CBLAS_INT strideY, const CBLAS_INT offsetY ); #ifdef __cplusplus } diff --git a/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/manifest__json.txt b/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/manifest__json.txt index 07855a617a83..aebbee95e694 100644 --- a/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/manifest__json.txt +++ b/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/manifest__json.txt @@ -1,75 +1,103 @@ { - "options": { - "task": "build" - }, - "fields": [ - { - "field": "src", - "resolve": true, - "relative": true - }, - { - "field": "include", - "resolve": true, - "relative": true - }, - { - "field": "libraries", - "resolve": false, - "relative": false - }, - { - "field": "libpath", - "resolve": true, - "relative": false - } - ], - "confs": [ - { - "task": "build", - "src": [ - "./src/{{ALIAS_SNAKECASE}}.c" - ], - "include": [ - "./include" - ], - "libraries": [], - "libpath": [], - "dependencies": [ - "@{{UNARY_PKG}}", - "@stdlib/strided/base/{{STRIDED_APPLY_ALIAS}}", - "@stdlib/strided/napi/{{STRIDED_APPLY_ALIAS}}" - ] - }, - { - "task": "examples", - "src": [ - "./src/{{ALIAS_SNAKECASE}}.c" - ], - "include": [ - "./include" - ], - "libraries": [], - "libpath": [], - "dependencies": [ - "@{{UNARY_PKG}}", - "@stdlib/strided/base/{{STRIDED_APPLY_ALIAS}}" - ] - }, - { - "task": "benchmark", - "src": [ - "./src/{{ALIAS_SNAKECASE}}.c" - ], - "include": [ - "./include" - ], - "libraries": [], - "libpath": [], - "dependencies": [ - "@{{UNARY_PKG}}", - "@stdlib/strided/base/{{STRIDED_APPLY_ALIAS}}" - ] - } - ] + "options": { + "task": "build", + "wasm": false + }, + "fields": [ + { + "field": "src", + "resolve": true, + "relative": true + }, + { + "field": "include", + "resolve": true, + "relative": true + }, + { + "field": "libraries", + "resolve": false, + "relative": false + }, + { + "field": "libpath", + "resolve": true, + "relative": false + } + ], + "confs": [ + { + "task": "build", + "wasm": false, + "src": [ + "./src/main.c" + ], + "include": [ + "./include" + ], + "libraries": [], + "libpath": [], + "dependencies": [ + "@{{UNARY_PKG}}", + "@stdlib/strided/base/{{STRIDED_APPLY_ALIAS}}", + "@stdlib/strided/base/stride2offset", + "@stdlib/blas/base/shared", + "@stdlib/strided/napi/{{STRIDED_APPLY_ALIAS}}" + ] + }, + { + "task": "examples", + "wasm": false, + "src": [ + "./src/main.c" + ], + "include": [ + "./include" + ], + "libraries": [], + "libpath": [], + "dependencies": [ + "@{{UNARY_PKG}}", + "@stdlib/strided/base/{{STRIDED_APPLY_ALIAS}}", + "@stdlib/strided/base/stride2offset", + "@stdlib/blas/base/shared" + ] + }, + { + "task": "benchmark", + "wasm": false, + "src": [ + "./src/main.c" + ], + "include": [ + "./include" + ], + "libraries": [], + "libpath": [], + "dependencies": [ + "@{{UNARY_PKG}}", + "@stdlib/strided/base/{{STRIDED_APPLY_ALIAS}}", + "@stdlib/strided/base/stride2offset", + "@stdlib/blas/base/shared" + ] + }, + { + "task": "build", + "wasm": true, + "src": [ + "./src/main.c" + ], + "include": [ + "./include" + ], + "libraries": [], + "libpath": [], + "dependencies": [ + "@{{UNARY_PKG}}", + "@stdlib/strided/base/{{STRIDED_APPLY_ALIAS}}", + "@stdlib/strided/base/stride2offset", + "@stdlib/blas/base/shared" + ] + } + ] } diff --git a/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/src/addon__c.txt b/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/src/addon__c.txt index c22298fbda28..b499c465ec0d 100644 --- a/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/src/addon__c.txt +++ b/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/src/addon__c.txt @@ -21,4 +21,5 @@ #include "stdlib/strided/napi/{{STRIDED_APPLY_ALIAS}}.h" #include "{{UNARY_PKG_INCLUDE}}.h" -STDLIB_STRIDED_NAPI_MODULE_{{C_STRIDED_APPLY_MACRO_ALIAS}}( stdlib_{{C_UNARY_ALIAS}} ) +STDLIB_STRIDED_NAPI_MODULE_{{C_STRIDED_APPLY_MACRO_ALIAS}}( stdlib_{{C_UNARY_ALIAS}} ); +STDLIB_STRIDED_NAPI_MODULE_{{C_STRIDED_APPLY_MACRO_ALIAS}}_NDARRAY( stdlib_{{C_UNARY_ALIAS}} ); diff --git a/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/src/alias__c.txt b/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/src/alias__c.txt deleted file mode 100644 index b58715c9a057..000000000000 --- a/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/src/alias__c.txt +++ /dev/null @@ -1,56 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) {{YEAR}} {{COPYRIGHT}}. -* -* 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. -*/ - -/* THIS IS A GENERATED FILE. DO NOT EDIT DIRECTLY. */ - -#include "{{PKG_INCLUDE}}.h" -#include "stdlib/strided/base/{{STRIDED_APPLY_ALIAS}}.h" -#include "{{UNARY_PKG_INCLUDE}}.h" -#include - -/** -* {{C_MAIN_DESC}} -* -* @param N number of indexed elements -* @param X input array -* @param strideX X stride length -* @param Y destination array -* @param strideY Y stride length -* -* @example -* #include -* -* // Create an input strided array: -* const {{C_TYPE}} x[] = { {{C_X_VALUES_LEN_8}} }; -* -* // Create an output strided array: -* {{C_TYPE}} y[] = { 0.0{{C_TYPE_SUFFIX}}, 0.0{{C_TYPE_SUFFIX}}, 0.0{{C_TYPE_SUFFIX}}, 0.0{{C_TYPE_SUFFIX}}, 0.0{{C_TYPE_SUFFIX}}, 0.0{{C_TYPE_SUFFIX}}, 0.0{{C_TYPE_SUFFIX}}, 0.0{{C_TYPE_SUFFIX}} }; -* -* // Specify the number of elements: -* const int64_t N = 4; -* -* // Specify the stride lengths: -* const int64_t strideX = 2; -* const int64_t strideY = 2; -* -* // Compute the results: -* stdlib_strided_{{ALIAS_SNAKECASE}}( N, x, strideX, y, strideY ); -*/ -void stdlib_strided_{{ALIAS_SNAKECASE}}( const int64_t N, const {{C_TYPE}} *X, const int64_t strideX, {{C_TYPE}} *Y, const int64_t strideY ) { - stdlib_strided_{{STRIDED_APPLY_ALIAS}}( N, X, strideX, Y, strideY, stdlib_{{C_UNARY_ALIAS}} ); -} diff --git a/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/src/main__c.txt b/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/src/main__c.txt new file mode 100644 index 000000000000..c3b1053acbc7 --- /dev/null +++ b/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/data/src/main__c.txt @@ -0,0 +1,92 @@ +/** +* @license Apache-2.0 +* +* Copyright (c) {{YEAR}} {{COPYRIGHT}}. +* +* 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. +*/ + +/* THIS IS A GENERATED FILE. DO NOT EDIT DIRECTLY. */ + +#include "{{PKG_INCLUDE}}.h" +#include "{{UNARY_PKG_INCLUDE}}.h" +#include "stdlib/strided/base/{{STRIDED_APPLY_ALIAS}}.h" +#include "stdlib/strided/base/stride2offset.h" +#include "stdlib/blas/base/shared.h" +#include + +/** +* {{C_MAIN_DESC}} +* +* @param N number of indexed elements +* @param X input array +* @param strideX X stride length +* @param Y output array +* @param strideY Y stride length +* +* @example +* // Create an input strided array: +* const {{C_TYPE}} x[] = { {{C_X_VALUES_LEN_8}} }; +* +* // Create an output strided array: +* {{C_TYPE}} y[] = { 0.0{{C_TYPE_SUFFIX}}, 0.0{{C_TYPE_SUFFIX}}, 0.0{{C_TYPE_SUFFIX}}, 0.0{{C_TYPE_SUFFIX}}, 0.0{{C_TYPE_SUFFIX}}, 0.0{{C_TYPE_SUFFIX}}, 0.0{{C_TYPE_SUFFIX}}, 0.0{{C_TYPE_SUFFIX}} }; +* +* // Specify the number of indexed elements: +* const int N = 4; +* +* // Specify stride lengths: +* const int strideX = 2; +* const int strideY = 2; +* +* // Compute the results: +* stdlib_strided_{{ALIAS_SNAKECASE}}( N, x, strideX, y, strideY ); +*/ +void stdlib_strided_{{ALIAS_SNAKECASE}}( const CBLAS_INT N, const {{C_TYPE}} *X, const CBLAS_INT strideX, {{C_TYPE}} *Y, const CBLAS_INT strideY ) { + stdlib_strided_{{ALIAS_SNAKECASE}}_ndarray( N, X, strideX, stdlib_strided_stride2offset( N, strideX ), strideY, stdlib_strided_stride2offset( N, strideY ), stdlib_{{C_UNARY_ALIAS}} ); +} + +/** +* {{C_NDARRAY_DESC}} +* +* @param N number of indexed elements +* @param X input array +* @param strideX X stride length +* @param offsetX starting index for X +* @param Y output array +* @param strideY Y stride length +* @param offsetY starting index for Y +* +* @example +* // Create an input strided array: +* const {{C_TYPE}} x[] = { {{C_X_VALUES_LEN_8}} }; +* +* // Create an output strided array: +* {{C_TYPE}} y[] = { 0.0{{C_TYPE_SUFFIX}}, 0.0{{C_TYPE_SUFFIX}}, 0.0{{C_TYPE_SUFFIX}}, 0.0{{C_TYPE_SUFFIX}}, 0.0{{C_TYPE_SUFFIX}}, 0.0{{C_TYPE_SUFFIX}}, 0.0{{C_TYPE_SUFFIX}}, 0.0{{C_TYPE_SUFFIX}} }; +* +* // Specify the number of indexed elements: +* const int N = 4; +* +* // Specify stride lengths: +* const int strideX = 2; +* const int strideY = 2; +* +* // Specify index offsets: +* const int offsetX = 0; +* const int offsetY = 1; +* +* // Compute the results: +* stdlib_strided_{{ALIAS_SNAKECASE}}_ndarray( N, x, strideX, offsetX, y, strideY, offsetY ); +*/ +void stdlib_strided_{{ALIAS_SNAKECASE}}_ndarray( const CBLAS_INT N, const {{C_TYPE}} *X, const CBLAS_INT strideX, const CBLAS_INT offsetX, {{C_TYPE}} *Y, const CBLAS_INT strideY, const CBLAS_INT offsetY ) { + stdlib_strided_{{STRIDED_APPLY_ALIAS}}_ndarray( N, X, strideX, offsetX, Y, strideY, offsetY, stdlib_{{C_UNARY_ALIAS}} ); +} diff --git a/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/scripts/runner.js b/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/scripts/runner.js index ea3f163d2e15..a12d43ebe645 100644 --- a/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/scripts/runner.js +++ b/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/scripts/runner.js @@ -249,6 +249,7 @@ function main() { envs.push( aliasEnvVar( v ) ); continue; } + // FIXME: generate pkg, module, and main descriptions if ( k === 'desc' ) { envs.push( descEnvVar( v ) ); continue; diff --git a/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/scripts/scaffold.sh b/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/scripts/scaffold.sh index 473c61e741f5..39198383605a 100755 --- a/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/scripts/scaffold.sh +++ b/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/scripts/scaffold.sh @@ -44,17 +44,17 @@ alias=${ALIAS:-'TODO'} # Define the package description: # shellcheck disable=SC2016 -pkg_desc=${PKG_DESC:-"${DESC:-'TODO'} for each element in a STRIDED_TYPED_ARRAY."} +pkg_desc=${PKG_DESC:-"TODO for each element in a STRIDED_TYPED_ARRAY."} pkg_desc=$(echo "${pkg_desc}" | awk '{print toupper(substr($0,1,1)) substr($0,2)}') # Define the module description: # shellcheck disable=SC2016 -module_desc=${MODULE_DESC:-"${DESC:-'TODO'} for each element in a STRIDED_TYPED_ARRAY \`x\` and assign the results to elements in a STRIDED_TYPED_ARRAY \`y\`."} +module_desc=${MODULE_DESC:-"TODO for each element in a STRIDED_TYPED_ARRAY and assign the results to elements in a STRIDED_TYPED_ARRAY."} module_desc=$(echo "${module_desc}" | awk '{print toupper(substr($0,1,1)) substr($0,2)}') -# Define main export description: +# Define the main export description: # shellcheck disable=SC2016 -main_desc=${MAIN_DESC:-"${DESC:-'TODO'} for each element in a STRIDED_TYPED_ARRAY \`x\` and assigns the results to elements in a STRIDED_TYPED_ARRAY \`y\`."} +main_desc=${MAIN_DESC:-"${DESC:-'TODO'} for each element in a STRIDED_TYPED_ARRAY and assigns the results to elements in a STRIDED_TYPED_ARRAY."} main_desc=$(echo "${main_desc}" | awk '{print toupper(substr($0,1,1)) substr($0,2)}') # Define the test description: @@ -217,15 +217,20 @@ pkg_desc="${pkg_desc//STRIDED_TYPED_ARRAY/${strided_typed_array}}" module_desc="${module_desc//STRIDED_TYPED_ARRAY/${strided_typed_array}}" main_desc="${main_desc//STRIDED_TYPED_ARRAY/${strided_typed_array}}" -# Define the main C description: -# shellcheck disable=SC2016 -c_main_desc=$(echo "${main_desc}" | perl -pe 's/(\`[a-z]\`)/uc($&)/ge;') - # Define the ndarray method description: # shellcheck disable=SC2001 ndarray_desc=$(echo "${main_desc}" | sed 's/\.$//') ndarray_desc="${ndarray_desc} using alternative indexing semantics." +# Define the main C description: +# shellcheck disable=SC2016 +c_main_desc=$(echo "${main_desc}" | perl -pe 's/(\`[a-z]\`)/uc($&)/ge;') + +# Define the ndarray C description: +# shellcheck disable=SC2016 +c_ndarray_desc=$(echo "${c_main_desc}" | sed 's/\.$//') +c_ndarray_desc="${c_ndarray_desc} using alternative indexing semantics." + # Define the REPL text main export description (note: 4 space indent and wrap at 80 characters): repl_text_main_desc=$(echo -n "${main_desc}" | "${wrap}") repl_text_main_desc="${repl_text_main_desc/ /}" @@ -335,7 +340,7 @@ files=( "lib/ndarray.js" "lib/ndarray.native.js" "src/addon.c" - "src/alias.c" + "src/main.c" "src/Makefile" "test/test.alias.js" "test/test.alias.native.js" @@ -430,6 +435,9 @@ find_and_replace "${regex}" regex="s/\\{\\{C_MAIN_DESC\\}\\}/${c_main_desc}/g;" find_and_replace "${regex}" +regex="s/\\{\\{C_NDARRAY_DESC\\}\\}/${c_ndarray_desc}/g;" +find_and_replace "${regex}" + regex="s/\\{\\{REPL_TEXT_MAIN_DESC\\}\\}/${repl_text_main_desc}/g;" find_and_replace "${regex}" From 262d2c851e4220950f56ed177c717ca95b4dfe2b Mon Sep 17 00:00:00 2001 From: Gunj Joshi Date: Thu, 2 Jan 2025 01:39:49 +0530 Subject: [PATCH 12/13] Update runner.js Signed-off-by: Gunj Joshi --- .../scaffold/math-strided-real-typed-unary/scripts/runner.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/scripts/runner.js b/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/scripts/runner.js index a12d43ebe645..821a543b9b0d 100644 --- a/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/scripts/runner.js +++ b/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/scripts/runner.js @@ -3,7 +3,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2024 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. From 789a7d1a21154108fce40005e8d50d85d49f3e97 Mon Sep 17 00:00:00 2001 From: Gunj Joshi Date: Thu, 2 Jan 2025 01:40:09 +0530 Subject: [PATCH 13/13] Update generate_data.js Signed-off-by: Gunj Joshi --- .../math-strided-real-typed-unary/scripts/generate_data.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/scripts/generate_data.js b/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/scripts/generate_data.js index 1cada68fe587..74c8964143bc 100644 --- a/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/scripts/generate_data.js +++ b/lib/node_modules/@stdlib/_tools/scaffold/math-strided-real-typed-unary/scripts/generate_data.js @@ -3,7 +3,7 @@ /** * @license Apache-2.0 * -* Copyright (c) 2024 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.