MCPcopy Create free account
hub / github.com/apache/arrow / FloatSparseTensorDataEquals

Function FloatSparseTensorDataEquals

cpp/src/arrow/compare.cc:1348–1374  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1346
1347template <typename DataType>
1348bool FloatSparseTensorDataEquals(const typename DataType::c_type* left_data,
1349 const typename DataType::c_type* right_data,
1350 const int64_t length, const EqualOptions& opts) {
1351 using c_type = typename DataType::c_type;
1352 static_assert(std::is_floating_point<c_type>::value,
1353 "DataType must be a floating point type");
1354 if (opts.nans_equal()) {
1355 if (left_data == right_data) {
1356 return true;
1357 }
1358
1359 for (int64_t i = 0; i < length; ++i) {
1360 const auto left = left_data[i];
1361 const auto right = right_data[i];
1362 if (left != right && !(std::isnan(left) && std::isnan(right))) {
1363 return false;
1364 }
1365 }
1366 } else {
1367 for (int64_t i = 0; i < length; ++i) {
1368 if (left_data[i] != right_data[i]) {
1369 return false;
1370 }
1371 }
1372 }
1373 return true;
1374}
1375
1376template <typename SparseIndexType>
1377struct SparseTensorEqualsImpl<SparseIndexType, SparseIndexType> {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected