You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "andishgar (via GitHub)" <gi...@apache.org> on 2025/06/10 14:26:05 UTC

Re: [I] [C++] Enable arrow::EqualOptions::use_atol_ for arrow::Array, arrow::Scalar, arrow::Tensor, and arrow::SparseTensor. [arrow]

andishgar commented on issue #46767:
URL: https://github.com/apache/arrow/issues/46767#issuecomment-2959468747

   @kou I have a question regarding `arrow::{Sparse,}Tensor` :
   Should I consider the following codes for` arrow::Tensor `and `arrow::SparseTensor` a bug, as `arrow::EqualOptions::atol_ `is not included in the comparison?
   https://github.com/apache/arrow/blob/494d0e389cd96bbf860a31a1ccd6afbefadefb2e/cpp/src/arrow/compare.cc#L1280-L1281
   https://github.com/apache/arrow/blob/494d0e389cd96bbf860a31a1ccd6afbefadefb2e/cpp/src/arrow/compare.cc#L1360-L1375
   
   I mean such an assertion, it has passed
   
   ```c++
   TEST(Tensor,FloatComparasion) {
     std::vector<double> v1 = {0.5};
     std::vector<double> v2 = {0.5001};
     std::shared_ptr<Buffer> b1 = Buffer::Wrap(v1);
     std::shared_ptr<Buffer> b2 = Buffer::Wrap(v2);
     NumericTensor<DoubleType> t1(b1, {1, 1});
     NumericTensor<DoubleType> t2(b2, {1, 1});
     auto st1 = SparseCSCMatrix::Make(t1).ValueOrDie();
     auto st2 = SparseCSCMatrix::Make(t2).ValueOrDie();
     ASSERT_FALSE(t1.Equals(t2, EqualOptions::Defaults().atol(1e-3)));
     ASSERT_FALSE(st1->Equals(*st2, EqualOptions::Defaults().atol(1e-3)));
   }
   ``` 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org