Function: qfbred
Section: number_theoretical
C-Name: qfbred0
Prototype: GD0,L,DGDGDG
Help: qfbred(x,{flag=0},{d},{isd},{sd}): reduction of the binary
 quadratic form x. All other args. are optional. The arguments d, isd and
 sd, if
 present, supply the values of the discriminant, floor(sqrt(d)) and sqrt(d)
 respectively. If d<0, its value is not used and all references to Shanks's
 distance hereafter are meaningless. flag can be any of 0: default, uses
 Shanks's distance function d; 1: use d, do a single reduction step; 2: do
 not use d; 3: do not use d, single reduction step.
Doc: reduces the binary quadratic form $x$ (updating Shanks's distance function
 if $x$ is indefinite). The binary digits of $\fl$ are toggles meaning

 \quad 1: perform a single \idx{reduction} step

 \quad 2: don't update \idx{Shanks}'s distance

 The arguments $d$, \var{isd}, \var{sd}, if present, supply the values of the
 discriminant, $\floor{\sqrt{d}}$, and $\sqrt{d}$ respectively
 (no checking is done of these facts). If $d<0$ these values are useless,
 and all references to Shanks's distance are irrelevant.
Variant: Also available are

 \fun{GEN}{redimag}{GEN x} (for definite $x$),

 \noindent and for indefinite forms:

 \fun{GEN}{redreal}{GEN x}

 \fun{GEN}{rhoreal}{GEN x} (= \kbd{qfbred(x,1)}),

 \fun{GEN}{redrealnod}{GEN x, GEN isd} (= \kbd{qfbred(x,2,,isd)}),

 \fun{GEN}{rhorealnod}{GEN x, GEN isd} (= \kbd{qfbred(x,3,,isd)}).
