pub trait CompareBase<T = Self> {
// Provided methods
fn compare_base(&self, other: &T) -> bool { ... }
fn call_compare_base_error(&self, other: &T) -> Option<MathError> { ... }
}Expand description
Is implemented by every type where a base-check might be needed. This also includes every type of matrix, because it allows for geneceric implementations. Per default, a basecheck simply returs that the bases match and no error is returned.
Provided Methods§
Sourcefn compare_base(&self, other: &T) -> bool
fn compare_base(&self, other: &T) -> bool
Compares the base elements of the objects and returns true if they match and an operation between the two provided types is possible.
Parameters:
other: The other object whose base is compared toself
Returns true if the bases match and false otherwise. The default implementation just returns true.
Sourcefn call_compare_base_error(&self, other: &T) -> Option<MathError>
fn call_compare_base_error(&self, other: &T) -> Option<MathError>
Calls an error that gives small explanation how the base elements differ. This function only calls the error and does not check if the two actually differ.
Parameters:
other: The other object whose base is compared toself
Returns a MathError, typically MathError::MismatchingModulus.
The default implementation just returns None.