%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%
%%  quadratic_form.tex        LiDIA documentation
%%
%%  This file contains the documentation of the class
%%  quadratic_form
%%  
%%  Copyright (c) 1995 by the LiDIA Group
%%  
%%  Authors: Friedrich Eisenbrand, Michael J. Jacobson, Jr.,
%%		 Thomas Papanikolaou
%%  

\begin{lidia_man}
\markright{\BF{quadratic\_form}} 

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\NAME
	\BF{quadratic\_form} \DOTFILL binary quadratic forms

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\ABSTRACT
	\BF{quadratic\_form} is a class which represents binary quadratic
	forms, i.e., polynomials of the form
	 \MATH{f(X, Y) = a X^2 + b X Y + c Y^2 ~ \IN ~ \Z [X, Y]}.
	It supports many algorithms which evolve in the study of 
	binary quadratic forms, including equivalence testing, composition.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\DESCRIPTION
	A \BF{quadratic\_form} consists of an ordered triple  \MATH{(a, b, c)}
	which represents the form \MATH{f(X, Y) = a X^2 + b X Y + c Y^2}.
	The variables \MATH{a}, \MATH{b}, and \MATH{c} are all of type
	\BF{bigint}.  In addition to \MATH{a}, \MATH{b}, and \MATH{c}, a
	pointer to a \BF{quadratic\_order} is stored with each instance of
	\BF{quadratic\_form}.
	If \MATH{\Delta = b^2 - 4ac}, the discriminant of \MATH{f}, is not
	a perfect square, the pointer points to a \BF{quadratic\_order} of
	discriminant \MATH{\Delta}.  If \MATH{\Delta} is a perfect square
	(i.e., f is irregular), it is the NULL pointer.
	An initial \BF{quadratic\_order} may be set to which forms will belong
	when no explicit discriminant is given.  Otherwise, these forms will
	belong to the last specified \BF{quadratic\_order}.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\CONS

\fcode{ct }{quadratic\_form}{}{}
\fcode{ct }{quadratic\_form}{const qi\_class \& A}{
        initializes with the quadratic form associated with the reduced ideal
	\MATH{A}.}
\fcode{ct }{quadratic\_form}{const qi\_class\_real \& A}{
        initializes with the quadratic form associated with the reduced ideal
	\MATH{A}.}
\fcode{ct }{quadratic\_form}{const quadratic\_ideal \& A}{
        initializes with the quadratic form associated with the ideal
	\MATH{A}.  If \MATH{A} has a fractional multiplier, it is simply 
	ignored.}
\fcode{ct }{quadratic\_form}{const quadratic\_form \& f}{
        initializes a copy of \MATH{f}.}
\fcode{dt }{\SIM quadratic\_form}{}{}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\INIT

	An initial \BF{quadratic\_order} may be set to which forms will belong
	when no explicit discriminant is given.

\fcode{static void }{quadratic\_form::set\_current\_order}{quadratic\_order \& QO}{
        sets the current quadratic order to \MATH{QO}.}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\ASGN

	Let \MATH{f} be of type \BF{quadratic\_form}. The operator \TT{=} is
	overloaded. For efficiency reasons, the following functions are also
	implemented:

\fcode{void }{f.assign\_zero}{}{
        \MATH{f = (0,0,0)}.}

\fcode{void }{f.assign\_one}{const bigint \& Delta}{
        if \MATH{Delta} is a quadratic discriminant, \MATH{f} is set to the
	unit form (first coefficient is \MATH{1}) of discriminant \MATH{Delta},
	otherwise \MATH{f} is set to \MATH{(0, 0, 0)}.}

\fcode{void }{f.assign}{const bigint \& a, const bigint \& b, const bigint \& c}{
	sets \MATH{f} to the form \MATH{(a,b,c)}.}

\fcode{void }{f.assign}{const long a, const long b, const bigint \& c}{
	sets \MATH{f} to the form \MATH{(a,b,c)}.}

\fcode{void }{f.assign}{const qi\_class \& A}{
        sets \MATH{F} to the quadratic form associated with the reduced ideal
	\MATH{A}.}

\fcode{void }{f.assign}{const qi\_class\_real \& A}{
        sets \MATH{F} to the quadratic form associated with the reduced ideal
	\MATH{A}.}

\fcode{void }{f.assign}{const quadratic\_ideal \& A}{
        sets \MATH{f} to the quadratic form associated with the ideal
	\MATH{A}.  If \MATH{A} has a fractional multiplier, it is simply 
	ignored.}

\fcode{void }{f.assign}{const quadratic\_form \& g}{
	\MATH{f = g}.}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\ACCS

	Let \MATH{f} be of type \BF{quadratic\_form}.

\cfcode{bigint }{f.get\_a}{}{
	returns the value of \MATH{a}.}
\cfcode{bigint }{f.get\_b}{}{
	returns the value of \MATH{b}.}
\cfcode{bigint }{f.get\_c}{}{
	returns the value of \MATH{c}.}
\cfcode{bigint }{f.discriminant}{}{
        returns the discriminant of \MATH{f}.}
\cfcode{quadratic\_order * }{f.which\_order}{}{
        returns a pointer to the \BF{quadratic\_order} of the same discriminant
	as \MATH{f}, or the NULL pointer if \MATH{f} is irregular.}
\fcode{quadratic\_order * }{which\_order}{const quadratic\_form \& f}{
        returns a pointer to the \BF{quadratic\_order} of the same discriminant
	as \MATH{f}, or the NULL pointer if \MATH{f} is irregular.}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\ARTH

        Let \MATH{f} be of type \BF{quadratic\_form}.
        The following operators are overloaded and can be used in
        exactly  the  same  way  as in the programming language C.
        \begin{center}
        \TT{(unary) -}\\
        \TT{(binary) *, /}\\
        \TT{(binary with assignment) *=,  /=}\\
        \end{center}
        \BF{Note:} By \MATH{-f} and \MATH{f^{-1}} we denote the conjugate of
        \MATH{f}, by \MATH{f * g} we denote the composition of \MATH{f} and
	\MATH{g}, and by \MATH{f / g} we denote \MATH{f * g^{-1}}.

        To  avoid copying, these operations can also be performed
        by the following functions:

\fcode{void }{compose}{quadratic\_form \& f, const quadratic\_form \& g1, const quadratic\_form \& g2}{
        \MATH{f = g1 * g2}.  If \MATH{g1} and \MATH{g2} do not have the same
        discriminant, the \BF{error\_handler} will be evoked.}

\fcode{void }{compose\_reduce}{quadratic\_form \& f, const quadratic\_form \& g1, const quadratic\_form \& g2}{
        \MATH{f} is set to a reduced form equivalent to \MATH{g1 * g2}.
	If \MATH{g1} and \MATH{g2} do not have the same discriminant, the
	\BF{error\_handler} will be evoked.}

\fcode{void }{nucomp}{quadratic\_form \& f, const quadratic\_form \& g1, const quadratic\_form \& g1 }{
        \MATH{f} is set to a reduced form equivalent to \MATH{g1 * g2} using
	the NUCOMP algorithm of Shanks \cite{cohen}.
	Both \MATH{g1} and \MATH{g2} must be positive of negative definite,
	otherwise the \BF{error\_handler} will be evoked.}

\fcode{void }{f.conjugate}{}{
	the coefficient \MATH{b} of \MATH{f} is negated.}

\fcode{void }{get\_conjugate}{quadratic\_form \& f, const quadratic\_form \& g}{
        \MATH{f} is set to \MATH{g} with the \MATH{b} coefficient negated.}

\fcode{quadratic\_form }{get\_conjugate}{quadratic\_form \& f}{
	\MATH{f} is returned with its \MATH{b} coefficient negated.}

\fcode{void }{divide}{quadratic\_form \& f, const quadratic\_form \& g1, const quadratic\_form \& g2}{
        \MATH{f = g1 * g2^{-1}}.  If \MATH{g1} and \MATH{g2} are not of the
	same quadratic order or if \MATH{g2 = (0)}, the \BF{error\_handler}
	will be evoked.}

\fcode{void }{divide\_reduce}{quadratic\_form \& f, const quadratic\_form \& g1, const quadratic\_form \& g2}{
        \MATH{f} is set to a reduced form equivalent to \MATH{g1 * g2^{-1}}.
	If \MATH{g1} and \MATH{g2} are not of the same quadratic order or if
	\MATH{g2 = (0)}, the \BF{error\_handler} will be evoked.}

\fcode{void }{square}{quadratic\_form \& f, const quadratic\_form \& g}{
        \MATH{f = g^2}.}

\fcode{void }{square\_reduce}{quadratic\_form \& f, const quadratic\_form \& g}{
        \MATH{f} is set to a reduced form equivalent to \MATH{g^2}.}

\fcode{void }{nudupl}{quadratic\_form \& f, const quadratic\_form \& g}{
        \MATH{f} is set to a reduced form equivalent to \MATH{g^2} using the
        NUDUPL algorithm of Shanks \cite{cohen}.
	The form \MATH{g} must be positive of negative definite,
	otherwise the \BF{error\_handler} will be evoked.}

\fcode{void }{power}{quadratic\_form \& f, const quadratic\_form \& g, const bigint \& i}{
        \MATH{f = g^i}.  If \MATH{i < 0}, \MATH{h^i} is computed where
	\MATH{h} is equal to the conjugate of \MATH{g}.}

\fcode{void }{power\_reduce}{quadratic\_form \& f, const quadratic\_form \& g, const bigint \& i}{
        \MATH{f} is set to a reduced form equivalent to \MATH{g^i}.
	If \MATH{i < 0}, \MATH{h^i} is computed where \MATH{h} is equal to the
	conjugate of \MATH{g}.}

\fcode{void }{nupower}{quadratic\_form \& f, const quadratic\_form \& g, const bigint \& i}{
        \MATH{f} is set to a reduced form equivalent to \MATH{g^i} using the
	NUCOMP and NUDUPL algorithms of Shanks \cite{cohen} to compute the
	intermediate products.
	If \MATH{i < 0}, \MATH{h^i} is computed where \MATH{h} is equal to the
	conjugate of \MATH{g}.
	The form \MATH{g} must be positive of negative definite,
	otherwise the \BF{error\_handler} will be evoked.}

\fcode{void }{power}{quadratic\_form \& f, const quadratic\_form \& g, const long i}{}
\fcode{void }{power\_reduce}{quadratic\_form \& f, const quadratic\_form \& g, const long i}{}
\fcode{void }{nupower}{quadratic\_form \& f, const quadratic\_form \& g, const long i}{}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\COMP

	The binary operators \TT{<=}, \TT{==}, \TT{>=}, \TT{!=}, \TT{<}, \TT{>}
	are overloaded and mean the usual lexicographic ordering of the
	triples \MATH{(a,b,c)}.  The unary operator \TT{!} (comparison with
	\MATH{(0,0,0)}) is also overloaded.

        Let \MATH{f} be an instance of type \BF{quadratic\_form}.

\cfcode{bool }{f.is\_zero}{}{
        returns \TRUE\ if \MATH{f = (0,0,0)}, \FALSE\ otherwise.}
\cfcode{bool }{f.is\_one}{}{
        returns \TRUE\ if the \MATH{a} coefficient of \MATH{f} is \MATH{1},
	\FALSE\ otherwise.}
\cfcode{bool }{f.is\_equal}{const quadratic\_form \& g}{
        returns \TRUE\ if \MATH{f} and \MATH{g} are equal, \FALSE\ otherwise.}
\cfcode{int }{f.compare}{const quadratic\_form \& g}{
	returns \MATH{-1} if \MATH{f \LT g}, \MATH{0} if \MATH{f = g}, and
	\MATH{1} if \MATH{f \GT g}.}
\cfcode{bool }{f.abs\_compare}{const quadratic\_form \& g}{
	returns \MATH{-1} if \MATH{f \LT g}, \MATH{0} if \MATH{f = g}, and
	\MATH{1} if \MATH{f \GT g}, where the coefficients are taken to be 
	the absolute values of the actual coefficients.}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\BASIC

\cfcode{operator}{qi\_class}{}{
        cast operator which implicitly converts a \BF{quadratic\_form} to a
        positively oriented \BF{qi\_class}.}
\cfcode{operator}{qi\_class\_real}{}{
        cast operator which implicitly converts a \BF{quadratic\_form} to a
        positively oriented \BF{qi\_class\_real}.}
\cfcode{operator}{quadratic\_ideal}{}{
        cast operator which implicitly converts a \BF{quadratic\_form} to a
        positively oriented \BF{quadratic\_ideal}.}
\fcode{void }{swap}{quadratic\_form \& f, quadratic\_form \& g}{
        exchanges the values of \MATH{f} and \MATH{g}.}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\HIGH

        Let \MATH{f} be of type \BF{quadratic\_form}.  The operator \TT{()}
	is overloaded, and can be used in place of the function 
	\BF{eval}.

\cfcode{int }{f.definiteness}{}{
	returns \MATH{1}\ if \MATH{f} is positive definite, \MATH{-1}
	if it is negative definite, \MATH{0} if it is indefinite, and \MATH{2}
	if it is irregular.}

\cfcode{bool }{f.is\_pos\_definite}{}{
	returns \TRUE\ if \MATH{f} is positive definite, \FALSE\ otherwise.}

\cfcode{bool }{f.is\_pos\_semidefinite}{}{
	returns \TRUE\ if \MATH{f} is positive semidefinite, \FALSE\ 
	otherwise.}

\cfcode{bool }{f.is\_indefinite}{}{
	returns \TRUE\ if \MATH{f} is indefinite and regular, \FALSE\
	otherwise.}

\cfcode{bool }{f.is\_neg\_definite}{}{
	returns \TRUE\ if \MATH{f} is negative definite, \FALSE\ otherwise.}

\cfcode{bool }{f.is\_neg\_semidefinite}{}{
	returns \TRUE\ if \MATH{f} is negative semidefinite, \FALSE\ 
	otherwise.}

\cfcode{bool }{f.is\_regular}{}{
	returns \TRUE\ if \MATH{f} is regular, \FALSE\ otherwise.}

\cfcode{bigint }{f.content}{}{
        returns the content of \MATH{f}, the gcd of its coefficients.}

\cfcode{bool }{f.is\_primitive}{}{
        returns \TRUE\ if \MATH{f} is primitive (content is one),
	\FALSE\ otherwise.}

\cfcode{bigint }{f.eval}{const bigint \& x, const bigint \& y}{
	returns \MATH{f(x, y)}.}

\fcode{void }{f.transform}{const matrix\_GL2Z \& U}{
	\MATH{f = fU}.}

\fcode{bool }{prime\_form}{quadratic\_form f, const bigint \& p, const bigint \& Delta}{
        attempts to set \MATH{f} to the prime form corresponding to \MATH{p}
	of discriminant \MATH{Delta} (first coefficient is \MATH{p}).  If
	successful (the Kronecker symbol \MATH{(Delta/p) \NEQ -1}),
        \TRUE\ is returned, otherwise \FALSE\ is returned.}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\SSTITLE{Normalization and Reduction}

\fcode{bool }{f.is\_normal}{}{
	returns \TRUE\ if \MATH{f} is normal, \FALSE\ otherwise.}

\fcode{void }{f.normalize}{}{
	\MATH{f} is set to its normalization.}

\fcode{void }{f.normalize}{matrix\_GL2Z \& U}{
	\MATH{f} is set to its normalization.  \MATH{U} is set to the
	matrix product of \MATH{U} and \MATH{T}, where \MATH{T} is the 
	transformation matrix which was used to effect the normalization.}

\fcode{bool }{f.is\_reduced}{}{
	returns \TRUE\ if \MATH{f} is reduced, \FALSE\ otherwise.}

\fcode{void }{f.reduce}{}{
	If \MATH{f} is regular, then \MATH{f} is set to the first reduced
	form which is reached by successively applying the reduction operator
	\MATH{rho}, unless \MATH{f} itself is already reduced. If \MATH{f} is
	irregular, then \MATH{f} is set to the reduced form in its proper
	equivalence class.}

\fcode{void }{f.reduce}{matrix\_GL2Z \& U}{
	If \MATH{f} is regular, then \MATH{f} is set to the first reduced
	form which is reached by successively applying the reduction operator
	\MATH{rho}, unless \MATH{f} itself is already reduced. If \MATH{f} is
	irregular, then \MATH{f} is set to the reduced form in its proper
	equivalence class.  \MATH{U} is multiplied by the transformation
	matrix used to effect the reduction.}

\fcode{void }{f.rho}{}{
	\MATH{f} is set to the result of applying the reduction operator 
	\MATH{rho} to \MATH{f}.}

\fcode{void }{f.rho}{matrix\_GL2Z \& U}{
	\MATH{f} is set to the result of applying the reduction operator
	\MATH{rho} to \MATH{f}.  \MATH{U} is multiplied by the transformation
	matrix used to effect the operation.}

%\fcode{void }{f.inverse\_rho}{}{
%	\MATH{f} is set to the result of applying the inverse reduction
%	operator to \MATH{f}.}

%\fcode{void }{f.inverse\_rho}{matrix\_GL2Z \& U}{
%	\MATH{f} is set to the result of applying the inverse reduction
%	operator to \MATH{f}.  \MATH{U} is multiplied by the transformation
%	matrix used to effect the operation.}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\SSTITLE{Equivalence and principality testing}

	The parameter \MATH{U} is optional in all equivalence and principality
	functions.

\cfcode{bool }{f.is\_equivalent}{const quadratic\_form \& g, matrix\_GL2Z \& U}{
	returns \TRUE\ if \MATH{f} and \MATH{g} are
	equivalent, \FALSE\ otherwise. \MATH{U} is multiplied by the
	transformation matrix which transforms \MATH{g} to \MATH{f} if \MATH{f}
	and \MATH{g} are equivalent otherwise \MATH{U} remains unchanged.}

\cfcode{bool }{f.is\_prop\_equivalent}{const  quadratic\_form \& g, matrix\_GL2Z \& U}{
	returns \TRUE\ if \MATH{f} and \MATH{g} are properly
	equivalent, \FALSE\ otherwise. \MATH{U} is multiplied by the
	transformation matrix which transforms \MATH{f} to \MATH{g} if \MATH{f}
	and \MATH{g} are properly equivalent, otherwise \MATH{U} remains
	unchanged.}

\cfcode{bool }{f.is\_principal}{matrix\_GL2Z \& U}{
	returns \TRUE\ if \MATH{f} is principal, \FALSE\ otherwise. \MATH{U}
	is multiplied by the transformation matrix which transforms the unit
	form to \MATH{f} if \MATH{f} is principal, otherwise \MATH{U} remains
	unchanged.}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\SSTITLE{Orders, discrete logarithms, and subgroup structures}

\fcode{bigint }{f.order\_in\_CL}{}{
        returns the order of \MATH{f} in the equivalence class group of forms
	of the same discriminant, i.e. the least positive integer \MATH{x}
	such that \MATH{f^x} is equivalent to the unit form.  If \MATH{f} is
        not primitive, \MATH{0} is returned.}

\cfcode{bool }{f.DL}{const quadratic\_form \& g, bigint \& x}{
        returns \TRUE\ if \MATH{f} belongs to the cyclic subgroup generated
        by \MATH{g}, \FALSE\ otherwise.  If so, \MATH{x} is set to
        the discrete logarithm of \MATH{f} to the base \MATH{g},
        i.e., the least non-negative integer \MATH{x} such that
        \MATH{g^x \SIM f}.  If not, \MATH{x} is set to the order of \MATH{g}.
	If either \MATH{f} or \MATH{g} is not primitive, \FALSE\ is returned
	and \MATH{x} is set to \MATH{0}.}

\fcode{base\_vector<bigint> }{subgroup}{base\_vector<quadratic\_form> \& G, bas
e\_vector<quadratic\_form> \& factor\_base, bigint\_matrix \& U}{
        returns the vector of invariants representing the structure of the
        subgroup generated by the classes corresponding to the primitive
        forms contained in \MATH{G}.}

\fcode{bigfloat }{f.regulator}{}{
        returns an approximation of the regulator of the quadratic order of
	the same discriminant as \MATH{f}.  If \MATH{f} is not indefinite,
	\MATH{1} is returned.}

\fcode{bigint }{f.class\_number}{}{
        returns the number of equivalence classes of forms with the same
	discriminant as \MATH{f}.}

\fcode{base\_vector<bigint> }{f.class\_group}{}{
        returns the vector of invariants representing the structure of the
        equivalence class group of forms with the same discriminant as
	\MATH{f}.}

%\fcode{matrix\_GL2Z }{f.fundamental\_automorphism}{}{
%	returns the fundamental automorphism of the quadratic order of the
%	same discriminant as \MATH{f}.}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%\SSTITLE{Representations}

%\fcode{bool }{f.representations}{bigint\_matrix \& Reps, const bigint \& N}{
%	returns \TRUE\ if there exists at least one representation of the
%	integer \MATH{N} by the form \MATH{f}, \FALSE\ otherwise.  If exactly
%	\MATH{r} representations exist, \MATH{Reps} is set to a \MATH{r} by
%	\MATH{2} matrix representing \MATH{r} ordered pairs, each of which
%	corresponds to a primitive representation of \MATH{N} by \MATH{f}.
%	If infinitely many representations exist, \MATH{Rreps} will contain
%	the smallest inequivalent representations.}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\IO

	The operators \TT{<<} and  \TT{>>} are overloaded. Input is as follows:
	\begin{verbatim}
      (a b c)
	\end{verbatim}
	and corresponds to the form \MATH{f=(a,b,c)}. 

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\SEEALSO
	\BF{matrix\_GL2Z}, \BF{quadratic\_order}, \BF{qi\_class}, 
	\BF{qi\_class\_real}, \BF{quadratic\_ideal}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\EXAMPLES
\begin{verbatim}
#include<LiDIA/quadratic_order.h>

main()
{
  // This program reads a quadratic form f and transforms
  // it to an equivalent reduced form. It keeps track of
  // the transformation in a matrix U of GL(2, Z) and
  // transforms the reduced form with the inverse of
  // this matrix.
  
  quadratic_form f,g;

  matrix_GL2Z U;

  cout << "Please enter a form! Example (9 5 3):  ";
  
  cin >> f;
  g = f;

  f.reduce(U);
  
  cout << "An equivalent reduced form is:  " << f << "\n";

  U.invert();
  f.transform(U);

  cout << "Transforming f with the inverse transformation yields:  " << f ;
  cout << " \n";
  
  if(f == g)
    cout << "The result is correct! \n";
  else
    cout << "The result is incorrect \n";
}
\end{verbatim}

example:

\begin{verbatim}
Please enter a form! Example (9 5 3):  (243 -371 145)
An equivalent reduced form is:  ( 17 -13 51 )
Transforming f with the inverse transformation yields:  ( 243 -371 145 ) 
The result is correct! 
\end{verbatim}

	For further examples please refer to \\
	\TT{LiDIA/src/packages/quadratic\_order/quadratic\_form\_appl.c}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\AUTHOR
	Friedrich Eisenbrand, Michael J. Jacobson, Jr., Thomas Papanikolaou

\end{lidia_man}
