Changeset 49f1f45 in git for factory/winnt


Ignore:
Timestamp:
Nov 20, 2007, 11:08:40 AM (16 years ago)
Author:
Hans Schönemann <hannes@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
62f8cca6dc508c925bc4d657aea450dafba04fb9
Parents:
b1d37f6a1e89cd93b4ecab9f73e8d297d77180c0
Message:
*hannes: EZGCD for char p


git-svn-id: file:///usr/local/Singular/svn/trunk@10429 2c84dea3-7e68-4137-9b89-c4e89433aadc
Location:
factory/winnt
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • factory/winnt/factory.h

    rb1d37f r49f1f45  
    1 /* ../factory/winnt/factory.h automatically generated by makeheader from ../factory/factory.template */
     1/* winnt/factory.h automatically generated by makeheader from factory.template */
    22/* emacs edit mode for this file is -*- C++ -*- */
    3 /* $Id: factory.h,v 1.5 1997-12-09 16:37:34 schmidt Exp $ */
     3/* $Id: factory.h,v 1.6 2007-11-20 10:08:03 Singular Exp $ */
    44
    55#ifndef INCL_FACTORY_H
     
    2626
    2727#ifndef NOSTREAMIO
     28#ifdef HAVE_IOSTREAM
     29#include <iostream>
     30#define OSTREAM std::ostream
     31#define ISTREAM std::istream
     32#elif defined(HAVE_IOSTREAM_H)
    2833#include <iostream.h>
     34#define OSTREAM ostream
     35#define ISTREAM istream
     36#endif
    2937#endif /* ! NOSTREAMIO */
    3038
    3139#ifdef SINGULAR
    32 extern "C" {
     40#include "cf_gmp.h"
     41#else
    3342#include <gmp.h>
    34 }
    3543#endif /* SINGULAR */
    3644
    3745#ifdef macintosh
    38 #include <::templates:ftmpl_array.h>
    39 #include <::templates:ftmpl_factor.h>
    40 #include <::templates:ftmpl_list.h>
    41 #include <::templates:ftmpl_matrix.h>
     46#include <:templates:ftmpl_array.h>
     47#include <:templates:ftmpl_factor.h>
     48#include <:templates:ftmpl_list.h>
     49#include <:templates:ftmpl_matrix.h>
    4250#else
    4351#include <templates/ftmpl_array.h>
     
    4755#endif
    4856
    49 /* stuff included from ../factory/cf_globals.h */
     57/* stuff included from ./cf_globals.h */
    5058
    5159
     
    5462
    5563
    56 /* stuff included from ../factory/cf_primes.h */
     64/* stuff included from ./cf_primes.h */
    5765
    5866
     
    7078
    7179
    72 /* stuff included from ../factory/cf_defs.h */
     80/* stuff included from ./cf_defs.h */
    7381
    7482
     
    99107const int SW_USE_EZGCD = 6;
    100108const int SW_USE_SPARSEMOD = 7;
    101 //}}}
    102 
    103 
    104 /* stuff included from ../factory/variable.h */
     109const int SW_USE_NTL=8;
     110const int SW_USE_NTL_GCD_0=9;
     111const int SW_USE_NTL_GCD_P=10;
     112const int SW_USE_NTL_SORT=11;
     113const int SW_USE_CHINREM_GCD=12;
     114const int SW_USE_GCD_P=13;
     115//}}}
     116
     117
     118/* stuff included from ./variable.h */
    105119
    106120
     
    153167    }
    154168#ifndef NOSTREAMIO
    155     friend ostream & operator << ( ostream & os, const Variable & v );
     169    friend OSTREAM & operator << ( OSTREAM & os, const Variable & v );
    156170#endif /* NOSTREAMIO */
    157     friend Variable rootOf( const CanonicalForm &, char name = '@' );
    158 };
     171    friend void swap_levels();
     172    friend Variable rootOf( const CanonicalForm &, char name );
     173};
     174Variable rootOf( const CanonicalForm &, char name = '@' );
    159175
    160176inline int level( const Variable & v ) { return v.level(); }
     
    166182char getDefaultExtName();
    167183
    168 
    169 /* stuff included from ../factory/canonicalform.h */
     184int ExtensionLevel();
     185
     186
     187/* stuff included from ./canonicalform.h */
     188
     189
     190#undef CF_INLINE
     191#define CF_INLINE
     192#undef CF_NO_INLINE
     193#define CF_NO_INLINE
     194
     195
     196class InternalCF;
     197
     198inline int is_imm ( const InternalCF * const ptr )
     199{
     200    // returns 0 if ptr is not immediate       
     201    return ( ((int)((long)ptr)) & 3 );
     202}
    170203
    171204
     
    173206
    174207static int cf_is_initialized_now = initCanonicalForm();
    175 
    176 class InternalCF;
    177208
    178209//{{{ class CanonicalForm
     
    183214public:
    184215    // constructors, destructors, selectors
    185     CanonicalForm();
    186     CanonicalForm( const CanonicalForm& );
    187     CanonicalForm( InternalCF* );
    188     CanonicalForm( const int );
    189     CanonicalForm( const Variable & );
    190     CanonicalForm( const Variable &, int );
    191     CanonicalForm( const char * ); // use with caution - does only handle integers !!!
    192 
    193     ~CanonicalForm();
     216    CF_INLINE CanonicalForm();
     217    CF_INLINE CanonicalForm( const CanonicalForm& );
     218    CF_INLINE CanonicalForm( InternalCF* );
     219    CF_INLINE CanonicalForm( const int );
     220    CF_INLINE CanonicalForm( const Variable & );
     221    CF_INLINE CanonicalForm( const Variable &, int );
     222    CanonicalForm( const char *, const int base=10 ); // use with caution - does only handle integers !!!
     223
     224    CF_NO_INLINE ~CanonicalForm();
    194225
    195226    InternalCF* getval() const; // use with caution !!!
     
    198229
    199230    // predicates
    200     bool isOne() const;
    201     bool isZero() const;
    202     bool isImm() const;
     231    CF_NO_INLINE bool isOne() const;
     232    CF_NO_INLINE bool isZero() const;
     233    inline bool isImm() const { return is_imm( value ); };
    203234
    204235    bool inZ() const;
     
    215246    bool isFFinGF() const;
    216247    bool isUnivariate() const;
     248    bool isHomogeneous() const;
    217249
    218250    // conversion functions
     
    238270
    239271    // assignment operators
    240     CanonicalForm& operator = ( const CanonicalForm& );
    241     CanonicalForm& operator = ( const int );
     272    CF_NO_INLINE CanonicalForm& operator = ( const CanonicalForm& );
     273    CF_NO_INLINE CanonicalForm& operator = ( const int );
    242274
    243275    CanonicalForm& operator += ( const CanonicalForm& );
     
    269301
    270302    // arithmetic operators
    271     friend CanonicalForm operator - ( const CanonicalForm& );
    272 
    273     friend CanonicalForm operator + ( const CanonicalForm&, const CanonicalForm& );
    274     friend CanonicalForm operator - ( const CanonicalForm&, const CanonicalForm& );
    275     friend CanonicalForm operator * ( const CanonicalForm&, const CanonicalForm& );
    276     friend CanonicalForm operator / ( const CanonicalForm&, const CanonicalForm& );
    277     friend CanonicalForm operator % ( const CanonicalForm&, const CanonicalForm& );
    278 
    279     friend CanonicalForm div ( const CanonicalForm&, const CanonicalForm& );
    280     friend CanonicalForm mod ( const CanonicalForm&, const CanonicalForm& );
     303    friend CF_NO_INLINE CanonicalForm operator - ( const CanonicalForm& );
    281304
    282305    friend void divrem ( const CanonicalForm&, const CanonicalForm&, CanonicalForm&, CanonicalForm& );
    283306    friend bool divremt ( const CanonicalForm&, const CanonicalForm&, CanonicalForm&, CanonicalForm& );
    284307
     308    friend CanonicalForm bgcd ( const CanonicalForm &, const CanonicalForm & );
     309    friend CanonicalForm bextgcd ( const CanonicalForm &, const CanonicalForm &, CanonicalForm &, CanonicalForm & );
     310
     311    // input/output
    285312#ifndef NOSTREAMIO
    286     void print( ostream&, char * ) const;
    287     friend ostream& operator << ( ostream&, const CanonicalForm& );
    288     friend istream& operator >> ( istream&, CanonicalForm& );
     313    void print( OSTREAM&, char * ) const;
     314    void print( OSTREAM& ) const;
     315    friend OSTREAM& operator << ( OSTREAM&, const CanonicalForm& );
     316    friend ISTREAM& operator >> ( ISTREAM&, CanonicalForm& );
    289317#endif /* NOSTREAMIO */
    290318
     
    298326//}}}
    299327
    300 // some useful functions
     328CF_INLINE CanonicalForm
     329operator + ( const CanonicalForm&, const CanonicalForm& );
     330
     331CF_NO_INLINE CanonicalForm
     332operator - ( const CanonicalForm&, const CanonicalForm& );
     333
     334CF_INLINE CanonicalForm
     335operator * ( const CanonicalForm&, const CanonicalForm& );
     336
     337CF_NO_INLINE CanonicalForm
     338operator / ( const CanonicalForm&, const CanonicalForm& );
     339
     340CF_NO_INLINE CanonicalForm
     341operator % ( const CanonicalForm&, const CanonicalForm& );
     342
     343CF_NO_INLINE CanonicalForm
     344div ( const CanonicalForm&, const CanonicalForm& );
     345
     346CF_NO_INLINE CanonicalForm
     347mod ( const CanonicalForm&, const CanonicalForm& );
     348
    301349
    302350//{{{ function declarations from canonicalform.cc
     351CanonicalForm blcm ( const CanonicalForm & f, const CanonicalForm & g );
     352
    303353CanonicalForm power ( const CanonicalForm & f, int n );
    304354
    305355CanonicalForm power ( const Variable & v, int n );
    306 
    307 bool divides ( const CanonicalForm & f, const CanonicalForm & g );
    308356//}}}
    309357
     
    313361CanonicalForm extgcd ( const CanonicalForm&, const CanonicalForm&, CanonicalForm&, CanonicalForm& );
    314362
    315 CanonicalForm iextgcd ( const CanonicalForm&, const CanonicalForm&, CanonicalForm&, CanonicalForm& );
    316 
    317363CanonicalForm lcm ( const CanonicalForm&, const CanonicalForm& );
    318364
     
    324370
    325371CanonicalForm icontent ( const CanonicalForm & f );
     372
     373CanonicalForm vcontent ( const CanonicalForm & f, const Variable & x );
    326374//}}}
    327375
     
    386434level ( const CanonicalForm & f ) { return f.level(); }
    387435
    388 inline CanonicalForm
     436inline Variable
    389437mvar ( const CanonicalForm & f ) { return f.mvar(); }
    390438
     
    394442inline CanonicalForm
    395443den ( const CanonicalForm & f ) { return f.den(); }
     444
     445inline int
     446sign ( const CanonicalForm & a ) { return a.sign(); }
    396447
    397448inline CanonicalForm
     
    418469}
    419470
    420 inline CanonicalForm
    421 abs ( const CanonicalForm & f )
    422 {
    423     if ( f < 0 )
    424         return -f;
    425     else
    426         return f;
    427 }
    428 
    429471inline int
    430472headdegree ( const CanonicalForm & f ) { return totaldegree( head( f ) ); }
     473
     474
    431475//}}}
    432476
     
    456500
    457501
    458 /* stuff included from ../factory/cf_binom.h */
     502/* stuff included from ./cf_binom.h */
    459503
    460504
     
    462506
    463507
    464 /* stuff included from ../factory/cf_algorithm.h */
     508/* stuff included from ./cf_algorithm.h */
    465509
    466510
     
    472516void psqr ( const CanonicalForm & f, const CanonicalForm & g, CanonicalForm & q, CanonicalForm & r, const Variable & x );
    473517
    474 CanonicalForm common_den ( const CanonicalForm & f );
     518CanonicalForm bCommonDen ( const CanonicalForm & f );
     519
     520bool fdivides ( const CanonicalForm & f, const CanonicalForm & g );
     521
     522CanonicalForm maxNorm ( const CanonicalForm & f );
     523
     524CanonicalForm euclideanNorm ( const CanonicalForm & f );
    475525//}}}
    476526
     
    479529
    480530void chineseRemainder ( const CFArray & x, const CFArray & q, CanonicalForm & xnew, CanonicalForm & qnew );
     531
     532CanonicalForm Farey ( const CanonicalForm & f, const CanonicalForm & q );
    481533//}}}
    482534
    483535//{{{ function declarations from cf_factor.cc
     536bool isPurePoly(const CanonicalForm & f);
     537
     538bool isPurePoly_m(const CanonicalForm & f);
     539
    484540CFFList factorize ( const CanonicalForm & f, bool issqrfree = false );
    485541
     
    489545
    490546bool isSqrFree ( const CanonicalForm & f );
     547
     548CanonicalForm homogenize( const CanonicalForm & f, const Variable & x);
     549CanonicalForm homogenize( const CanonicalForm & f, const Variable & x,
     550                                const Variable & v1, const Variable & v2);
     551Variable get_max_degree_Variable(const CanonicalForm & f);
     552CFList get_Terms( const CanonicalForm & f );
     553void getTerms( const CanonicalForm & f, const CanonicalForm & t, CFList & result );
     554
     555
    491556//}}}
    492557
     
    503568//}}}
    504569
    505 
    506 /* stuff included from ../factory/cf_eval.h */
     570//{{{ inline CanonicalForm abs ( const CanonicalForm & f )
     571//{{{ docu
     572//
     573// abs() - return absolute value of `f'.
     574//
     575// The absolute value is defined in terms of the function
     576// `sign()'.  If it reports negative sign for `f' than -`f' is
     577// returned, otherwise `f'.
     578//
     579// This behaviour is most useful for integers and rationals.  But
     580// it may be used to sign-normalize the leading coefficient of
     581// arbitrary polynomials, too.
     582//
     583// Type info:
     584// ----------
     585// f: CurrentPP
     586//
     587//}}}
     588inline CanonicalForm
     589abs ( const CanonicalForm & f )
     590{
     591    // it is not only more general to use `sign()' instead of a
     592    // direct comparison `f < 0', it is faster, too
     593    if ( sign( f ) < 0 )
     594        return -f;
     595    else
     596        return f;
     597}
     598//}}}
     599
     600
     601/* stuff included from ./cf_eval.h */
    507602
    508603
     
    525620    virtual void nextpoint();
    526621#ifndef NOSTREAMIO
    527     friend ostream& operator<< ( ostream& s, const Evaluation &e );
     622    friend OSTREAM& operator<< ( OSTREAM& s, const Evaluation &e );
    528623#endif /* NOSTREAMIO */
    529624};
    530625
    531626
    532 /* stuff included from ../factory/cf_generator.h */
     627/* stuff included from ./cf_generator.h */
    533628
    534629
     
    574669};
    575670
    576 class AlgExtGenerator : public CFGenerator
     671class AlgExtGenerator //??? : public CFGenerator
    577672{
    578673private:
    579674    Variable algext;
    580     CFGenerator **gens;
     675    FFGenerator **gensf;
     676    GFGenerator **gensg;
    581677    int n;
    582678    bool nomoreitems;
     
    603699
    604700
    605 /* stuff included from ../factory/cf_iter.h */
     701/* stuff included from ./cf_iter.h */
     702
     703
     704#undef CF_INLINE
     705#define CF_INLINE
     706#undef CF_NO_INLINE
     707#define CF_NO_INLINE
    606708
    607709
     
    625727    CFIterator& operator= ( const CanonicalForm& );
    626728
    627     CFIterator& operator++ ();
    628     CFIterator& operator++ ( int );
    629     int hasTerms () const;
    630     CanonicalForm coeff () const;
    631     int exp () const;
    632 };
    633 
    634 
    635 /* stuff included from ../factory/cf_random.h */
     729    CF_NO_INLINE CFIterator& operator++ ();
     730    CF_NO_INLINE CFIterator& operator++ ( int );
     731    CF_NO_INLINE int hasTerms () const;
     732    CF_NO_INLINE CanonicalForm coeff () const;
     733    CF_NO_INLINE int exp () const;
     734};
     735
     736
     737/* stuff included from ./cf_random.h */
    636738
    637739
     
    700802
    701803
    702 /* stuff included from ../factory/cf_irred.h */
     804/* stuff included from ./cf_irred.h */
    703805
    704806
     
    706808
    707809
    708 /* stuff included from ../factory/fac_util.h */
     810/* stuff included from ./fac_util.h */
    709811
    710812
     
    736838void divremainder( const CanonicalForm & f, const CanonicalForm & g, CanonicalForm & quot, CanonicalForm & rem, const modpk & pk );
    737839
    738 CanonicalForm maxCoeff( const CanonicalForm & f );
    739 
    740840bool Hensel ( const CanonicalForm & U, CFArray & G, const CFArray & lcG, const Evaluation & A, const modpk & bound, const Variable & x );
    741841
     
    753853
    754854
    755 /* stuff included from ../factory/cf_map.h */
     855/* stuff included from ./cf_map.h */
    756856
    757857
     
    789889    CanonicalForm subst () const { return S; }
    790890#ifndef NOSTREAMIO
    791     friend ostream & operator << ( ostream & s, const MapPair & p );
     891    void print( OSTREAM&) const;
     892    friend OSTREAM & operator << ( OSTREAM & s, const MapPair & p );
    792893#endif /* NOSTREAMIO */
    793894};
     
    827928  CanonicalForm operator () ( const CanonicalForm & f ) const;
    828929#ifndef NOSTREAMIO
    829   friend ostream & operator << ( ostream & s, const CFMap & m );
     930  friend OSTREAM & operator << ( OSTREAM & s, const CFMap & m );
    830931#endif /* NOSTREAMIO */
    831932};
     
    837938
    838939
    839 /* stuff included from ../factory/cf_reval.h */
     940/* stuff included from ./cf_reval.h */
    840941
    841942
     
    856957#ifdef SINGULAR
    857958
    858 /* stuff included from ../factory/gfops.h */
     959/* stuff included from ./gfops.h */
    859960
    860961
     
    864965
    865966
    866 /* stuff included from ../factory/singext.h */
     967/* stuff included from ./singext.h */
    867968
    868969
     
    871972MP_INT gmp_denominator ( const CanonicalForm & f );
    872973
     974int gf_value (const CanonicalForm & f );
     975
    873976CanonicalForm make_cf ( const MP_INT & n );
    874977
    875978CanonicalForm make_cf ( const MP_INT & n, const MP_INT & d, bool normalize );
    876979
     980CanonicalForm make_cf_from_gf ( const int z );
     981
    877982
    878983#endif /* SINGULAR */
    879984
     985#ifdef HAVE_BIFAC
     986/* stuff included from ./bifac.h */
     987
     988
     989CFFList AbsFactorize( const CanonicalForm  & a );
     990
     991class BIFAC
     992{
     993////////////////////////////////////////////////////////////////
     994  public:
     995//////////////////////////////////////////////////////////////// 
     996
     997  // === KONST-/ DESTRUKTOREN ====
     998  BIFAC         ( void );  // Konstruktor
     999  virtual ~BIFAC( void );  // DESTRUKTOR
     1000
     1001  // === Funktionen =======
     1002  void     bifac(CanonicalForm f, bool absolute=true);
     1003  CFFList  getFactors( void ){ return  gl_RL; };
     1004
     1005
     1006////////////////////////////////////////////////////////////////
     1007 private:
     1008////////////////////////////////////////////////////////////////
     1009
     1010  // === Funktionen =======
     1011  void   passedTime();
     1012  void   biGanzMachen(  CanonicalForm & f );
     1013  void   biNormieren( CanonicalForm & f ) ;
     1014  void   convertResult(  CanonicalForm & f, int ch, int sw);
     1015  int    findCharacteristic(CanonicalForm f);
     1016//  void   matrix_drucken( CFMatrix M );
     1017  long int  anz_terme(  CanonicalForm & f );
     1018
     1019  CFList matrix2basis(CFMatrix A, int dim, int m, int n, CanonicalForm f);
     1020  CFList basisOfG(CanonicalForm f);
     1021  CFMatrix createA (CFList G, CanonicalForm f);
     1022  CanonicalForm  create_g    (CFList G);
     1023  CFList         createRg    (CFList G, CanonicalForm f);
     1024  CFList         createEg    (CFList G, CanonicalForm f);
     1025  CFList         createEgUni (CFList G, CanonicalForm f);
     1026
     1027  void     unifac(CanonicalForm f, int grad);
     1028  CanonicalForm RationalFactor (CanonicalForm phi, CanonicalForm f, \
     1029                                CanonicalForm fx, CanonicalForm g);
     1030  void   RationalFactorizationOnly (CFFList Phis, CanonicalForm f, CanonicalForm g);
     1031  CFList getAbsoluteFactors (CanonicalForm f1, CanonicalForm phi);
     1032  void   AbsoluteFactorization (CFFList Phis, CanonicalForm f, CanonicalForm g);
     1033  void   bifacSqrFree( CanonicalForm f );
     1034  void   bifacMain(CanonicalForm f);
     1035 
     1036
     1037  // === Variable =======
     1038  CFFList gl_RL;    // where to store the rational factorization
     1039  CFList  gl_AL;    // where to store the absolute factorization
     1040  bool   absolute;  // Compute an absolute factorization as well?
     1041  int    exponent;  //
     1042};
     1043
     1044#endif /* HAVE_BIFAC */
     1045
    8801046#endif /* ! INCL_FACTORY_H */
  • factory/winnt/factoryconf.h

    rb1d37f r49f1f45  
    1 /* ../factory/winnt/factoryconf.h automatically generated by makeheader from ../factory/factoryconf.template */
     1/* winnt/factoryconf.h automatically generated by makeheader from factoryconf.template */
    22/* emacs edit mode for this file is -*- C -*- */
    3 /* $Id: factoryconf.h,v 1.5 1997-12-09 16:37:58 schmidt Exp $ */
     3/* $Id: factoryconf.h,v 1.6 2007-11-20 10:08:03 Singular Exp $ */
    44
    55#ifndef INCL_FACTORYCONF_H
     
    2020/* }}} */
    2121
    22 /* stuff included from ../factory/winnt/config.h */
     22/* stuff included from ./winnt/config.h */
    2323
    2424/* emacs edit mode for this file is -*- C -*- */
    25 /* $Id: factoryconf.h,v 1.5 1997-12-09 16:37:58 schmidt Exp $ */
     25/* $Id: factoryconf.h,v 1.6 2007-11-20 10:08:03 Singular Exp $ */
    2626
    2727#ifndef INCL_CONFIG_H
     
    102102#endif /* ! INCL_CONFIG_H */
    103103
    104 /* stuff included from ../factory/assert.h */
     104/* stuff included from ./assert.h */
    105105
    106106/* emacs edit mode for this file is -*- C -*- */
    107 /* $Id: factoryconf.h,v 1.5 1997-12-09 16:37:58 schmidt Exp $ */
     107/* $Id: factoryconf.h,v 1.6 2007-11-20 10:08:03 Singular Exp $ */
    108108
    109109/* This is for compatibility with standard assert.h */
     
    134134/* }}} */
    135135
     136#ifdef __cplusplus
     137extern "C" {
     138#endif
     139
    136140#include <stdio.h>
    137141#include <stdlib.h>
     142
     143#ifdef __cplusplus
     144}
     145#endif
    138146
    139147/* {{{ permanent macro definitions */
Note: See TracChangeset for help on using the changeset viewer.