@@ -18,6 +18,22 @@ impl CompareBase for MatPolynomialRingZq {
18
18
/// - `other`: The other objects whose base is compared to `self`
19
19
///
20
20
/// Returns true if the moduli match and false otherwise.
21
+ ///
22
+ /// # Example
23
+ /// ```
24
+ /// use qfall_math::{
25
+ /// integer_mod_q::{MatPolynomialRingZq, ModulusPolynomialRingZq},
26
+ /// traits::CompareBase,
27
+ /// };
28
+ /// use std::str::FromStr;
29
+ ///
30
+ /// let modulus = ModulusPolynomialRingZq::from_str("3 1 0 1 mod 17").unwrap();
31
+ /// let one_1 = MatPolynomialRingZq::identity(10, 7, &modulus);
32
+ /// let modulus = ModulusPolynomialRingZq::from_str("4 1 0 0 1 mod 23").unwrap();
33
+ /// let one_2 = MatPolynomialRingZq::identity(10, 7, &modulus);
34
+ ///
35
+ /// assert!(!one_1.compare_base(&one_2));
36
+ /// ```
21
37
fn compare_base ( & self , other : & Self ) -> bool {
22
38
self . get_mod ( ) == other. get_mod ( )
23
39
}
@@ -28,6 +44,22 @@ impl CompareBase for MatPolynomialRingZq {
28
44
/// - `other`: The other objects whose base is compared to `self`
29
45
///
30
46
/// Returns a MathError of type [MathError::MismatchingModulus].
47
+ ///
48
+ /// # Example
49
+ /// ```
50
+ /// use qfall_math::{
51
+ /// integer_mod_q::{MatPolynomialRingZq, ModulusPolynomialRingZq},
52
+ /// traits::CompareBase,
53
+ /// };
54
+ /// use std::str::FromStr;
55
+ ///
56
+ /// let modulus = ModulusPolynomialRingZq::from_str("3 1 0 1 mod 17").unwrap();
57
+ /// let one_1 = MatPolynomialRingZq::identity(10, 7, &modulus);
58
+ /// let modulus = ModulusPolynomialRingZq::from_str("4 1 0 0 1 mod 23").unwrap();
59
+ /// let one_2 = MatPolynomialRingZq::identity(10, 7, &modulus);
60
+ ///
61
+ /// assert!(one_1.call_compare_base_error(&one_2).is_some());
62
+ /// ```
31
63
fn call_compare_base_error ( & self , other : & Self ) -> Option < MathError > {
32
64
Some ( MathError :: MismatchingModulus ( format ! (
33
65
"The moduli of the matrices mismatch. One of them is {} and the other is {}.
0 commit comments