You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -30,8 +30,11 @@ var main = require( './main.js' );
30
30
/**
31
31
* Return a function for applying a one-dimensional strided array function to a list of specified dimensions in an input ndarray and assigning results to a provided output ndarray.
32
32
*
33
-
* @param {Function} fcn - wrapper for a one-dimensional strided array function
34
-
* @throws {TypeError} first argument must be a function
33
+
* @param {Function} [fcn] - wrapper for a one-dimensional strided array function
34
+
* @param {Options} [options] - function options
35
+
* @param {boolean} [options.strictTraversalOrder=false] - boolean specifying whether to require that element traversal match the memory layout of an input ndarray
36
+
* @throws {TypeError} options argument must be an object
37
+
* @throws {TypeError} must provide valid options
35
38
* @returns {Function} function for applying a strided array function
36
39
*
37
40
* @example
@@ -106,11 +109,37 @@ var main = require( './main.js' );
thrownewTypeError(format('invalid argument. First argument must be a function. Value: `%s`.',fcn));
112
+
functionfactory(){
113
+
varnargs;
114
+
varunary;
115
+
varfcn;
116
+
varf;
117
+
118
+
nargs=arguments.length;
119
+
120
+
// Case: factory()
121
+
if(nargs===0){
122
+
unary=main;
123
+
f=wrap;
124
+
}
125
+
// Case: factory( fcn, opts )
126
+
elseif(nargs>1){
127
+
unary=mainFactory(arguments[1]);
128
+
fcn=arguments[0];
129
+
f=apply;
112
130
}
113
-
returnapply;
131
+
// Case: factory( fcn )
132
+
elseif(isFunction(arguments[0])){
133
+
unary=main;
134
+
fcn=arguments[0];
135
+
f=apply;
136
+
}
137
+
// Case: factory( opts )
138
+
else{
139
+
unary=mainFactory(arguments[0]);
140
+
f=wrap;
141
+
}
142
+
returnf;
114
143
115
144
/**
116
145
* Applies a one-dimensional strided array function to a list of specified dimensions in an input ndarray and assigns results to a provided output ndarray.
@@ -128,7 +157,27 @@ function factory( fcn ) {
128
157
}else{
129
158
opts={};
130
159
}
131
-
returnmain(fcn,arrays,dims,opts);
160
+
returnunary(fcn,arrays,dims,opts);
161
+
}
162
+
163
+
/**
164
+
* Applies a one-dimensional strided array function to a list of specified dimensions in an input ndarray and assigns results to a provided output ndarray.
165
+
*
166
+
* @private
167
+
* @param {Function} fcn - wrapper for a one-dimensional strided array function
0 commit comments