CGAL 5.6.3 - Number Types

Loading...
Searching...
No Matches
Classes | Functions
Relates Algebraic Extensions
Number Types Reference

##

## Classes
struct | CGAL::Root_of_traits< RT >
| For a `RealEmbeddable` `IntegralDomain` `RT`, the class template `Root_of_traits<RT>` associates a type `Root_of_2`, which represents algebraic numbers of degree 2 over `RT`. More...
class | CGAL::Sqrt_extension< NT, Root, DifferentExtensionComparable, FilterPredicates >
| An instance of this class represents an extension of the type `NT` by one square root of the type `Root`. More...

## Functions
template<typename RT , typename OutputIterator >
OutputIterator | CGAL::compute_roots_of_2 (const RT &a, const RT &b, const RT &c, OutputIterator oit)
| The function `compute_roots_of_2()` solves a univariate polynomial as it is defined by the coefficients given to the function.
template<typename RT >
Root_of_traits< RT >::Root_of_2 | CGAL::make_root_of_2 (const RT &a, const RT &b, const RT &c, bool s)
| The function `make_root_of_2()` constructs an algebraic number of degree 2 over a ring number type.
template<typename RT >
Root_of_traits< RT >::Root_of_2 | CGAL::make_root_of_2 (RT alpha, RT beta, RT gamma)
| The function `make_root_of_2()` constructs an algebraic number of degree 2 over a ring number type.
template<typename RT >
Root_of_traits< RT >::Root_of_2 | CGAL::make_sqrt (const RT &x)
| The function `make_sqrt()` constructs a square root of a given value of type `RT`.

## Function Documentation

## ◆ compute_roots_of_2()

template<typename RT , typename OutputIterator >

OutputIterator CGAL::compute_roots_of_2 | ( | const RT & | a,
|  | const RT & | b,
|  | const RT & | c,
|  | OutputIterator | oit
| ) |  |

`#include <CGAL/Root_of_traits.h>`

The function `compute_roots_of_2()` solves a univariate polynomial as it is defined by the coefficients given to the function.

The solutions are written into the given `OutputIterator`. Writes the real roots of the polynomial \( aX^2+bX+c\) into `oit` in ascending order.

`OutputIterator` is required to accept `Root_of_traits<RT>::Root_of_2`.

Multiplicities are not reported.

Precondition
  `RT` is an `IntegralDomainWithoutDivision`.
  \( a\neq0\) or \( b\neq0\).

See also
  `RootOf_2`
  `CGAL::Root_of_traits<RT>`
  `CGAL::make_root_of_2()`
  `CGAL::make_sqrt()`
  `CGAL::Sqrt_extension<NT,ROOT>`

## ◆ make_root_of_2() [1/2]

template<typename RT >

Root_of_traits< RT >::Root_of_2 CGAL::make_root_of_2 | ( | const RT & | a,
|  | const RT & | b,
|  | const RT & | c,
|  | bool | s
| ) |  |

`#include <CGAL/Root_of_traits.h>`

The function `make_root_of_2()` constructs an algebraic number of degree 2 over a ring number type.

Returns the smallest real root of the polynomial \( aX^2+bX+c\) if \( s\) is `true`, and the largest root is \( s\) is `false`.

Precondition
  `RT` is an `IntegralDomainWithoutDivision`.
  The polynomial has at least one real root.

See also
  `RootOf_2`
  `CGAL::Root_of_traits<RT>`
  `CGAL::make_sqrt()`
  `CGAL::compute_roots_of_2()`
  `CGAL::Sqrt_extension<NT,ROOT>`

## ◆ make_root_of_2() [2/2]

template<typename RT >

Root_of_traits< RT >::Root_of_2 CGAL::make_root_of_2 | ( | RT | alpha,
|  | RT | beta,
|  | RT | gamma
| ) |  |

`#include <CGAL/Root_of_traits.h>`

The function `make_root_of_2()` constructs an algebraic number of degree 2 over a ring number type.

Constructs the number \( \alpha+ \beta\sqrt{\gamma}\).

Precondition
  `RT` is an `IntegralDomainWithoutDivision`.
  \( \gamma\geq0\)

See also
  `RootOf_2`
  `CGAL::Root_of_traits<RT>`
  `CGAL::make_sqrt()`
  `CGAL::compute_roots_of_2()`
  `CGAL::Sqrt_extension<NT,ROOT>`

## ◆ make_sqrt()

template<typename RT >

Root_of_traits< RT >::Root_of_2 CGAL::make_sqrt | ( | const RT & | x | ) |

`#include <CGAL/Root_of_traits.h>`

The function `make_sqrt()` constructs a square root of a given value of type `RT`.

Depending on the type `RT` the square root may be returned in a new type that can represent algebraic extensions of degree \( 2\).

Returns
  \( \sqrt{x}.\)

Precondition
  `RT` is a `RealEmbeddable` `IntegralDomain`.
  \( x \leq0 \)

See also
  `RootOf_2`
  `CGAL::make_root_of_2()`
  `CGAL::Root_of_traits<RT>`