Skip to content

Commit 18082c5

Browse files
authored
Update ndarray.js
Signed-off-by: Kaushikgtm <[email protected]>
1 parent 044a04d commit 18082c5

File tree

1 file changed

+12
-4
lines changed
  • lib/node_modules/@stdlib/stats/base/nanmskmin/lib

1 file changed

+12
-4
lines changed

lib/node_modules/@stdlib/stats/base/nanmskmin/lib/ndarray.js

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* @license Apache-2.0
33
*
4-
* Copyright (c) 2020 The Stdlib Authors.
4+
* Copyright (c) 2025 The Stdlib Authors.
55
*
66
* Licensed under the Apache License, Version 2.0 (the "License");
77
* you may not use this file except in compliance with the License.
@@ -22,6 +22,8 @@
2222

2323
var isnan = require( '@stdlib/math/base/assert/is-nan' );
2424
var isNegativeZero = require( '@stdlib/math/base/assert/is-negative-zero' );
25+
var arraylike2object = require( '@stdlib/array/base/arraylike2object' );
26+
var accessors = require( './accessors.js' );
2527

2628

2729
// MAIN //
@@ -52,17 +54,23 @@ function nanmskmin( N, x, strideX, offsetX, mask, strideMask, offsetMask ) {
5254
var min;
5355
var ix;
5456
var im;
57+
var ox;
58+
var om;
5559
var v;
5660
var i;
5761

5862
if ( N <= 0 ) {
5963
return NaN;
6064
}
65+
ox = arraylike2object(x);
66+
om = arraylike2object(mask);
67+
if(ox.accessorProtocol() || om.accessorProtocol() ){
68+
return accessors(N, ox, strideX, offsetX, om, strideMask, offsetMask)
69+
}
6170
ix = offsetX;
6271
im = offsetMask;
6372
for ( i = 0; i < N; i++ ) {
64-
v = x[ ix ];
65-
if ( v === v && mask[ im ] === 0 ) {
73+
if( mask[im] === 0 ){
6674
break;
6775
}
6876
ix += strideX;
@@ -71,7 +79,7 @@ function nanmskmin( N, x, strideX, offsetX, mask, strideMask, offsetMask ) {
7179
if ( i === N ) {
7280
return NaN;
7381
}
74-
min = v;
82+
min = x[ ix ];
7583
i += 1;
7684
for ( i; i < N; i++ ) {
7785
ix += strideX;

0 commit comments

Comments
 (0)