Go to the first, previous, next, last section, table of contents.

# 6. Rings

CLN has a class of abstract rings.

                             Ring
                           cl_ring
                         <cln/ring.h>

Rings can be compared for equality:

`bool operator== (const cl_ring&, const cl_ring&)`
`bool operator!= (const cl_ring&, const cl_ring&)`
  These compare two rings for equality.

Given a ring `R`, the following members can be used.

`void R->fprint (std::ostream& stream, const cl_ring_element& x)`
`cl_boolean R->equal (const cl_ring_element& x, const cl_ring_element& y)`
`cl_ring_element R->zero ()`
`cl_boolean R->zerop (const cl_ring_element& x)`
`cl_ring_element R->plus (const cl_ring_element& x, const cl_ring_element& y)`
`cl_ring_element R->minus (const cl_ring_element& x, const cl_ring_element& y)`
`cl_ring_element R->uminus (const cl_ring_element& x)`
`cl_ring_element R->one ()`
`cl_ring_element R->canonhom (const cl_I& x)`
`cl_ring_element R->mul (const cl_ring_element& x, const cl_ring_element& y)`
`cl_ring_element R->square (const cl_ring_element& x)`
`cl_ring_element R->expt_pos (const cl_ring_element& x, const cl_I& y)`

The following rings are built-in.

`cl_null_ring cl_0_ring`
  The null ring, containing only zero.
`cl_complex_ring cl_C_ring`
  The ring of complex numbers. This corresponds to the type `cl_N`.
`cl_real_ring cl_R_ring`
  The ring of real numbers. This corresponds to the type `cl_R`.
`cl_rational_ring cl_RA_ring`
  The ring of rational numbers. This corresponds to the type `cl_RA`.
`cl_integer_ring cl_I_ring`
  The ring of integers. This corresponds to the type `cl_I`.

Type tests can be performed for any of `cl_C_ring`, `cl_R_ring`, `cl_RA_ring`, `cl_I_ring`:

`cl_boolean instanceof (const cl_number& x, const cl_number_ring& R)`
  Tests whether the given number is an element of the number ring R.

Go to the first, previous, next, last section, table of contents.