| 145 | } |
| 146 | |
| 147 | void ChunkedArray::isEqual(libmexclass::proxy::method::Context& context) { |
| 148 | namespace mda = ::matlab::data; |
| 149 | |
| 150 | const mda::TypedArray<uint64_t> chunked_array_proxy_ids = context.inputs[0]; |
| 151 | |
| 152 | bool is_equal = true; |
| 153 | for (const auto& chunked_array_proxy_id : chunked_array_proxy_ids) { |
| 154 | // Retrieve the ChunkedArray proxy from the ProxyManager |
| 155 | auto proxy = libmexclass::proxy::ProxyManager::getProxy(chunked_array_proxy_id); |
| 156 | auto chunked_array_proxy = std::static_pointer_cast<proxy::ChunkedArray>(proxy); |
| 157 | auto chunked_array_to_compare = chunked_array_proxy->unwrap(); |
| 158 | |
| 159 | // Use the ChunkedArray::Equals(const ChunkedArray& other) overload instead |
| 160 | // of ChunkedArray::Equals(const std::shared_ptr<ChunkedArray> other&) to |
| 161 | // ensure we don't assume chunked arrays with the same memory address are |
| 162 | // equal. This ensures we treat NaNs as not equal by default. |
| 163 | if (!chunked_array->Equals(*chunked_array_to_compare)) { |
| 164 | is_equal = false; |
| 165 | break; |
| 166 | } |
| 167 | } |
| 168 | mda::ArrayFactory factory; |
| 169 | context.outputs[0] = factory.createScalar(is_equal); |
| 170 | } |
| 171 | } // namespace arrow::matlab::array::proxy |