Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: update scaffolding for creating unary math strided packages #2993

Open
wants to merge 10 commits into
base: develop
Choose a base branch
from
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ limitations under the License.

-->

<!-- THIS IS A GENERATED FILE. DO NOT EDIT DIRECTLY. -->

# {{ALIAS}}

> {{PKG_DESC}}
Expand Down Expand Up @@ -135,17 +137,16 @@ var y = new {{TYPED_ARRAY_CTOR}}( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] );
<!-- eslint no-undef: "error" -->

```javascript
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( '@{{PKG}}' );

var x = new {{TYPED_ARRAY_CTOR}}( 10 );
var y = new {{TYPED_ARRAY_CTOR}}( 10 );
var x = random( 10, {{C_RAND_MIN}}, {{C_RAND_MAX}}, {
'dtype': '{{TYPED_ARRAY_DTYPE}}'
});
var y = zeros( 10, '{{TYPED_ARRAY_DTYPE}}' );

var i;
for ( i = 0; i < x.length; i++ ) {
x[ i ] = uniform( {{C_RAND_MIN}}, {{C_RAND_MAX}} );
}
console.log( x );
console.log( y );

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,22 @@
* 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/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}}' );
var pkg = require( './../package.json' ).name;
var {{ALIAS}} = require( './../lib/main.js' );


// VARIABLES //

var rand = uniform( {{C_RAND_MIN}}, {{C_RAND_MAX}} );


// FUNCTIONS //

/**
Expand All @@ -48,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;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,16 @@
* 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/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}}' );
Expand All @@ -36,7 +39,6 @@ var {{ALIAS}} = tryRequire( resolve( __dirname, './../lib/{{ALIAS_SNAKECASE}}.na
var opts = {
'skip': ( {{ALIAS}} instanceof Error )
};
var rand = uniform( {{C_RAND_MIN}}, {{C_RAND_MAX}} );


// FUNCTIONS //
Expand All @@ -53,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;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,22 @@
* 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/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}}' );
var pkg = require( './../package.json' ).name;
var {{ALIAS}} = require( './../lib/ndarray.js' );


// VARIABLES //

var rand = uniform( {{C_RAND_MIN}}, {{C_RAND_MAX}} );


// FUNCTIONS //

/**
Expand All @@ -48,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;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,16 @@
* 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/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}}' );
Expand All @@ -36,7 +39,6 @@ var {{ALIAS}} = tryRequire( resolve( __dirname, './../lib/ndarray.native.js' ) )
var opts = {
'skip': ( {{ALIAS}} instanceof Error )
};
var rand = uniform( {{C_RAND_MIN}}, {{C_RAND_MAX}} );


// FUNCTIONS //
Expand All @@ -53,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;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
# limitations under the License.
#/

# THIS IS A GENERATED FILE. DO NOT EDIT DIRECTLY.

# VARIABLES #

ifndef VERBOSE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
* limitations under the License.
*/

/* THIS IS A GENERATED FILE. DO NOT EDIT DIRECTLY. */

/**
* Benchmark `{{ALIAS_SNAKECASE}}`.
*/
Expand All @@ -35,7 +37,7 @@
/**
* Prints the TAP version.
*/
void print_version() {
static void print_version() {
printf( "TAP version 13\n" );
}

Expand All @@ -45,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 );
Expand All @@ -60,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 );
Expand All @@ -74,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;
Expand All @@ -85,9 +87,9 @@ double tic() {
*
* @param a minimum value
* @param b maximum value
* @return random number
* @return random number
*/
double rand_uniform( double a, double b ) {
static double rand_uniform( double a, double b ) {
double x;
int r;

Expand All @@ -102,9 +104,9 @@ 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 ) {
static float rand_uniformf( float a, float b ) {
return (float)rand_uniform( (double)a, (double)b );
}

Expand All @@ -113,9 +115,9 @@ 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 ) {
static double benchmark( int iterations, int len ) {
double elapsed;
{{C_TYPE}} x[ len ];
{{C_TYPE}} y[ len ];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
* limitations under the License.
*/

/* THIS IS A GENERATED FILE. DO NOT EDIT DIRECTLY. */

// TypeScript Version: 4.1

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
* limitations under the License.
*/

/* THIS IS A GENERATED FILE. DO NOT EDIT DIRECTLY. */

import {{ALIAS}} = require( './index' );


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
# limitations under the License.
#/

# THIS IS A GENERATED FILE. DO NOT EDIT DIRECTLY.

# VARIABLES #

ifndef VERBOSE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
* limitations under the License.
*/

/* THIS IS A GENERATED FILE. DO NOT EDIT DIRECTLY. */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like we are missing suffix support at L30.


#include "{{PKG_INCLUDE}}.h"
#include <stdint.h>
#include <stdio.h>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,19 @@
* limitations under the License.
*/

/* THIS IS A GENERATED FILE. DO NOT EDIT DIRECTLY. */
gunjjoshi marked this conversation as resolved.
Show resolved Hide resolved

'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 );

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
* limitations under the License.
*/

/* THIS IS A GENERATED FILE. DO NOT EDIT DIRECTLY. */

'use strict';

// MODULES //
Expand Down
Loading