regina::Cyclotomic Class Reference
Mathematical Support

Represents an element of a cyclotomic field. More...

`#include <maths/cyclotomic.h>`

Inheritance diagram for regina::Cyclotomic:

## Public Member Functions

| Cyclotomic ()
| Creates an uninitialised field element. More...
| Cyclotomic (size_t field)
| Creates the zero element of the given cyclotomic field. More...
| Cyclotomic (size_t field, int value)
| Creates the given integer element within the given cyclotomic field. More...
| Cyclotomic (size_t field, const Rational &value)
| Creates the given rational element within the given cyclotomic field. More...
| Cyclotomic (const Cyclotomic &value)
| Creates a copy of the given field element, within the same cyclotomic field. More...
| ~Cyclotomic ()
| Destroys this field element. More...
void | init (size_t field)
| Initialises this to be the zero element of the given cyclotomic field. More...
size_t | field () const
| Returns the order n of the underlying cyclotomic field to which this element belongs. More...
size_t | degree () const
| Returns the degree of the polynomial that defines the underlying cyclotomic field. More...
const Rational & | operator[] (size_t exp) const
| Returns an individual rational coefficient of the polynomial representation of this field element. More...
Rational & | operator[] (size_t exp)
| Offers access to an individual rational coefficient of the polynomial representation of this field element. More...
Polynomial< Rational > * | polynomial () const
| Returns the full polynomial representation of this field element. More...
std::complex< double > | evaluate (size_t whichRoot=1) const
| Returns the value of this cyclotomic field element as a complex number. More...
bool | operator== (const Cyclotomic &rhs) const
| Tests whether or not this and the given argument are the same element of the same cyclotomic field. More...
bool | operator!= (const Cyclotomic &rhs) const
| Tests whether or not this and the given argument are the same element of the same cyclotomic field. More...
Cyclotomic & | operator= (const Cyclotomic &value)
| Sets this to a copy of the given field element. More...
Cyclotomic & | operator= (const Rational &scalar)
| Sets this field element to the given rational. More...
void | negate ()
| Negates this field element. More...
void | invert ()
| Inverts this field element. More...
Cyclotomic & | operator*= (const Rational &scalar)
| Multiplies this field element by the given rational. More...
Cyclotomic & | operator/= (const Rational &scalar)
| Divides this field element by the given rational. More...
Cyclotomic & | operator+= (const Cyclotomic &other)
| Adds the given field element to this. More...
Cyclotomic & | operator-= (const Cyclotomic &other)
| Subtracts the given field element from this. More...
Cyclotomic & | operator*= (const Cyclotomic &other)
| Multiplies this by the given field element. More...
Cyclotomic & | operator/= (const Cyclotomic &other)
| Divides this by the given field element. More...
void | writeTextShort (std::ostream &out, bool utf8=false, const char *variable=0) const
| Writes this field element to the given output stream, using the given variable name instead of `x`. More...
std::string | str (const char *variable) const
| Returns this field element as a human-readable string, using the given variable name instead of `x`. More...
std::string | utf8 (const char *variable) const
| Returns this field element as a human-readable string using unicode characters, using the given variable name instead of `x`. More...
void | writeTextLong (std::ostream &out) const
| A default implementation for detailed output. More...
std::string | str () const
| Returns a short text representation of this object. More...
std::string | utf8 () const
| Returns a short text representation of this object using unicode characters. More...
std::string | detail () const
| Returns a detailed text representation of this object. More...

## Static Public Member Functions

static const Polynomial< Integer > & | cyclotomic (size_t n)
| Returns the nth cyclotomic polynomial `Φ_n`. More...

## Detailed Description

Represents an element of a cyclotomic field.

The cyclotomic field of order n extends the rationals with a primitive nth root of unity. This is isomorphic to the polynomial field `ℚ[x]/Φ_n`, where `Φ_n` is the nth cyclotomic polynomial.

Using this isomorphism, each element of the cyclotomic field can be uniquely represented as a rational polynomial of degree strictly less than `deg(Φ_n) = φ(n)`, where `φ` denotes Euler's totient function. This class stores field elements using such a polynomial representation, and does not store complex numbers directly. If you require the complex value of a field element (as a floating point approximation), you can call evaluate().

Each object of this class stores both the value of the field element and the order n of the underlying field. This means that you can freely work with elements of different fields simultaneously, though of course most operations (such as addition, multplication and so on) require all operands to belong to the same field.

This class requires that the order n is strictly positive.

Although this class makes use of global data in its implementation, all of its methods are thread-safe.

## Member Function Documentation

## detail()

std::string regina::Output< Cyclotomic , supportsUtf8 >::detail | ( |  | ) | const

inherited

Returns a detailed text representation of this object.

This text may span many lines, and should provide the user with all the information they could want. It should be human-readable, should not contain extremely long lines (which cause problems for users reading the output in a terminal), and should end with a final newline. There are no restrictions on the underlying character set.

Returns
  a detailed text representation of this object.

## str()

std::string regina::Output< Cyclotomic , supportsUtf8 >::str | ( |  | ) | const

inherited

Returns a short text representation of this object.

This text should be human-readable, should fit on a single line, and should not end with a newline. Where possible, it should use plain ASCII characters.

Python:\n In addition to str(), this is also used as the
  Python "stringification" function `__str__()`.

Returns
  a short text representation of this object.

## utf8()

std::string regina::Output< Cyclotomic , supportsUtf8 >::utf8 | ( |  | ) | const

inherited

Returns a short text representation of this object using unicode characters.

Like str(), this text should be human-readable, should fit on a single line, and should not end with a newline. In addition, it may use unicode characters to make the output more pleasant to read. This string will be encoded in UTF-8.

Returns
  a short text representation of this object.

## writeTextLong()

void regina::ShortOutput< Cyclotomic , supportsUtf8 >::writeTextLong | ( | std::ostream & | out | ) | const

inline inherited

A default implementation for detailed output.

This routine simply calls T::writeTextShort() and appends a final newline.

Python:\n Not present.

Parameters

  out | the output stream to which to write.

The documentation for this class was generated from the following file:

- maths/cyclotomic.h

Copyright © 1999-2016, The Regina development team
This software is released under the GNU General Public License, with some additional permissions; see the source code for details.
For further information, or to submit a bug or other problem, please contact Ben Burton (bab@maths.uq.edu.au).