[givaro] 06/06: New patch adding version of a function needed by Macaulay2.

Doug Torrance dtorrance-guest at moszumanska.debian.org
Tue Jul 19 11:24:26 UTC 2016


This is an automated email from the git hooks/post-receive script.

dtorrance-guest pushed a commit to branch master
in repository givaro.

commit b3e848fb82b8b9f3ab00270d0576a3ff6cce6b46
Author: Doug Torrance <dtorrance at piedmont.edu>
Date:   Tue Jul 19 07:18:49 2016 -0400

    New patch adding version of a function needed by Macaulay2.
---
 debian/patches/gfqdom-for-macaulay2.patch | 209 ++++++++++++++++++++++++++++++
 debian/patches/series                     |   1 +
 2 files changed, 210 insertions(+)

diff --git a/debian/patches/gfqdom-for-macaulay2.patch b/debian/patches/gfqdom-for-macaulay2.patch
new file mode 100644
index 0000000..a272158
--- /dev/null
+++ b/debian/patches/gfqdom-for-macaulay2.patch
@@ -0,0 +1,209 @@
+Description: Add version of GFqDom() needed by Macaulay2.
+Origin: https://github.com/linbox-team/givaro/commit/7a3bb78
+Last-Update: 2016-07-19
+
+--- a/examples/Polynomial/Makefile.am
++++ b/examples/Polynomial/Makefile.am
+@@ -30,12 +30,13 @@
+ AM_LDFLAGS=-static
+ 
+ 
+-EXTRA_PROGRAMS=isirred isprimitive trunc_arith pol_arith pol_eval pol_factor interpolate PolynomialCRT highorder bivariate
++EXTRA_PROGRAMS=isirred isprimitive trunc_arith pol_arith pol_eval pol_factor interpolate PolynomialCRT highorder bivariate isgenerator
+ 
+ CLEANFILES=$(EXTRA_PROGRAMS)
+ 
+ interpolate_SOURCES   = interpolate.C
+ isirred_SOURCES       = isirred.C
++isgenerator_SOURCES       = isgenerator.C
+ isprimitive_SOURCES   = isprimitive.C
+ pol_arith_SOURCES     = pol_arith.C
+ trunc_arith_SOURCES   = trunc_arith.C
+--- /dev/null
++++ b/examples/Polynomial/isgenerator.C
+@@ -0,0 +1,53 @@
++// Copyright(c)'1994-2009 by The Givaro group
++// This file is part of Givaro.
++// Givaro is governed by the CeCILL-B license under French law
++// and abiding by the rules of distribution of free software.
++// see the COPYRIGHT file for more details.
++/*! @file examples/Polynomial/isprimitive.C
++ * @ingroup examples
++ * @ingroup polynomials
++ * @example examples/Polynomial/isprimitive.C
++ * @brief NO DOC
++ */
++
++#include <iostream>
++#include <stdlib.h>
++#include <givaro/gfq.h>
++#include <givaro/givpoly1factor.h>
++#include <givaro/givtimer.h>
++
++// using namespace std;
++
++using namespace Givaro;
++
++
++int main(int argc, char** argv)
++{
++    typedef GFqDom<int64_t>::Residu_t UT;
++    UT MOD;
++    if (argc > 1)
++        MOD = (UT)atoi(argv[1]);
++    else
++        std::cin >> MOD;
++    uint64_t expo = 1;
++    if (argc > 2) expo = (uint64_t)atoi(argv[2]);
++    
++    GFqDom<int64_t> F(MOD, expo);
++    
++    Poly1FactorDom<GFqDom<int64_t>, Dense> FD(F,Indeter("X"));
++    Poly1FactorDom<GFqDom<int64_t>, Dense>::Element P, G;
++    FD.read( std::cin, P );
++    FD.read( std::cin, G );
++    
++    Timer tim; tim.clear(); tim.start();
++    bool f = FD.is_prim_root(G, P );
++    tim.stop();
++    
++    FD.write(F.write( FD.write( std::cout, G ) << " is " << (f?"":"not ") << " a generator in " ) << " defined with ", P) << std::endl;
++    
++        // std::cout << f << std::endl;
++    std::cerr << tim << std::endl;
++    
++    return 0;
++}
++
+--- a/src/kernel/field/gfq.h
++++ b/src/kernel/field/gfq.h
+@@ -5,7 +5,7 @@
+ // and abiding by the rules of distribution of free software.
+ // see the COPYRIGHT file for more details.
+ // file: gfq.h
+-// Time-stamp: <28 Oct 15 20:48:41 Jean-Guillaume.Dumas at imag.fr>
++// Time-stamp: <17 Jul 16 16:12:52 Jean-Guillaume.Dumas at imag.fr>
+ // date: 1999
+ // version:
+ // author: Jean-Guillaume.Dumas
+@@ -98,6 +98,14 @@
+     template<typename Vector>
+     GFqDom(const UTT P, const UTT e, const Vector& modPoly);
+ 
++        // Construction with prescribed irreducible polynomial
++        //   and with prescribed generator polynomial
++        //   coefficients of the vector should be integers-like
++        //   there will be a call to this->init to build the
++        //   representation of both polynomials
++    template<typename Vector>
++    GFqDom( const UTT P, const UTT e, const Vector& modPoly, const Vector& genPoly);
++
+     GFqDom( const GFqDom<TT>& F)
+             : zero(F.zero),
+               one(F.one),
+--- a/src/kernel/field/gfq.inl
++++ b/src/kernel/field/gfq.inl
+@@ -1115,6 +1115,77 @@
+         _plus1[size_t(mOne)] = 0;
+     }
+ 
++         // Construction with prescribed irreducible polynomial
++        //   and with prescribed generator polynomial
++        //   coefficients of the vector should be integers-like
++        //   there will be a call to this->init to build the
++        //   representation of both polynomials
++    template<typename TT>
++    template<typename Vector>
++    inline GFqDom<TT>::GFqDom(const UTT P, const UTT e, 
++                              const Vector& modPoly, const Vector& genPoly):
++            zero(0)
++        , one ((TT) power(P,e) - 1  )
++        , mOne(  (P==2)?  (one)  :  ( one >> 1) )   // 1 == -1 in GF(2^k)
++        , _characteristic(P)
++        , _exponent(e)
++        , _q( (UTT) one + 1 )
++        , _qm1 ( (UTT)one )
++        , _log2pol( (UT)_q )
++        , _pol2log( (UT)_q )
++        , _plus1( (UT)_q )
++        , _dcharacteristic( (double)P )
++    {
++
++            // 1 is represented by q-1, zero by 0
++        _log2pol[0] = (UTT)zero;
++
++        GFqDom<TT> Zp(P,1);
++        typedef Poly1FactorDom< GFqDom<TT>, Dense > PolDom;
++        PolDom Pdom( Zp );
++        typename PolDom::Element Ft, F(e+1), G(genPoly.size()), H;
++
++        for( size_t i = 0; i < F.size(); ++i )
++            Zp.init( F[i], modPoly[i]);
++
++        for( size_t i = 0; i < G.size(); ++i )
++            Zp.init( G[i], genPoly[i]);
++
++        Pdom.assign(H,G);
++
++        typedef Poly1PadicDom< GFqDom<TT>, Dense > PadicDom;
++        PadicDom PAD(Pdom);
++
++        PAD.eval(_log2pol[1],H);
++        PAD.eval(_irred, F);
++
++        for (UTT i = 2; i < _qm1; ++i) {
++            Pdom.mulin(H, G);
++            Pdom.modin(H, F);
++            PAD.eval(_log2pol[i], H);
++        }
++        _log2pol[_qm1] = 1;
++
++        _log2pol[0] = 0;
++
++        for (UTT i = 0; i < _q; ++i)
++            _pol2log[ _log2pol[i] ] = i;
++
++        _plus1[0] = 0;
++
++        UTT a,b,r;
++        for (UTT i = 1; i < _q; ++i) {
++            a = _log2pol[i];
++            r = a % P;
++            if (r == (P - 1))
++                b = a - r;
++            else
++                b = a + 1;
++            _plus1[i] = (TT)_pol2log[b] - (TT)_qm1;
++        }
++
++        _plus1[size_t(mOne)] = 0;
++    }
+ 
+     template<typename TT> inline void GFqDom<TT>::Init() {}
+ 
+--- a/tests/test-ffarith.C
++++ b/tests/test-ffarith.C
+@@ -368,12 +368,19 @@
+ 
+     // Zech log finite field with 256 elements
+     // and prescribed 1 + x +x^3 +x^4 +x^8 irreducible polynomial
+-    std::vector< GFqDom<int64_t>::Residu_t > Irred(9);
+-    Irred[0] = 1; Irred[1] = 1; Irred[2] = 0; Irred[3] = 1;
+-    Irred[4] = 1; Irred[5] = 0; Irred[6] = 0; Irred[7] = 0;
+-    Irred[8] = 1;
++//     std::vector< GFqDom<int64_t>::Residu_t > Irred(9);
++//     Irred[0] = 1; Irred[1] = 1; Irred[2] = 0; Irred[3] = 1;
++//     Irred[4] = 1; Irred[5] = 0; Irred[6] = 0; Irred[7] = 0;
++//     Irred[8] = 1;
++    std::vector< int64_t > Irred {1,1,0,1,1,0,0,0,1};
+     TEST_SPECIFIC(GFqDom<int64_t>, GF256, 2, 8, Irred);
+ 
++   // Zech log finite field with 343 elements
++   // and prescribed 3 +x^3  irreducible polynomial
++   // and prescribed 5 +3x +4x^2 generator polynomial
++    std::vector< int64_t > Irred3 {3,0,0,1}, Gene3 {5,3,4};
++    TEST_SPECIFIC(GFqDom<int64_t>, GF343, 7, 3, Irred3, Gene3);
++
+     TEST_SPECIFIC(GFqDom<int32_t>, GF625, 5, 4);
+     TEST_SPECIFIC(GFqExt<int32_t>, GF81, 3, 4);
+ 
diff --git a/debian/patches/series b/debian/patches/series
index 5f34bd9..3c98edc 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -2,3 +2,4 @@ fix-doc-path.patch
 givaro-makefile.patch
 doxygen-exclude-debian-dir.patch
 local-include-syntax.patch
+gfqdom-for-macaulay2.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/givaro.git



More information about the debian-science-commits mailing list