diff --git a/.gitattributes b/.gitattributes index 0ea6b125152..64687188118 100644 --- a/.gitattributes +++ b/.gitattributes @@ -2423,6 +2423,7 @@ Number_types/include/CGAL/Sqrt_extension/Modular_traits.h -text Number_types/include/CGAL/Sqrt_extension/Real_embeddable_traits.h -text Number_types/include/CGAL/Sqrt_extension/Scalar_factor_traits.h -text Number_types/include/CGAL/Sqrt_extension/Sqrt_extension_type.h -text +Number_types/include/CGAL/Sqrt_extension/Wang_traits.h -text Number_types/include/CGAL/Sqrt_extension/convert_to_bfi.h -text Number_types/include/CGAL/Sqrt_extension/io.h -text Number_types/include/CGAL/mpfi_coercion_traits.h -text diff --git a/Number_types/include/CGAL/Sqrt_extension.h b/Number_types/include/CGAL/Sqrt_extension.h index 38ada00a418..9230cffd981 100644 --- a/Number_types/include/CGAL/Sqrt_extension.h +++ b/Number_types/include/CGAL/Sqrt_extension.h @@ -64,6 +64,7 @@ factorization property. #include #include #include +#include #endif // CGAL_SQRT_EXTENSION_H diff --git a/Number_types/include/CGAL/Sqrt_extension/Wang_traits.h b/Number_types/include/CGAL/Sqrt_extension/Wang_traits.h new file mode 100644 index 00000000000..5f99cb50280 --- /dev/null +++ b/Number_types/include/CGAL/Sqrt_extension/Wang_traits.h @@ -0,0 +1,77 @@ +// Copyright (c) 2006-2008 Max-Planck-Institute Saarbruecken (Germany). +// All rights reserved. +// +// This file is part of CGAL (www.cgal.org); you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public License as +// published by the Free Software Foundation; version 2.1 of the License. +// See the file LICENSE.LGPL distributed with CGAL. +// +// Licensees holding a valid commercial license may use this file in +// accordance with the commercial license agreement provided with the software. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +// +// $URL: svn+ssh://hemmer@scm.gforge.inria.fr/svn/cgal/trunk/Number_types/include/CGAL/Sqrt_extension/Algebraic_extension_traits.h $ +// $Id: Algebraic_extension_traits.h 52628 2009-10-20 08:59:26Z lrineau $ +// +// +// Author(s) : Michael Hemmer + + +#ifndef CGAL_SQRT_EXTENSION_WANG_TRAITS_H +#define CGAL_SQRT_EXTENSION_WANG_TRAITS_H + + +#include +#include + +CGAL_BEGIN_NAMESPACE +namespace internal{ + +template class Wang_traits; + +template +class Wang_traits< CGAL::Sqrt_extension >{ + typedef Wang_traits WT; +public: + // the supported number type + typedef CGAL::Sqrt_extension NT; + // the scalar type (same as Scalar factor traits ?) + typedef typename WT::Scalar Scalar; + + struct Wang { + bool + operator() + (const NT& ext, const Scalar& m, NT& n, Scalar& d) const { + typename Algebraic_structure_traits::Integral_division idiv; + typename WT::Wang wang; + + AS a0,a1; + Scalar d0,d1; + ROOT root; + n = NT(0); + d = Scalar(0); + + if(!wang(ext.a0(),m,a0,d0)) return false; + + if(ext.is_extended()){ + if(!wang(ext.a1(),m,a1,d1)) return false; + d = d0 * idiv(d1,CGAL::gcd(d0,d1)); + a0 = a0 * idiv(d,d0); + a1 = a1 * idiv(d,d1); + n = NT(a0,a1,ext.root()); + }else{ + d = d0; + n = NT(a0); + } + return true; + } + }; +}; + + +} // namespace internal +CGAL_END_NAMESPACE + +#endif // CGAL_SQRT_EXTENSION_WANG_TRAITS_H diff --git a/Polynomial/include/CGAL/Polynomial/Wang_traits.h b/Polynomial/include/CGAL/Polynomial/Wang_traits.h index c520162429e..78e1b042bd6 100644 --- a/Polynomial/include/CGAL/Polynomial/Wang_traits.h +++ b/Polynomial/include/CGAL/Polynomial/Wang_traits.h @@ -32,7 +32,6 @@ namespace CGAL{ // fwd -template class Sqrt_extension; template class Polynomial; namespace internal{ @@ -65,44 +64,6 @@ public: }; }; -template -class Wang_traits< CGAL::Sqrt_extension >{ - typedef Wang_traits WT; -public: - // the supported number type - typedef CGAL::Sqrt_extension NT; - // the scalar type (same as Scalar factor traits ?) - typedef typename WT::Scalar Scalar; - - struct Wang { - bool - operator() - (const NT& ext, const Scalar& m, NT& n, Scalar& d) const { - typename Algebraic_structure_traits::Integral_division idiv; - typename WT::Wang wang; - - AS a0,a1; - Scalar d0,d1; - ROOT root; - n = NT(0); - d = Scalar(0); - - if(!wang(ext.a0(),m,a0,d0)) return false; - - if(ext.is_extended()){ - if(!wang(ext.a1(),m,a1,d1)) return false; - d = d0 * idiv(d1,CGAL::gcd(d0,d1)); - a0 = a0 * idiv(d,d0); - a1 = a1 * idiv(d,d1); - n = NT(a0,a1,ext.root()); - }else{ - d = d0; - n = NT(a0); - } - return true; - } - }; -}; template class Wang_traits< Polynomial >{