Changeset fba6f18 in git


Ignore:
Timestamp:
May 5, 2011, 2:41:36 PM (12 years ago)
Author:
Frank Seelisch <seelisch@…>
Branches:
(u'spielwiese', '0d6b7fcd9813a1ca1ed4220cfa2b104b97a0a003')
Children:
ba23594edc15991ab3d4bd71e011e4139bb72c92
Parents:
ce3f53c9db13dc43a04d51988cc1a5ea929e0f6d
git-author:
Frank Seelisch <seelisch@mathematik.uni-kl.de>2011-05-05 14:41:36+02:00
git-committer:
Mohamed Barakat <mohamed.barakat@rwth-aachen.de>2011-11-09 12:31:38+01:00
Message:
alg. ext. fields: 1st impl. and 1st tests
Location:
libpolys
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • libpolys/coeffs/coeffs.h

    rce3f53c rfba6f18  
    6363{
    6464   coeffs next;
    65    unsigned int  ringtype;  /* 0 => coefficient field, 1 => coeffs from Z/2^m */
     65   unsigned int ringtype;  /* =0 => coefficient field,
     66                             !=0 => coeffs from one of the rings */
    6667
    6768   // general properties:
     
    297298{ assume(r != NULL); assume(r->cfInit!=NULL); return r->cfInit(i,r); }
    298299
     300/// conversion to int; 0 if not possible
     301static inline int n_Int(number n,        const coeffs r)
     302{ assume(r != NULL); assume(r->cfInt!=NULL); return r->cfInt(n,r); }
     303
    299304/// changes argument  inline: a:= -a
    300305static inline number n_Neg(number n,     const coeffs r)
     
    436441
    437442static inline BOOLEAN nCoeff_is_Zp_a(const coeffs r)
    438 { assume(r != NULL); return (r->ringtype == 0) && (r->ch < -1); }
     443{
     444  assume(r != NULL);
     445  return (r->ringtype == 0) && (getCoeffType(r)==n_Ext) && (r->ch < -1);
     446}
    439447
    440448static inline BOOLEAN nCoeff_is_Zp_a(const coeffs r, int p)
    441 { assume(r != NULL); return (r->ringtype == 0) && (r->ch < -1 ) && (-(r->ch) == ABS(p)); }
     449{
     450  assume(r != NULL);
     451  return (r->ringtype == 0) && (getCoeffType(r)==n_Ext) && (r->ch < -1 )
     452                            && (-(r->ch) == ABS(p));
     453}
    442454
    443455static inline BOOLEAN nCoeff_is_Q_a(const coeffs r)
    444 { assume(r != NULL); return (r->ringtype == 0) && (r->ch == 1); }
     456{
     457  assume(r != NULL);
     458  return (r->ringtype == 0) && (getCoeffType(r)==n_Ext) && (r->ch == 0);
     459}
    445460
    446461static inline BOOLEAN nCoeff_is_long_R(const coeffs r)
     
    485500
    486501// Missing wrappers for:
    487 // cfIntMod, cfInt, cfRePart, cfImPart, cfRead, cfName, cfInit_bigint
     502// cfIntMod, cfRePart, cfImPart, cfRead, cfName, cfInit_bigint
    488503// HAVE_RINGS: cfDivComp, cfExtGcd... cfDivBy
    489504
  • libpolys/polys/Makefile.am

    rce3f53c rfba6f18  
    3838        kbuckets.cc sbuckets.cc weight.cc weight0.c simpleideals.cc matpol.cc \
    3939        ${USE_P_PROCS_STATIC_CC} ${USE_P_PROCS_DYNAMIC_CC} templates/mod_raw.cc \
    40         clapsing.cc
     40        clapsing.cc ext_fields/algext.cc
    4141
    4242BUILT_SOURCES = templates/p_Procs.inc
     
    5353        monomials/p_polys.h monomials/polys-impl.h monomials/maps.h polys.h prCopy.h prCopyMacros.h \
    5454        kbuckets.h sbuckets.h simpleideals.h weight.h matpol.h \
    55         clapsing.h
     55        clapsing.h ext_fields/algext.h
    5656
    5757P_PROCS_CPPFLAGS_COMMON = -DHAVE_CONFIG_H -DDYNAMIC_VERSION
  • libpolys/polys/simpleideals.cc

    rce3f53c rfba6f18  
    2525#include "sbuckets.h"
    2626
    27 omBin sip_sideal_bin;
     27omBin sip_sideal_bin = omGetSpecBin(sizeof(sip_sideal));
    2828
    2929static poly * idpower;
  • libpolys/tests/polys_test.h

    rce3f53c rfba6f18  
    1515#include <coeffs/rintegers.h>
    1616
    17 
     17#include <polys/ext_fields/algext.h>
    1818#include <polys/monomials/ring.h>
    1919#include <polys/monomials/p_polys.h>
    2020
    21 
    22 
     21#include <polys/simpleideals.h>
    2322
    2423class MyGlobalPrintingFixture : public GlobalPrintingFixture
     
    335334     rDelete(r); // kills 'cf' as well!
    336335   }
    337 
     336   
     337  void test_Q_Ext_a()
     338  {
     339    clog << "Start by creating Q[a]..." << endl;
     340
     341    char* n[] = {"a"};
     342    ring r = rDefault( 0, 1, n);   // Q[a]
     343    TS_ASSERT_DIFFERS( r, NULLp );
     344
     345    PrintRing(r);
     346
     347    TS_ASSERT( rField_is_Domain(r) );
     348    TS_ASSERT( rField_is_Q(r) );
     349   
     350    TS_ASSERT( !rField_is_Zp(r) );
     351    TS_ASSERT( !rField_is_Zp(r, 11) );
     352
     353    TS_ASSERT_EQUALS( rVar(r), 1);
     354
     355    poly minPoly = p_ISet(1, r);                    // minPoly = 1
     356    p_SetExp(minPoly, 1, 2, r); p_Setm(minPoly, r); // minPoly = a^2
     357    minPoly = p_Add_q(minPoly, p_ISet(1, r), r);    // minPoly = a^2 + 1
     358    ideal minIdeal = idInit(1);                     // minIdeal = < 0 >
     359    minIdeal->m[0] = minPoly;                       // minIdeal = < a^2 + 1 >
     360
     361    n_coeffType type = nRegister(n_Ext, naInitChar);
     362    TS_ASSERT(type == n_Ext);
     363
     364    ExtInfo extParam;
     365    extParam.r = r;
     366    extParam.i = minIdeal;
     367   
     368    clog << "Next create the extension field Q[a]/<a2+1>..." << endl;
     369
     370    const coeffs cf = nInitChar(type, &extParam);   // Q[a]/<a2+1>
     371
     372    TS_ASSERT_DIFFERS( cf->cfCoeffWrite, NULLp );
     373 
     374    if( cf->cfCoeffWrite != NULL )
     375    {
     376      clog << "Coeff-domain: "  << endl;
     377      n_CoeffWrite(cf); PrintLn();
     378    }
     379
     380    clog << "Finally create the polynomial ring (Q[a]/<a2+1>)[x, y]..."
     381         << endl;
     382   
     383    char* m[] = {"x", "y"};
     384    ring s = rDefault(cf, 2, m);   // (Q[a]/<a2+1>)[x, y]
     385    TS_ASSERT_DIFFERS(s, NULLp);
     386
     387    PrintRing(s);
     388
     389    TS_ASSERT( rField_is_Domain(s) );
     390    TS_ASSERT( !rField_is_Q(s) );
     391    TS_ASSERT( !rField_is_Zp(s) );
     392    TS_ASSERT( !rField_is_Zp(s, 11) );
     393    TS_ASSERT( !rField_is_Zp(s, 13) );
     394    TS_ASSERT( !rField_is_GF(s) );
     395    TS_ASSERT( rField_is_Extension(s) );
     396    TS_ASSERT( !rField_is_GF(s, 25) );
     397    TS_ASSERT_EQUALS(rVar(s), 2);
     398
     399    //Test(s);
     400
     401    rDelete(s); // kills 'cf' and 'r' as well
     402  }
    338403};
    339404
Note: See TracChangeset for help on using the changeset viewer.