Changeset 1c8bcb in git for Singular/clapsing.cc


Ignore:
Timestamp:
Apr 23, 1998, 12:00:49 PM (26 years ago)
Author:
Jens Schmidt <schmidt@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
54035bd37f9bb56d31efcf68edf64aecf6de38d9
Parents:
d6fc3c5cb4a5d2eed49001686d571df819c5496b
Message:
	* clapsing.cc (FACTORY_ALGOUT, FACTORY_CFTROUT, FACTORY_CFAOUT):
	  new macros for debugging data transfer to Factory
 	  (singclap_divide_content, singclap_alglcm,
 	  singclap_algdividecontent): use the new macros

	* clapsing.cc (FACTORY_GCD_TIMING, singclap_divide_content,
	  singclap_alglcm, singclap_algdividecontent): dependency on
	  FACTORY_GCD_TEST removed.  Timings are now done directly using
	  `TIMING_START' and `TIMING_END' which are defined to expand to
	  nothing if `FACTORY_GCD_TIMING' is off.


git-svn-id: file:///usr/local/Singular/svn/trunk@1433 2c84dea3-7e68-4137-9b89-c4e89433aadc
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Singular/clapsing.cc

    rd6fc3c r1c8bcb  
    33*  Computer Algebra System SINGULAR     *
    44****************************************/
    5 // $Id: clapsing.cc,v 1.31 1998-04-23 09:52:08 Singular Exp $
     5// $Id: clapsing.cc,v 1.32 1998-04-23 10:00:49 schmidt Exp $
    66/*
    77* ABSTRACT: interface between Singular and factory
     
    2929//   with appropriately translated new gcd.
    3030// FACTORY_GCD_TIMING: accumulate time used for gcd calculations.
    31 //   For this option, the file `timing.h' from the Factory
    32 //   distribution has to be copied to the Singular source directory.
    33 //   Works only with new gcd.
    34 // FACTORY_GCD_DEBOUT: print polynomials involved in gcd calculations
     31//   Time may be printed (and reset) with `system("gcdtime");'.
     32//   For tis define, `timing.h' from the factory source directory
     33//   has to be copied to the Singualr source directory.
     34//   Note: for better readability, the macros `TIMING_START()' and
     35//   `TIMING_END()' are used in any case.  However, they expand to
     36//   nothing if `FACTORY_GCD_TIMING' is off.
     37// FACTORY_GCD_DEBOUT: print polynomials involved in gcd calculations.
     38//   The polynomials are printed by means of the macros
     39//   `FACTORY_*OUT' which are defined to be empty if
     40//   `FACTORY_GCD_DEBOUT' is off.
    3541
    3642#ifdef FACTORY_GCD_STAT
     
    3945
    4046#ifdef FACTORY_GCD_TIMING
    41 #define FACTORY_GCD_TEST
    4247#define TIMING
    4348#include "timing.h"
     
    4550TIMING_DEFINE_PRINT( algContentTimer );
    4651TIMING_DEFINE_PRINT( algLcmTimer );
     52#else
     53#define TIMING_START( timer )
     54#define TIMING_END( timer )
    4755#endif
    4856
     
    5058#include "longalg.h"
    5159#include "febase.h"
     60// alg f
     61#define FACTORY_ALGOUT( tag, f ) \
     62  StringSetS( tag ); \
     63  napWrite( f ); \
     64  PrintS(StringAppend("\n"));
     65// CanonicalForm f, represents transcendent extension
     66#define FACTORY_CFTROUT( tag, f ) \
     67  { \
     68    alg F=convClapPSingTr( f ); \
     69    StringSetS( tag ); \
     70    napWrite( F ); \
     71    PrintS(StringAppend("\n")); \
     72    napDelete( &F ); \
     73  }
     74// CanonicalForm f, represents algebraic extension
     75#define FACTORY_CFAOUT( tag, f ) \
     76  { \
     77    alg F=convClapASingA( f ); \
     78    StringSetS( tag ); \
     79    napWrite( F ); \
     80    PrintS(StringAppend("\n")); \
     81    napDelete( &F ); \
     82  }
     83#else
     84#define FACTORY_ALGOUT( tag, f )
     85#define FACTORY_CFTROUT( tag, f );
     86#define FACTORY_CFAOUT( tag, f );
    5287#endif
    5388
     
    365400    poly p = pNext(f);
    366401    nTest(pGetCoeff(f));
    367 #ifdef FACTORY_GCD_DEBOUT
    368     StringSetS("g0 = ");
    369     if (f) napWrite(((lnumber)pGetCoeff(f))->z);
    370     PrintS(StringAppend("\n"));
    371 #endif
     402    FACTORY_ALGOUT( "G = ", (((lnumber)pGetCoeff(f))->z) );
    372403    g = convSingTrClapP( ((lnumber)pGetCoeff(f))->z );
    373404    L.append( g );
    374 #ifdef FACTORY_GCD_TIMING
    375405    TIMING_START( contentTimer );
    376 #endif
    377406    while ( (p != NULL) && (g != 1) )
    378407    {
    379408      nTest(pGetCoeff(p));
    380 #ifdef FACTORY_GCD_DEBOUT
    381       StringSetS("h = ");
    382       if (p) napWrite(((lnumber)pGetCoeff(p))->z);
    383       PrintS(StringAppend("\n"));
    384 #endif
     409      FACTORY_ALGOUT( "h = ", (((lnumber)pGetCoeff(p))->z) );
    385410      h = convSingTrClapP( ((lnumber)pGetCoeff(p))->z );
    386411      p = pNext( p );
     
    391416      g = CFPrimitiveGcdUtil::gcd( g, h );
    392417#else
    393 
    394       // this part is translated if there are not any options at all
    395418      g = gcd( g, h );
    396 
    397 #endif
    398 #ifdef FACTORY_GCD_DEBOUT
    399       StringSetS("g = ");
    400       napWrite(convClapPSingTr(g));
    401       PrintS(StringAppend("\n"));
    402 #endif
     419#endif
     420      FACTORY_CFTROUT( "g = ", g );
    403421      L.append( h );
    404422    }
    405 #ifdef FACTORY_GCD_TIMING
    406423    TIMING_END( contentTimer );
    407 #endif
     424    FACTORY_CFTROUT( "C = ", g );
    408425    if ( g == 1 )
    409426    {
     
    956973alg singclap_alglcm ( alg f, alg g )
    957974{
    958 #ifdef FACTORY_GCD_DEBOUT
    959     StringSetS("f = ");
    960     napWrite(f);
    961     PrintS(StringAppend("\n"));
    962     StringSetS("g = ");
    963     napWrite(g);
    964     PrintS(StringAppend("\n"));
    965 #endif
    966   // over Q(a) / Fp(a)
     975 FACTORY_ALGOUT( "f = ", f );
     976 FACTORY_ALGOUT( "g = ", g );
     977
     978 // over Q(a) / Fp(a)
    967979 if (nGetChar()==1) setCharacteristic( 0 );
    968980 else               setCharacteristic( -nGetChar() );
    969981 alg res;
     982
    970983#ifdef FACTORY_GCD_STAT
    971984 fprintf( stderr, "algLcm:\t" );
    972985#endif
     986
    973987 if (currRing->minpoly!=NULL)
    974988 {
     
    976990   Variable a=rootOf(mipo);
    977991   CanonicalForm F( convSingAClapA( f,a ) ), G( convSingAClapA( g,a ) );
    978 #ifdef FACTORY_GCD_TIMING
    979992   CanonicalForm GCD;
     993
    980994   TIMING_START( algLcmTimer );
     995   // calculate gcd
     996#ifdef FACTORY_GCD_TEST
    981997   GCD = CFPrimitiveGcdUtil::gcd( F, G );
     998#else
     999   GCD = gcd( F, G );
     1000#endif
    9821001   TIMING_END( algLcmTimer );
    983    res= convClapASingA( (F/ GCD)*G );
    984 #elif defined( FACTORY_GCD_TEST )
    985    res= convClapASingA( (F/ CFPrimitiveGcdUtil::gcd( F, G ))*G );
    986 #else
    987 
    988    // this part is translated if there are not any options at all
    989    res= convClapASingA( (F/ gcd( F, G ))*G );
    990 
    991 #endif
     1002
     1003   FACTORY_CFAOUT( "gcd = ", GCD );
     1004
     1005   // calculate lcm
     1006   res= convClapASingA( (F/GCD)*G );
    9921007 }
    9931008 else
    9941009 {
    9951010   CanonicalForm F( convSingTrClapP( f ) ), G( convSingTrClapP( g ) );
    996 #ifdef FACTORY_GCD_TIMING
    9971011   CanonicalForm GCD;
    9981012   TIMING_START( algLcmTimer );
     1013   // calculate gcd
     1014#ifdef FACTORY_GCD_TEST
    9991015   GCD = CFPrimitiveGcdUtil::gcd( F, G );
     1016#else
     1017   GCD = gcd( F, G );
     1018#endif
    10001019   TIMING_END( algLcmTimer );
     1020
     1021   FACTORY_CFTROUT( "gcd = ", GCD );
     1022
     1023   // calculate lcm
    10011024   res= convClapPSingTr( (F/GCD)*G );
    1002 #elif defined( FACTORY_GCD_TEST )
    1003    res= convClapPSingTr( (F/CFPrimitiveGcdUtil::gcd( F, G ))*G );
    1004 #else
    1005 
    1006    // this part is translated if there are not any options at all
    1007    res= convClapPSingTr( (F/gcd( F, G ))*G );
    1008 
    1009 #endif
    10101025 }
     1026
    10111027 Off(SW_RATIONAL);
    1012 #ifdef FACTORY_GCD_DEBOUT
    1013     StringSetS("res = ");
    1014     napWrite(res);
    1015     PrintS(StringAppend("\n"));
    1016 #endif
    10171028 return res;
    10181029}
     
    10201031void singclap_algdividecontent ( alg f, alg g, alg &ff, alg &gg )
    10211032{
    1022 #ifdef FACTORY_GCD_DEBOUT
    1023   alg algGcd;
    1024   StringSetS("f = ");
    1025   napWrite(f);
    1026   PrintS(StringAppend("\n"));
    1027   StringSetS("g = ");
    1028   napWrite(g);
    1029   PrintS(StringAppend("\n"));
    1030 #endif
    1031   // over Q(a) / Fp(a)
     1033 FACTORY_ALGOUT( "f = ", f );
     1034 FACTORY_ALGOUT( "g = ", g );
     1035
     1036 // over Q(a) / Fp(a)
    10321037 if (nGetChar()==1) setCharacteristic( 0 );
    10331038 else               setCharacteristic( -nGetChar() );
    10341039 ff=gg=NULL;
     1040
    10351041#ifdef FACTORY_GCD_STAT
    10361042 fprintf( stderr, "alCont:\t" );
    10371043#endif
     1044
    10381045 if (currRing->minpoly!=NULL)
    10391046 {
     
    10411048   Variable a=rootOf(mipo);
    10421049   CanonicalForm F( convSingAClapA( f,a ) ), G( convSingAClapA( g,a ) );
    1043 #ifdef FACTORY_GCD_TIMING
    10441050   CanonicalForm GCD;
     1051
    10451052   TIMING_START( algContentTimer );
     1053#ifdef FACTORY_GCD_TEST
    10461054   GCD=CFPrimitiveGcdUtil::gcd( F, G );
     1055#else
     1056   GCD=gcd( F, G );
     1057#endif
    10471058   TIMING_END( algContentTimer );
    1048 #elif defined( FACTORY_GCD_TEST )
    1049    CanonicalForm GCD=CFPrimitiveGcdUtil::gcd( F, G );
    1050 #else
    1051 
    1052    // this part is translated if there are not any options at all
    1053    CanonicalForm GCD=gcd( F, G );
    1054 
    1055 #endif
     1059
     1060   FACTORY_CFAOUT( "gcd = ", GCD );
     1061
    10561062   if (GCD!=1)
    10571063   {
     
    10591065     gg= convClapASingA( G/ GCD );
    10601066   }
    1061 #ifdef FACTORY_GCD_DEBOUT
    1062    algGcd=convClapASingA( GCD );
    1063 #endif
    10641067 }
    10651068 else
    10661069 {
    10671070   CanonicalForm F( convSingTrClapP( f ) ), G( convSingTrClapP( g ) );
    1068 #ifdef FACTORY_GCD_TIMING
    10691071   CanonicalForm GCD;
     1072
    10701073   TIMING_START( algContentTimer );
     1074#ifdef FACTORY_GCD_TEST
    10711075   GCD=CFPrimitiveGcdUtil::gcd( F, G );
     1076#else
     1077   GCD=gcd( F, G );
     1078#endif
    10721079   TIMING_END( algContentTimer );
    1073 #elif defined( FACTORY_GCD_TEST )
    1074    CanonicalForm GCD=CFPrimitiveGcdUtil::gcd( F, G );
    1075 #else
    1076 
    1077    // this part is translated if there are not any options at all
    1078    CanonicalForm GCD=gcd( F, G );
    1079 
    1080 #endif
     1080
     1081   FACTORY_CFTROUT( "gcd = ", GCD );
     1082
    10811083   if (GCD!=1)
    10821084   {
     
    10841086     gg= convClapPSingTr( G/ GCD );
    10851087   }
    1086 #ifdef FACTORY_GCD_DEBOUT
    1087    algGcd=convClapPSingTr( GCD );
    1088 #endif
    10891088 }
     1089
    10901090 Off(SW_RATIONAL);
    1091 #ifdef FACTORY_GCD_DEBOUT
    1092   StringSetS("gcd = ");
    1093   napWrite(algGcd);
    1094   PrintS(StringAppend("\n"));
    1095   napDelete(&algGcd);
    1096 #endif
    1097 }
    1098 #endif
     1091}
     1092#endif
Note: See TracChangeset for help on using the changeset viewer.