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
<spanclass="cstat-no" title="statement not covered" > return out;</span>
1004
1050
<spanclass="cstat-no" title="statement not covered" >}</span>
1005
1051
1052
+
/**
1053
+
* Reorders a list of ndarrays such that the output ndarray is the second ndarray argument when passing along to a resolved lower-level strided function.
1054
+
*
1055
+
* @private
1056
+
* @param {NonNegativeInteger} N - number of ndarrays in `arrays` to reorder
1057
+
* @param {Array<ndarray>} arrays - list of ndarrays
1058
+
* @param {ndarray} output - output ndarray
1059
+
* @returns {Array<ndarray>} reordered list
1060
+
*/
1061
+
<spanclass="cstat-no" title="statement not covered" ><spanclass="fstat-no" title="function not covered" >function reorder( N, arrays, output ) {</span></span>
1062
+
<spanclass="cstat-no" title="statement not covered" > var out;</span>
1063
+
<spanclass="cstat-no" title="statement not covered" > var i;</span>
1064
+
<spanclass="cstat-no" title="statement not covered" > var j;</span>
1065
+
<spanclass="cstat-no" title="statement not covered" ></span>
1066
+
<spanclass="cstat-no" title="statement not covered" > out = [];</span>
1067
+
<spanclass="cstat-no" title="statement not covered" > for ( i = 0, j = 0; i <= N; i++ ) {</span>
1068
+
<spanclass="cstat-no" title="statement not covered" > if ( i === 1 ) {</span>
1069
+
<spanclass="cstat-no" title="statement not covered" > out.push( output );</span>
1070
+
<spanclass="cstat-no" title="statement not covered" > } else {</span>
1071
+
<spanclass="cstat-no" title="statement not covered" > out.push( arrays[ j ] );</span>
1072
+
<spanclass="cstat-no" title="statement not covered" > j += 1;</span>
1073
+
<spanclass="cstat-no" title="statement not covered" > }</span>
1074
+
<spanclass="cstat-no" title="statement not covered" > }</span>
1075
+
<spanclass="cstat-no" title="statement not covered" > return out;</span>
1076
+
<spanclass="cstat-no" title="statement not covered" >}</span>
<spanclass="cstat-no" title="statement not covered" > if ( opts.dims === null ) {</span>
1340
1411
<spanclass="cstat-no" title="statement not covered" > opts.dims = zeroTo( N );</span>
1341
1412
<spanclass="cstat-no" title="statement not covered" > }</span>
1342
-
<spanclass="cstat-no" title="statement not covered" > // Reorder the ndarray arguments such that the output ndarray is the second ndarray argument when passing along to the resolved lower-level strided function below:</span>
1343
-
<spanclass="cstat-no" title="statement not covered" > tmp = args[ 1 ];</span>
<spanclass="cstat-no" title="statement not covered" > args[ args.length-1 ] = tmp;</span>
1413
+
<spanclass="cstat-no" title="statement not covered" > // Cache a reference to the output ndarray:</span>
1414
+
<spanclass="cstat-no" title="statement not covered" > y = args[ args.length-1 ];</span>
1346
1415
<spanclass="cstat-no" title="statement not covered" ></span>
1347
1416
<spanclass="cstat-no" title="statement not covered" > // Resolve the lower-level strided function satisfying the input and output ndarray data types:</span>
<spanclass="cstat-no" title="statement not covered" > if ( idx >= 0 ) {</span>
1351
1420
<spanclass="cstat-no" title="statement not covered" > f = this._table.fcns[ idx ];</span>
1352
1421
<spanclass="cstat-no" title="statement not covered" > } else {</span>
1353
1422
<spanclass="cstat-no" title="statement not covered" > f = this._table.default;</span>
1354
1423
<spanclass="cstat-no" title="statement not covered" > }</span>
1355
1424
<spanclass="cstat-no" title="statement not covered" > // Perform operation:</span>
1356
-
<spanclass="cstat-no" title="statement not covered" > unaryStrided1d( f, args, opts.dims ); // note: we assume that this lower-level function handles further validation of the output ndarray (e.g., expected shape, etc)</span>
1425
+
<spanclass="cstat-no" title="statement not covered" > unaryStrided1d( f, reorder( args.length-1, args, y ), opts.dims ); // note: we assume that this lower-level function handles further validation of the output ndarray (e.g., expected shape, etc)</span>
1357
1426
<spanclass="cstat-no" title="statement not covered" ></span>
1358
-
<spanclass="cstat-no" title="statement not covered" > return args[ 1 ];</span>
1427
+
<spanclass="cstat-no" title="statement not covered" > return y;</span>
0 commit comments