Skip to content

Commit c54a447

Browse files
authored
Apply suggestions from code review
Co-authored-by: Athan <kgryte@gmail.com> Signed-off-by: Athan <kgryte@gmail.com>
1 parent f3e46f2 commit c54a447

File tree

1 file changed

+6
-5
lines changed
  • lib/node_modules/@stdlib/blas/ext/base/ddiff/lib

1 file changed

+6
-5
lines changed

lib/node_modules/@stdlib/blas/ext/base/ddiff/lib/ndarray.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -95,14 +95,15 @@ function ddiff( N, k, x, strideX, offsetX, N1, prepend, strideP, offsetP, N2, ap
9595

9696
return out;
9797
}
98-
// Compute the first forward difference:
99-
base( N, x, strideX, offsetX, N1, prepend, strideP, offsetP, N2, append, strideA, offsetA, workspace, strideW, offsetW );
100-
101-
// If `k` is one, we're finished...
98+
// If `k` is equal to one, we can compute the forward difference while writing directly to the output array...
10299
if ( k === 1 ) {
100+
base( N, x, strideX, offsetX, N1, prepend, strideP, offsetP, N2, append, strideA, offsetA, out, strideOut, offsetOut );
103101
return out;
104102
}
105-
// Otherwise, recursively compute forward differences...
103+
// Compute the first forward difference:
104+
base( N, x, strideX, offsetX, N1, prepend, strideP, offsetP, N2, append, strideA, offsetA, workspace, strideW, offsetW );
105+
106+
// Recursively compute the next forward differences...
106107
n = total - 1;
107108
for ( i = 1; i < k-1; i++ ) {
108109
base( n, workspace, strideW, offsetW, 0, prepend, strideP, offsetP, 0, append, strideA, offsetA, workspace, strideW, offsetW );

0 commit comments

Comments
 (0)