@@ -503,7 +503,10 @@ std::unordered_map<Shared<const CoordinateSubset>, bool> State::isNear(
503503{
504504 if (aToleranceMap.size () != coordinatesBrokerSPtr_->accessSubsets ().getSize ())
505505 {
506- throw ostk::core::error::runtime::Wrong (" Tolerance Map" );
506+ throw ostk::core::error::runtime::Wrong (
507+ " Tolerance Map: Expected size [" + std::to_string (coordinatesBrokerSPtr_->accessSubsets ().getSize ()) +
508+ " ], but received size [" + std::to_string (aToleranceMap.size ()) + " ]."
509+ );
507510 }
508511
509512 const State deltaState = aState - *this ;
@@ -550,20 +553,17 @@ std::unordered_map<Shared<const CoordinateSubset>, Array<bool>> State::isNear(
550553
551554 if (toleranceArray.size () != deltaCoordinates.size ())
552555 {
553- throw ostk::core::error::runtime::Wrong (" Tolerance Array Size" );
556+ throw ostk::core::error::runtime::Wrong (
557+ " Tolerance Array Size: Expected [" + std::to_string (deltaCoordinates.size ()) +
558+ " ], but got [" + std::to_string (toleranceArray.size ()) + " ]"
559+ );
554560 }
555561 if ((toleranceArray.array () <= 0.0 ).any ())
556562 {
557563 throw ostk::core::error::runtime::Wrong (" Tolerance Array" );
558564 }
559565
560- Array<bool > isNearArray;
561- isNearArray.reserve (deltaCoordinates.size ());
562- for (int i = 0 ; i < deltaCoordinates.size (); ++i)
563- {
564- isNearArray.add (std::abs (deltaCoordinates[i]) <= toleranceArray[i]);
565- }
566- isNearMap[subsetSPtr] = isNearArray;
566+ Eigen::ArrayXb isNear = deltaCoordinates.abs () <= toleranceArray
567567 }
568568 return isNearMap;
569569}
0 commit comments