Skip to content

Commit 9ef3b15

Browse files
committed
Merge branch 'feat/base-ndarray-where' of https://github.com/LoayAhmed304/stdlib into feat/base-ndarray-where
2 parents 559c59c + e5a8f91 commit 9ef3b15

10 files changed

Lines changed: 36 additions & 29 deletions

lib/node_modules/@stdlib/ndarray/base/where/benchmark/benchmark.11d_columnmajor.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,15 +49,17 @@ var order = 'column-major';
4949
* @private
5050
* @param {PositiveInteger} len - ndarray length
5151
* @param {NonNegativeIntegerArray} shape - ndarray shape
52-
* @param {string} xtype - first input ndarray data type
53-
* @param {string} ytype - second input ndarray data type
52+
* @param {string} ctype - first input ndarray data type
53+
* @param {string} xtype - second input ndarray data type
54+
* @param {string} ytype - third input ndarray data type
55+
* @param {string} otype - output ndarray data type
5456
* @returns {Function} benchmark function
5557
*/
5658
function createBenchmark( len, shape, ctype, xtype, ytype, otype ) {
5759
var condition;
60+
var out;
5861
var x;
5962
var y;
60-
var out;
6163

6264
condition = filledarrayBy( len, ctype, bernoulli( 0.5 ) );
6365
x = filledarrayBy( len, xtype, discreteUniform( -100, 100 ) );

lib/node_modules/@stdlib/ndarray/base/where/benchmark/benchmark.11d_rowmajor.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,15 +49,17 @@ var order = 'row-major';
4949
* @private
5050
* @param {PositiveInteger} len - ndarray length
5151
* @param {NonNegativeIntegerArray} shape - ndarray shape
52-
* @param {string} xtype - first input ndarray data type
53-
* @param {string} ytype - second input ndarray data type
52+
* @param {string} ctype - first input ndarray data type
53+
* @param {string} xtype - second input ndarray data type
54+
* @param {string} ytype - third input ndarray data type
55+
* @param {string} otype - output ndarray data type
5456
* @returns {Function} benchmark function
5557
*/
5658
function createBenchmark( len, shape, ctype, xtype, ytype, otype ) {
5759
var condition;
60+
var out;
5861
var x;
5962
var y;
60-
var out;
6163

6264
condition = filledarrayBy( len, ctype, bernoulli( 0.5 ) );
6365
x = filledarrayBy( len, xtype, discreteUniform( -100, 100 ) );

lib/node_modules/@stdlib/ndarray/base/where/benchmark/benchmark.1d_columnmajor.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@ var discreteUniform = require( '@stdlib/random/base/discrete-uniform' ).factory;
2525
var bernoulli = require( '@stdlib/random/base/bernoulli' ).factory;
2626
var isnan = require( '@stdlib/math/base/assert/is-nan' );
2727
var pow = require( '@stdlib/math/base/special/pow' );
28-
var floor = require( '@stdlib/math/base/special/floor' );
29-
var sqrt = require( '@stdlib/math/base/special/sqrt' );
3028
var filledarray = require( '@stdlib/array/filled' );
3129
var filledarrayBy = require( '@stdlib/array/filled-by' );
3230
var shape2strides = require( '@stdlib/ndarray/base/shape2strides' );

lib/node_modules/@stdlib/ndarray/base/where/benchmark/benchmark.1d_rowmajor.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@ var discreteUniform = require( '@stdlib/random/base/discrete-uniform' ).factory;
2525
var bernoulli = require( '@stdlib/random/base/bernoulli' ).factory;
2626
var isnan = require( '@stdlib/math/base/assert/is-nan' );
2727
var pow = require( '@stdlib/math/base/special/pow' );
28-
var floor = require( '@stdlib/math/base/special/floor' );
29-
var sqrt = require( '@stdlib/math/base/special/sqrt' );
3028
var filledarray = require( '@stdlib/array/filled' );
3129
var filledarrayBy = require( '@stdlib/array/filled-by' );
3230
var shape2strides = require( '@stdlib/ndarray/base/shape2strides' );

lib/node_modules/@stdlib/ndarray/base/where/benchmark/benchmark.2d_rowmajor_accessors.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ var pkg = require( './../package.json' ).name;
3535
var where2d = require( './../lib/2d_accessors.js' );
3636

3737

38-
3938
// VARIABLES //
4039

4140
var conditionTypes = [ 'uint8' ];

lib/node_modules/@stdlib/ndarray/base/where/benchmark/benchmark.2d_rowmajor_accessors_complex.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ var pkg = require( './../package.json' ).name;
3636
var where2d = require( './../lib/2d_accessors.js' );
3737

3838

39-
4039
// VARIABLES //
4140

4241
var conditionTypes = [ 'bool' ];
@@ -104,10 +103,12 @@ function createBenchmark( len, shape, ctype, xtype, ytype, otype ) {
104103
ybuf = filledarrayBy( len*2, abtype[ ytype ], discreteUniform( -100, 100 ) );
105104
obuf = filledarray( 0.0, len*2, abtype[ otype ] );
106105

107-
stride = shape2strides( shape, order );
108106
// broadcast extra dimension along last axis for the condition array for complex compatibility.
109-
cshape = [ ...shape, 2 ];
110-
cstrides = [ ...stride, 0 ];
107+
stride = shape2strides( shape, order );
108+
cshape = shape.slice();
109+
cshape.push( 1 );
110+
cstrides = stride.slice();
111+
cstrides.push( 0 );
111112
condition = {
112113
'dtype': ctype,
113114
'data': new ( ctors( ctype ) )( cbuf.buffer ),

lib/node_modules/@stdlib/ndarray/base/where/benchmark/benchmark.3d_blocked_columnmajor.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,15 +50,17 @@ var order = 'column-major';
5050
* @private
5151
* @param {PositiveInteger} len - ndarray length
5252
* @param {NonNegativeIntegerArray} shape - ndarray shape
53-
* @param {string} xtype - first input ndarray data type
54-
* @param {string} ytype - second input ndarray data type
53+
* @param {string} ctype - first input ndarray data type
54+
* @param {string} xtype - second input ndarray data type
55+
* @param {string} ytype - third input ndarray data type
56+
* @param {string} otype - output ndarray data type
5557
* @returns {Function} benchmark function
5658
*/
5759
function createBenchmark( len, shape, ctype, xtype, ytype, otype ) {
5860
var condition;
61+
var out;
5962
var x;
6063
var y;
61-
var out;
6264

6365
condition = filledarrayBy( len, ctype, bernoulli( 0.5 ) );
6466
x = filledarrayBy( len, xtype, discreteUniform( -100, 100 ) );

lib/node_modules/@stdlib/ndarray/base/where/benchmark/benchmark.3d_blocked_rowmajor.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,15 +50,17 @@ var order = 'row-major';
5050
* @private
5151
* @param {PositiveInteger} len - ndarray length
5252
* @param {NonNegativeIntegerArray} shape - ndarray shape
53-
* @param {string} xtype - first input ndarray data type
54-
* @param {string} ytype - second input ndarray data type
53+
* @param {string} ctype - first input ndarray data type
54+
* @param {string} xtype - second input ndarray data type
55+
* @param {string} ytype - third input ndarray data type
56+
* @param {string} otype - output ndarray data type
5557
* @returns {Function} benchmark function
5658
*/
5759
function createBenchmark( len, shape, ctype, xtype, ytype, otype ) {
5860
var condition;
61+
var out;
5962
var x;
6063
var y;
61-
var out;
6264

6365
condition = filledarrayBy( len, ctype, bernoulli( 0.5 ) );
6466
x = filledarrayBy( len, xtype, discreteUniform( -100, 100 ) );

lib/node_modules/@stdlib/ndarray/base/where/benchmark/benchmark.3d_columnmajor.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,15 +50,17 @@ var order = 'column-major';
5050
* @private
5151
* @param {PositiveInteger} len - ndarray length
5252
* @param {NonNegativeIntegerArray} shape - ndarray shape
53-
* @param {string} xtype - first input ndarray data type
54-
* @param {string} ytype - second input ndarray data type
53+
* @param {string} ctype - first input ndarray data type
54+
* @param {string} xtype - second input ndarray data type
55+
* @param {string} ytype - third input ndarray data type
56+
* @param {string} otype - output ndarray data type
5557
* @returns {Function} benchmark function
5658
*/
5759
function createBenchmark( len, shape, ctype, xtype, ytype, otype ) {
5860
var condition;
61+
var out;
5962
var x;
6063
var y;
61-
var out;
6264

6365
condition = filledarrayBy( len, ctype, bernoulli( 0.5 ) );
6466
x = filledarrayBy( len, xtype, discreteUniform( -100, 100 ) );

lib/node_modules/@stdlib/ndarray/base/where/benchmark/benchmark.3d_rowmajor.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,15 +50,17 @@ var order = 'row-major';
5050
* @private
5151
* @param {PositiveInteger} len - ndarray length
5252
* @param {NonNegativeIntegerArray} shape - ndarray shape
53-
* @param {string} xtype - first input ndarray data type
54-
* @param {string} ytype - second input ndarray data type
53+
* @param {string} ctype - first input ndarray data type
54+
* @param {string} xtype - second input ndarray data type
55+
* @param {string} ytype - third input ndarray data type
56+
* @param {string} otype - output ndarray data type
5557
* @returns {Function} benchmark function
5658
*/
5759
function createBenchmark( len, shape, ctype, xtype, ytype, otype ) {
5860
var condition;
61+
var out;
5962
var x;
6063
var y;
61-
var out;
6264

6365
condition = filledarrayBy( len, ctype, bernoulli( 0.5 ) );
6466
x = filledarrayBy( len, xtype, discreteUniform( -100, 100 ) );
@@ -108,7 +110,6 @@ function createBenchmark( len, shape, ctype, xtype, ytype, otype ) {
108110
function benchmark( b ) {
109111
var i;
110112

111-
112113
b.tic();
113114
console.log(b.iterations);
114115
for ( i = 0; i < b.iterations; i++ ) {
@@ -163,7 +164,7 @@ function main() {
163164
sh = [ len/2, 2, 1 ];
164165
f = createBenchmark( len, sh, tc, t1, t2, t3 );
165166
bench( format( '%s:ndims=%d,len=%d,shape=[%s],order=%s,ctype=%s,xtype=%s,ytype=%s,otype=%s', pkg, sh.length, len, sh.join( ',' ), order, tc, t1, t2, t3 ), f );
166-
console.log("Finished first benchmark");
167+
167168
sh = [ 1, 2, len/2 ];
168169
f = createBenchmark( len, sh, tc, t1, t2, t3 );
169170
bench( format( '%s:ndims=%d,len=%d,shape=[%s],order=%s,ctype=%s,xtype=%s,ytype=%s,otype=%s', pkg, sh.length, len, sh.join( ',' ), order, tc, t1, t2, t3 ), f );

0 commit comments

Comments
 (0)