BWAPI
|
00001 // Copyright (c) 2008 Max-Planck-Institute Saarbruecken (Germany) 00002 // 00003 // This file is part of CGAL (www.cgal.org); you can redistribute it and/or 00004 // modify it under the terms of the GNU Lesser General Public License as 00005 // published by the Free Software Foundation; version 2.1 of the License. 00006 // See the file LICENSE.LGPL distributed with CGAL. 00007 // 00008 // Licensees holding a valid commercial license may use this file in 00009 // accordance with the commercial license agreement provided with the software. 00010 // 00011 // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 00012 // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 00013 // 00014 // $URL: svn+ssh://scm.gforge.inria.fr/svn/cgal/branches/CGAL-3.5-branch/Polynomial/include/CGAL/Polynomial/Modular_traits.h $ 00015 // $Id: Modular_traits.h 47254 2008-12-06 21:18:27Z afabri $ 00016 // 00017 // 00018 // Author(s) : Arno Eigenwillig <arno@mpi-inf.mpg.de> 00019 // Michael Hemmer <hemmer@informatik.uni-mainz.de> 00020 // 00021 // ============================================================================ 00022 00023 // TODO: The comments are all original EXACUS comments and aren't adapted. So 00024 // they may be wrong now. 00025 00026 // NOT INTRODUCED YET 00027 00028 #ifndef CGAL_POLYNOMIAL_MODULAR_TRAITS_TRAITS_H 00029 #define CGAL_POLYNOMIAL_MODULAR_TRAITS_TRAITS_H 00030 00031 #include <CGAL/basic.h> 00032 #include <CGAL/Modular_traits.h> 00033 00034 CGAL_BEGIN_NAMESPACE 00035 00043 template< class COEFF > 00044 class Modular_traits< Polynomial<COEFF> > { 00045 00046 private: 00047 typedef Modular_traits<COEFF> Mtr; 00048 public: 00049 typedef Polynomial<COEFF> NT; 00050 typedef Modular_traits<NT> Self; 00051 typedef typename Mtr::Is_modularizable Is_modularizable; 00052 typedef Polynomial<typename Mtr::Residue_type> Residue_type; 00053 00054 struct Modular_image{ 00055 Residue_type operator()(const NT& p){ 00056 std::vector<typename Mtr::Residue_type> V; 00057 typename Mtr::Modular_image modular_image; 00058 for(int i=0; i<=p.degree();i++) 00059 V.push_back(modular_image(p[i])); 00060 return Residue_type(V.begin(),V.end()); 00061 } 00062 }; 00063 00064 struct Modular_image_representative{ 00065 NT operator()(const Residue_type& p) const { 00066 std::vector<COEFF> V; 00067 typename Mtr::Modular_image_representative modular_image_representative; 00068 for(int i=0; i<=p.degree();i++) 00069 V.push_back(modular_image_representative(p[i])); 00070 return NT(V.begin(),V.end()); 00071 } 00072 }; 00073 }; 00074 00075 00076 CGAL_END_NAMESPACE 00077 #endif // CGAL_POLYNOMIAL_MODULAR_TRAITS_TRAITS_H