mirror of https://github.com/CGAL/cgal
move Wang traits spec into Sqrt_extension
This commit is contained in:
parent
08220653fc
commit
65d67a3591
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -64,6 +64,7 @@ factorization property.
|
|||
#include <CGAL/Sqrt_extension/io.h>
|
||||
#include <CGAL/Sqrt_extension/Get_arithmetic_kernel.h>
|
||||
#include <CGAL/Sqrt_extension/convert_to_bfi.h>
|
||||
#include <CGAL/Sqrt_extension/Wang_traits.h>
|
||||
|
||||
|
||||
#endif // CGAL_SQRT_EXTENSION_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 <hemmer@mpi-inf.mpg.de>
|
||||
|
||||
|
||||
#ifndef CGAL_SQRT_EXTENSION_WANG_TRAITS_H
|
||||
#define CGAL_SQRT_EXTENSION_WANG_TRAITS_H
|
||||
|
||||
|
||||
#include <CGAL/basic.h>
|
||||
#include <CGAL/Sqrt_extension/Sqrt_extension_type.h>
|
||||
|
||||
CGAL_BEGIN_NAMESPACE
|
||||
namespace internal{
|
||||
|
||||
template <class NT_> class Wang_traits;
|
||||
|
||||
template <class AS, class ROOT>
|
||||
class Wang_traits< CGAL::Sqrt_extension<AS,ROOT> >{
|
||||
typedef Wang_traits<AS> WT;
|
||||
public:
|
||||
// the supported number type
|
||||
typedef CGAL::Sqrt_extension<AS,ROOT> 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<Scalar>::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
|
||||
|
|
@ -32,7 +32,6 @@
|
|||
namespace CGAL{
|
||||
|
||||
// fwd
|
||||
template <class A, class B> class Sqrt_extension;
|
||||
template <class A > class Polynomial;
|
||||
|
||||
namespace internal{
|
||||
|
|
@ -65,44 +64,6 @@ public:
|
|||
};
|
||||
};
|
||||
|
||||
template <class AS, class ROOT>
|
||||
class Wang_traits< CGAL::Sqrt_extension<AS,ROOT> >{
|
||||
typedef Wang_traits<AS> WT;
|
||||
public:
|
||||
// the supported number type
|
||||
typedef CGAL::Sqrt_extension<AS,ROOT> 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<Scalar>::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 AS >
|
||||
class Wang_traits< Polynomial<AS> >{
|
||||
|
|
|
|||
Loading…
Reference in New Issue