[index]
(Class of Residue Class Ring)
This class represents a residue class ring. To create concrete class, use the class method ::create or the function Algebra.ResidueClassRing() designating the base ring and the element of it.
none.
Algebra.ResidueClassRing(ring, mod)
::create(ring, mod)
Returns the class of the residue class ring of the ring and the modulus mod.
This class is a subclass of ResidueClassRing and
has the class methods ::ground, ::modulus and [x]
, which return the fundamental ring ring, the modulus
mod and the representing residue class of x, respectively.
Example: divide the polynomial ring by the modulus x**2 + x + 1
.
require "rational" require "polynomial" require "residue-class-ring" Px = Algebra.Polynomial(Rational, "x") x = Px.var F = ResidueClassRing(Px, x**2 + x + 1) p F[x + 1]**100 #=> -x - 1
When ring is Integer, all inverse elements are calculated
in advance. And we can obtain the residue classes of
0, 1, ... , mod-1
by to_ary.
Example: the prime field of modulo 7
require "residue-class-ring" F7 = Algebra::ResidueClassRing.create(Integer, 7) a, b, c, d, e, f, g = F7 p [e + c, e - c, e * c, e * 2001, 3 + c, 1/c, 1/c * c] #=> [6, 2, 1, 3, 5, 4, 1] p( (1...7).collect{|i| F7[i]**6} ) #=> [1, 1, 1, 1, 1, 1]
::[x]
::zero
::unity
lift
zero?
zero
unity
==(other)
+(other)
-(other)
*(other)
**(n)
/(other)
inverse