Example #1
0
 /// <summary>
 /// Returns true iff <paramref name="x"/> is strictly not equal to <paramref name="y"/> in the total order <paramref name="order"/>.
 /// </summary>
 /// <typeparam name="T">The type of the elements in the relation.</typeparam>
 /// <param name="order">The total order.</param>
 /// <param name="x">The first element to compare.</param>
 /// <param name="y">The second element to compare.</param>
 public static bool Neq <T>(this ITotalOrder <T> order, T x, T y)
 => order.Compare(x, y) != 0;
Example #2
0
 /// <summary>
 /// Returns true iff <paramref name="x"/> is strictly greater than <paramref name="y"/> in the total order <paramref name="order"/>.
 /// </summary>
 /// <typeparam name="T">The type of the elements in the relation.</typeparam>
 /// <param name="order">The total order.</param>
 /// <param name="x">The first element to compare.</param>
 /// <param name="y">The second element to compare.</param>
 public static bool Ge <T>(this ITotalOrder <T> order, T x, T y)
 => order.Compare(x, y) > 0;
Example #3
0
 /// <summary>
 /// Returns the sign (-1 for negative values, 0 for 0, 1 for positive values) of an element <paramref name="x"/>.
 /// </summary>
 /// <typeparam name="TStructure">The type of the algebraic structure to use.</typeparam>
 /// <typeparam name="T">The type of the elements.</typeparam>
 /// <param name="st">The algebraic structure to use</param>
 /// <param name="order">The total order.</param>
 /// <param name="x">The element whose sign to get.</param>
 public static int Signum <TStructure, T>(this TStructure st, ITotalOrder <T> order, T x)
     where TStructure : INeutralElement <T>
 => order.Compare(x, st.Neutral);