isequaln — Test array equality while treating NaN values as equal.
isequaln(A, B, ...) returns true when every input has matching shape, compatible class, and equal contents, with NaN values considered equal.
Syntax
tf = isequaln(A, B, ...)Inputs
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
A | Any | Variadic | — | Values to compare (at least two). |
Returns
| Name | Type | Description |
|---|---|---|
tf | LogicalArray | True when all inputs are equal in size, class, and content. |
Errors
| Identifier | When | Message |
|---|---|---|
RunMat:isequal:NotEnoughInputs | Fewer than two arguments are supplied. | isequal: requires at least two input arguments |
RunMat:isequal:Internal | Internal gather/host normalization fails. | isequal: internal error |
How isequaln works
- Accepts two or more inputs and compares every input against the first.
- Treats
NaNvalues as equal, including inside numeric arrays, complex values, cells, and structs. - Requires arrays to have identical shape.
- Compares cell arrays and structs recursively.
- Returns a scalar logical value.
Does RunMat run isequaln on the GPU?
isequaln does not currently execute comparison on device; it gathers GPU tensors before comparing values recursively.
GPU memory and residency
GPU inputs are gathered to host and the result is a host logical scalar.
Examples
Comparing NaN values
isequaln(NaN, NaN)Expected output:
ans = logical
1Comparing arrays recursively
isequaln({[1 NaN]}, {[1 NaN]})Expected output:
ans = logical
1Using isequaln with coding agents
Open a RunMat example with live inputs, then ask the agent to explain how isequaln changes the result.
Run a small isequaln example, explain the result, then change one input and compare the output.
FAQ
How is isequaln different from isequal?⌄
isequaln treats NaN values as equal. isequal returns false when corresponding values are both NaN.
Related Logical functions
Open-source implementation
Unlike proprietary runtimes, every RunMat function is open-source. Read exactly how isequaln is executed, line by line, in Rust.
- View the source for isequaln in Rust on GitHub
- Learn how the RunMat runtime works
- Found a bug? Open an issue with a minimal reproduction.
About RunMat
RunMat is an open-source runtime that executes MATLAB-syntax code blazing on any GPU. It is licensed under the Apache 2.0 license.
- RunMat automatically optimizes your math for GPU execution on Apple, Nvidia, and AMD hardware. No code changes needed. Simulations that took hours now take minutes.
- Start running code in seconds. RunMat runs in the browser, on the desktop, or from the CLI. No license server, no IT ticket.