Skip to content

Commit b0f00bf

Browse files
committed
Move package
1 parent 680ced4 commit b0f00bf

File tree

11 files changed

+241
-187
lines changed

11 files changed

+241
-187
lines changed

lib/node_modules/@stdlib/math/tools/meta-data-props/docs/repl.txt

Lines changed: 0 additions & 50 deletions
This file was deleted.

lib/node_modules/@stdlib/math/tools/meta-data-props/docs/types/test.ts

Lines changed: 0 additions & 65 deletions
This file was deleted.

lib/node_modules/@stdlib/math/tools/meta-data-props/README.md renamed to lib/node_modules/@stdlib/strided/base/meta-data-props/README.md

Lines changed: 46 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ limitations under the License.
2020

2121
# setProps
2222

23-
> Define non-enumerable read-only properties which expose ndarray function meta data.
23+
> Define non-enumerable read-only properties which expose strided array function meta data.
2424
2525
<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->
2626

@@ -37,24 +37,24 @@ limitations under the License.
3737
## Usage
3838

3939
```javascript
40-
var setProps = require( '@stdlib/math/tools/meta-data-props' );
40+
var setProps = require( '@stdlib/strided/base/meta-data-props' );
4141
```
4242

43-
#### setProps( meta, dtypes, obj )
43+
#### setProps( meta, dtypes, obj, bool )
4444

45-
Defines non-enumerable read-only properties which expose ndarray function meta data.
45+
Defines non-enumerable read-only properties which expose strided array function meta data.
4646

4747
<!-- eslint-disable array-element-newline -->
4848

4949
```javascript
50-
// Define ndarray function meta data:
50+
// Define strided array function meta data:
5151
var meta = {
52-
'nargs': 2,
52+
'nargs': 7,
5353
'nin': 1,
5454
'nout': 1
5555
};
5656

57-
// Define the list of ndarray data types:
57+
// Define the list of strided array data types:
5858
var dtypes = [
5959
'float64', 'float64'
6060
];
@@ -63,14 +63,42 @@ var dtypes = [
6363
var obj = {};
6464

6565
// Set the properties:
66-
setProps( meta, dtypes, obj );
66+
setProps( meta, dtypes, obj, false );
6767
```
6868

6969
The `meta` data argument should be an `object` with the following properties:
7070

71-
- **nargs**: total number of arguments. This value is one more than might be expected, as the output array is treated as an implicit argument, even when not explicitly provided.
72-
- **nin**: number of input ndarrays.
73-
- **nout**: number of output ndarrays.
71+
- **nargs**: total number of arguments (excluding offsets).
72+
- **nin**: number of input strided arrays.
73+
- **nout**: number of output strided arrays.
74+
75+
The `bool` argument indicates whether the input object should describe an "ndarray" interface (i.e., an interface supporting `offset` arguments).
76+
77+
<!-- eslint-disable array-element-newline -->
78+
79+
```javascript
80+
// Define strided array function meta data:
81+
var meta = {
82+
'nargs': 7, // excludes offsets
83+
'nin': 1,
84+
'nout': 1
85+
};
86+
87+
// Define the list of strided array data types:
88+
var dtypes = [
89+
'float64', 'float64'
90+
];
91+
92+
// Define an object/function on which to set the properties:
93+
var obj = {};
94+
95+
// Set the properties:
96+
setProps( meta, dtypes, obj, true );
97+
98+
// Retrieve the total number of arguments:
99+
var nargs = obj.nargs;
100+
// returns 9
101+
```
74102

75103
</section>
76104

@@ -95,16 +123,16 @@ The `meta` data argument should be an `object` with the following properties:
95123
<!-- eslint no-undef: "error" -->
96124

97125
```javascript
98-
var setProps = require( '@stdlib/math/tools/meta-data-props' );
126+
var setProps = require( '@stdlib/strided/base/meta-data-props' );
99127

100-
// Define ndarray function meta data:
128+
// Define strided array function meta data:
101129
var meta = {
102-
'nargs': 2,
130+
'nargs': 7,
103131
'nin': 1,
104132
'nout': 1
105133
};
106134

107-
// Define the list of ndarray data types:
135+
// Define the list of strided array data types:
108136
var types = [
109137
'float64', 'float64',
110138
'float32', 'float32',
@@ -115,11 +143,11 @@ var types = [
115143
var obj = {};
116144

117145
// Set the properties:
118-
setProps( meta, types, obj );
146+
setProps( meta, types, obj, false );
119147

120-
// Retrieve ndarray function data...
148+
// Retrieve strided array function data...
121149
var nargs = obj.nargs;
122-
// returns 2
150+
// returns 7
123151

124152
var nin = obj.nin;
125153
// returns 1

lib/node_modules/@stdlib/math/tools/meta-data-props/benchmark/benchmark.js renamed to lib/node_modules/@stdlib/strided/base/meta-data-props/benchmark/benchmark.js

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,14 @@ var setProps = require( './../lib' );
3030

3131
// MAIN //
3232

33-
bench( pkg, function benchmark( b ) {
33+
bench( pkg+':ndarray=false', function benchmark( b ) {
3434
var types;
3535
var meta;
3636
var out;
3737
var i;
3838

3939
meta = {
40-
'nargs': 2,
40+
'nargs': 7,
4141
'nin': 1,
4242
'nout': 1
4343
};
@@ -62,3 +62,36 @@ bench( pkg, function benchmark( b ) {
6262
b.pass( 'benchmark finished' );
6363
b.end();
6464
});
65+
66+
bench( pkg+':ndarray=true', function benchmark( b ) {
67+
var types;
68+
var meta;
69+
var out;
70+
var i;
71+
72+
meta = {
73+
'nargs': 7,
74+
'nin': 1,
75+
'nout': 1
76+
};
77+
78+
types = [
79+
'float64', 'float64',
80+
'float32', 'float32',
81+
'generic', 'generic'
82+
];
83+
84+
b.tic();
85+
for ( i = 0; i < b.iterations; i++ ) {
86+
out = setProps( meta, types, {}, true );
87+
if ( typeof out.nout !== 'number' ) {
88+
b.fail( 'should return a number' );
89+
}
90+
}
91+
b.toc();
92+
if ( !isNonNegativeInteger( out.nargs ) ) {
93+
b.fail( 'should return a nonnegative integer' );
94+
}
95+
b.pass( 'benchmark finished' );
96+
b.end();
97+
});

lib/node_modules/@stdlib/math/tools/meta-data-props/docs/types/index.d.ts renamed to lib/node_modules/@stdlib/strided/base/meta-data-props/docs/types/index.d.ts

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,7 @@ import { ArrayLike } from '@stdlib/types/array';
2727
*/
2828
interface Meta {
2929
/**
30-
* Total number of arguments.
31-
*
32-
* ## Notes
33-
*
34-
* - This value is one more than might be expected, as the output array is treated as an implicit argument, even when not explicitly provided.
30+
* Total number of arguments (excluding offsets).
3531
*/
3632
nargs: number;
3733

@@ -47,25 +43,26 @@ interface Meta {
4743
}
4844

4945
/**
50-
* Defines non-enumerable read-only properties which expose ndarray function meta data.
46+
* Defines non-enumerable read-only properties which expose strided array function meta data.
5147
*
5248
* @param meta - function meta data
53-
* @param meta.nargs - total number of arguments
49+
* @param meta.nargs - total number of arguments (excluding offsets)
5450
* @param meta.nin - total number of input arrays
5551
* @param meta.nout - total number of output arrays
56-
* @param dtypes - list of ndarray data types
52+
* @param dtypes - list of strided array data types
5753
* @param obj - object on which to define properties
54+
* @param bool - boolean indicating whether the provided object should describe an "ndarray" function interface
5855
* @returns object on which properties were defined
5956
*
6057
* @example
61-
* // Define ndarray function meta data:
58+
* // Define strided array function meta data:
6259
* var meta = {
63-
* 'nargs': 2,
60+
* 'nargs': 7,
6461
* 'nin': 1,
6562
* 'nout': 1
6663
* };
6764
*
68-
* // Define the list of ndarray data types:
65+
* // Define the list of strided array data types:
6966
* var dtypes = [
7067
* 'float64', 'float64',
7168
* 'float32', 'float32',
@@ -76,9 +73,9 @@ interface Meta {
7673
* var obj = {};
7774
*
7875
* // Set the properties:
79-
* setProps( meta, dtypes, obj );
76+
* setProps( meta, dtypes, obj, false );
8077
*/
81-
declare function setProps( meta: Meta, dtypes: ArrayLike<any>, obj: any ): any;
78+
declare function setProps( meta: Meta, dtypes: ArrayLike<any>, obj: any, bool: boolean ): any; // tslint:disable-line:max-line-length
8279

8380

8481
// EXPORTS //

0 commit comments

Comments
 (0)