Hi Jared —
I don't have an authoritative answer to this, but I have a good guess that I'll pass along in the interest of getting you a quick response. When @lydia (who did the implementation) is back at work, she may be able to give a sense as to whether my guess is accurate or not and provide more details.
My guess is that the lack of support for isClose() between two arrays, or between an array and a scalar, is more a reflection of the evolution of the implementation than a deeply intentional design choice. And with a quick look at some of the issues around the time we were stabilizing this for Chapel 2.0, I'm not seeing any indication that we considered and rejected support for array-based cases.
Looking at the history of the implementation, it started out in commit ad4e07ffc513 as a generic function on the arguments being compared (x and y), as it is today. When an argument is fully generic like that, it means passing in an array in will treat x like an array rather than considering it an opportunity for promoting the argument. Meanwhile, the implementation of the function used (and uses) short-circuiting operators || to compute its result, and these are not (currently) supported on arrays, so passing an array in during those early commits would result in an error about || not being promotable, which wasn't particularly good as a user-facing error message. So I think the current explicit check against arrays was designed to generate a better error for users for a case that we'd put not effort into supporting.
It could also be that we did discuss adding array support, didn't want to take the time to design or implement it at that point, and so put it off, figuring we could always add it later since it's not a breaking change.
I think it would be very reasonable to file a feature request issue requesting to extend it to support arrays if you'd like to do that. The following represents a very quick sketch that I believe is correct (but may benefit from more work to generate better error messages? and we'd probably want to hoist the repeated default argument values into module-level [config?] params to avoid the chance that they diverge over time):
proc isClose(X:[], Y:[], relTol = 1e-5, absTol = 0.0) {
return [(x,y) in zip(X, Y)] isClose(x, y, relTol, absTol);
}
proc isClose(X:[], y, relTol = 1e-5, absTol = 0.0) {
return [x in X] isClose(x, y, relTol, absTol);
}
proc isClose(x, Y:[], relTol = 1e-5, absTol = 0.0) {
return [y in Y] isClose(x, y, relTol, absTol);
}
Hope this helps,
-Brad