Skip to content

Commit 6b8fe35

Browse files
authored
refactor: avoid re-materializing complex number instances
Signed-off-by: Athan <[email protected]>
1 parent dcd48eb commit 6b8fe35

File tree

1 file changed

+4
-2
lines changed
  • lib/node_modules/@stdlib/blas/base/icamax/lib

1 file changed

+4
-2
lines changed

lib/node_modules/@stdlib/blas/base/icamax/lib/ndarray.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ function icamax( N, x, strideX, offsetX ) {
4646
var max;
4747
var idx;
4848
var ix;
49+
var v;
4950
var i;
5051

5152
if ( N < 1 ) {
@@ -58,9 +59,10 @@ function icamax( N, x, strideX, offsetX ) {
5859
max = scabs1( x.get( offsetX ) );
5960
ix = offsetX + strideX;
6061
for ( i = 1; i < N; i++ ) {
61-
if ( scabs1( x.get( ix ) ) > max ) {
62+
v = scabs1( x.get( ix );
63+
if ( v ) > max ) {
6264
idx = i;
63-
max = scabs1( x.get( ix ) );
65+
max = v;
6466
}
6567
ix += strideX;
6668
}

0 commit comments

Comments
 (0)