divisor.h 2.94 KB
 SPAENLEHAUER Pierre-Jean committed Oct 04, 2018 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 ``````/* Common header file for the rrspace software This file is part of the rrspace project. This library is free software; 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; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ // Class representing a Weil's divisor on a smooth plane curve given by a // bivariate polynomial which is monic (i.e. of the form Y^k + g(X,Y), with // deg_Y(g) < k). // Three further assumptions : // - We assume that no point in the support is at infinity // - The tangent at any point in the support should not be vertical // (i.e. X = 0) // - The points in the support should have distinct x-coordinates // All these three assumptions are satisfied in generic coordinates. #ifndef DIVISOR_H_ #define DIVISOR_H_ #include #include #include "curve.h" class EffectiveDivisor { private: NTL::ZZ_pX f; NTL::ZZ_pX g; Curve C; public: EffectiveDivisor() = delete; EffectiveDivisor(const Curve& _C) : f(NTL::ZZ_pX(1)), g(NTL::ZZ_pX(0)), C(_C) {} EffectiveDivisor(const Curve& _C, const NTL::ZZ_pX& _f, const NTL::ZZ_pX& _g) : f(_f), g(_g), C(_C) { assert(!NTL::IsZero(f)); assert(f == NTL::ZZ_pX(1) || NTL::IsZero(C.get_pdefpol()->mod_eval(g, f))); } Curve curve() const { return C; } NTL::ZZ_pX get_f() const { return f; } NTL::ZZ_pX get_g() const { return g; } std::size_t degree() const { return deg(f); } friend std::istream& operator>>(std::istream&, EffectiveDivisor&); }; class Divisor { private: EffectiveDivisor Dpos; EffectiveDivisor Dneg; public: Divisor() = delete; Divisor(const Curve& C) : Dpos(C), Dneg(C) {} `````` SPAENLEHAUER Pierre-Jean committed Apr 16, 2019 69 70 `````` Divisor(const EffectiveDivisor& _Dpos) : Dpos(_Dpos), Dneg(EffectiveDivisor(_Dpos.curve())) {} `````` SPAENLEHAUER Pierre-Jean committed Oct 04, 2018 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 `````` Divisor(const EffectiveDivisor& _Dpos, const EffectiveDivisor& _Dneg) : Dpos(_Dpos), Dneg(_Dneg) { assert(Dpos.curve() == Dneg.curve()); } std::size_t degree() const { return (int)Dpos.degree() - (int)Dneg.degree(); } EffectiveDivisor get_pos() const { return Dpos; } EffectiveDivisor get_neg() const { return Dneg; } Curve curve() const { return Dpos.curve(); } friend std::istream& operator>>(std::istream&, Divisor&); }; std::ostream& operator<<(std::ostream&, const EffectiveDivisor&); std::istream& operator>>(std::istream&, EffectiveDivisor&); std::ostream& operator<<(std::ostream&, const Divisor&); std::istream& operator>>(std::istream&, Divisor&); #endif``````