Function tea_core::testing::assert_vec1d_equal_numeric
source · pub fn assert_vec1d_equal_numeric<T: IsNone + Debug, V1: Vec1View<T>, V2: Vec1View<T>>(
v1: &V1,
v2: &V2,
epsilon: Option<f64>,
)Expand description
Asserts that two 1-dimensional vectors are approximately equal within a specified epsilon.
This function compares two vectors element by element, considering numeric equality within the given epsilon and handling special cases like NaN and None values.
§Arguments
v1- A reference to the first vector implementingVec1View<T>v2- A reference to the second vector implementingVec1View<T>epsilon- An optional f64 value specifying the maximum allowed difference between elements. If None, the defaultEPSvalue is used.
§Type Parameters
T- The element type, which must implementIsNoneandDebugV1,V2- Types implementingVec1View<T>
§Panics
This function will panic if:
- The lengths of
v1andv2are not equal - One vector has a None value where the other doesn’t
- The absolute difference between corresponding non-NaN elements exceeds epsilon
- One element is NaN while the other isn’t