- class zmodn.Zmodn
Represents elements in the ring of integers modulo n \((Z/nZ)\).
This class provides operations for modular arithmetic, including addition, subtraction, multiplication, division, and exponentiation. It also supports matrix operations and modular inverses.
Constructors¶
- Zmodn(matrix_integers, module)
Initialize a Zmodn object.
Special methods¶
- __array_function__(func, types, args, kwargs)
Implement NumPy’s __array_function__ protocol for custom array-like behavior.
- __bool__()
Check if the Zmodn object is True (non-zero).
- __contains__(item)
Check if an item is in the Zmodn object.
- __delitem__(key)
Delete an item or slice from the Zmodn object.
- __getitem__(key)
Get an item or slice from the Zmodn object.
- __hash__()
Compute a hash value for the Zmodn object.
- __int__()
Convert the Zmodn object to an integer.
- __iter__()
Create an iterator for the Zmodn object.
- __len__()
Get the length of the Zmodn object.
- __matmul__(other)
Perform matrix multiplication of two Zmodn objects.
- __neg__()
Negate the Zmodn object.
- __pos__()
Return the positive of the Zmodn object (identity operation).
- __reversed__()
Create a reversed iterator for the Zmodn object.
- __setitem__(key, value)
Set an item or slice in the Zmodn object.
- __truediv__(other)
Divide two Zmodn objects.
String representation¶
- __repr__()
Return a string representation of the Zmodn object.
Methods¶
- static implements(numpy_function)
Decorator to register implementations of NumPy functions for Zmodn objects.
- inv()
Compute the inverse of the Zmodn object (for both scalars and matrices).
- mod_inv()
Compute the modular inverse of the Zmodn object.
Properties¶
- property classes
Return the representatives of the Zmodn object as a list of Zmodn objects.