permaviss.gauss_mod_p.arithmetic_mod_p

arithmetic_mod_c.py

Arithmetic functions for working mod c Also includes function for inverses mod a prime number p

Functions

add_arrays_mod_c(A, B, c) Adds two arrays mod c.
add_mod_c(a, b, c) Integer addition mod c.
inv_mod_p(a, p) Returns the inverse of a mod p
permaviss.gauss_mod_p.arithmetic_mod_p.add_arrays_mod_c(A, B, c)[source]

Adds two arrays mod c.

Parameters:
  • a,b (Numpy Array(int)) – Two integer arrays to be added.
  • c (int) – Integer to mod out by.
Returns:

C – a + b (mod c)

Return type:

Numpy Array(int)

permaviss.gauss_mod_p.arithmetic_mod_p.add_mod_c(a, b, c)[source]

Integer addition mod c.

Parameters:
  • a,b (int) – Integers to be added
  • c (int) – Integer to mod out by
Returns:

s

Return type:

a + b (mod c)

permaviss.gauss_mod_p.arithmetic_mod_p.inv_mod_p(a, p)[source]

Returns the inverse of a mod p

Parameters:
  • a (int) – Number to compute the inverse mod p
  • p (int(prime)) –
Returns:

m – Integer such that m * a = 1 (mod p)

Return type:

int

Raises:

ValueError – If p is not a prime number