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

__add__(other)

Add two Zmodn objects.

__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.

__eq__(other)

Check if two Zmodn objects are equal.

__ge__(other)

Check if this Zmodn object is greater than or equal to another.

__getitem__(key)

Get an item or slice from the Zmodn object.

__gt__(other)

Check if this Zmodn object is greater than another.

__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.

__le__(other)

Check if this Zmodn object is less than or equal to another.

__len__()

Get the length of the Zmodn object.

__lt__(other)

Check if this Zmodn object is less than another.

__matmul__(other)

Perform matrix multiplication of two Zmodn objects.

__mul__(other)

Multiply two Zmodn objects.

__ne__(other)

Check if two Zmodn objects are not equal.

__neg__()

Negate the Zmodn object.

__pos__()

Return the positive of the Zmodn object (identity operation).

__pow__(other)

Raise Zmodn object to a power.

__reversed__()

Create a reversed iterator for the Zmodn object.

__setitem__(key, value)

Set an item or slice in the Zmodn object.

__sub__(other)

Subtract two Zmodn objects.

__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.