Changeset 57f13b in git


Ignore:
Timestamp:
Mar 27, 1997, 10:54:41 AM (27 years ago)
Author:
Jens Schmidt <schmidt@…>
Branches:
(u'spielwiese', '17f1d200f27c5bd38f5dfc6e8a0879242279d1d8')
Children:
83452f672f51e8f1610d8f803fd147fd3c2cd574
Parents:
043814c307adc58ae0e7174dc880bfb222e8e6dd
Message:
timing output changed to TIMING
debug output rewritten
debug output changed to DEBOUT


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

Legend:

Unmodified
Added
Removed
  • factory/fac_univar.cc

    r043814 r57f13b  
    11// emacs edit mode for this file is -*- C++ -*-
    2 // $Id: fac_univar.cc,v 1.4 1996-07-12 08:37:20 stobbe Exp $
     2// $Id: fac_univar.cc,v 1.5 1997-03-27 09:54:41 schmidt Exp $
    33
    44/*
    55$Log: not supported by cvs2svn $
     6Revision 1.4  1996/07/12 08:37:20  stobbe
     7"ZFactorizeUnivariate: now handles constants of the squarefree decomposition
     8"
     9
    610Revision 1.3  1996/06/26 13:17:03  stobbe
    711"ZFactorizeUnivariate: now handles the sign of the argument right.
     
    2226*/
    2327
    24 //#define TIMING
    25 
    26 #ifndef NDEBUG
    27 //#define DEBUGOUTPUT
    28 #endif
    29 
    30 #ifdef TIMING
    31 #include <sys/times.h>
    32 #endif
    33 
    3428#include <math.h>
     29
    3530#include "assert.h"
     31#include "debug.h"
     32#include "timing.h"
     33
    3634#include "cf_defs.h"
     35
    3736#include "fac_util.h"
    3837#include "fac_univar.h"
     
    4342#include "fac_sqrfree.h"
    4443
     44TIMING_DEFINE_PRINT(fac_choosePrimes);
     45TIMING_DEFINE_PRINT(fac_facModPrimes);
     46TIMING_DEFINE_PRINT(fac_liftFactors);
     47TIMING_DEFINE_PRINT(fac_combineFactors);
     48
    4549#define MAX_FP_FAC 3
    4650
     
    5054iextgcd ( const CanonicalForm & f, const CanonicalForm & g, CanonicalForm & a, CanonicalForm & b );
    5155
    52 #ifndef NDEBUG
    53 
     56#ifdef DEBUGOUTPUT
    5457static void
    5558hprint ( int * a )
     
    6366        i++;
    6467    }
    65     cerr << ")" << endl;
    66 }
    67 
     68    cerr << ")" << endl << endl;
     69}
    6870#endif
    6971
     
    245247    int * kvals = new int[no_iter];
    246248
    247     DEBOUT( cerr, "quadratic lift called with p = ", p );
    248     DEBOUTLN( cerr, "  and k = ", k );
     249    DEBOUTSL( cerr );
     250    DEBOUT( cerr, "quadratic lift called with p = " << p << "  and k = " << k );
     251    DEBOUTENDL( cerr );
    249252    for ( j = 0, i = k; i > 1; i = ( i+1 ) / 2, j++ ) kvals[j] = i;
    250253    kvals[j] = 1;
     
    273276            j--;
    274277            setCharacteristic( p, kvals[j+1] );
    275             DEBOUT( cerr, "lifting from p^", kvals[j+1] );
    276             DEBOUTLN( cerr, " to p^", kvals[j] );
     278            DEBOUTSL( cerr );
     279            DEBOUT( cerr, "lifting from p^" << kvals[j+1] << " to p^" << kvals[j] );
     280            DEBOUTENDL( cerr );
    277281            c = mapinto( c );
    278282            DEBOUTLN( cerr, " !!! g = ", mapinto( g ) );
     
    395399        Dh = new int [n]; Dh[0] = n;
    396400        exp = J.getItem().exp();
    397 #ifdef TIMING
    398         struct tms ts, te;
    399         times( &ts );
    400 #endif
     401        TIMING_START(fac_choosePrimes);
    401402        ok = choosePrimes( p, f );
    402 #ifdef TIMING
    403         times( &te );
    404         cout.setf( ios::fixed, ios::floatfield );
    405         cout.precision(2);
    406         cout << "time to choose the primes: "
    407              << float(te.tms_utime-ts.tms_utime) / CLK_TCK << " sec" << endl;
    408 #endif
     403        TIMING_END_AND_PRINT(fac_choosePrimes, "time to choose the primes: ");
    409404        if ( ! ok ) {
    410             cerr << "factorize warnig: no good prime found" << endl;
    411             cerr << f << endl;
     405            DEBOUTLN( cerr, "error: no good prime found to factorize ", f );
     406            ASSERT( 0, "error: no good prime found" );
    412407            ZF.append( CFFactor( f, exp ) );
    413408        }
    414409        else {
    415 #ifdef TIMING
    416             times( &ts );
    417 #endif
     410            TIMING_START(fac_facModPrimes);
    418411            for ( i = 0; i < MAX_FP_FAC; i++ ) {
    419412                setCharacteristic( p[i] );
     
    424417//              else
    425418//                  F[i] = FpFactorizeUnivariateCZ( fp, true );
    426                 DEBOUT( cerr, "F[i] = ", F[i] );
    427                 DEBOUTLN( cerr, ", p = ", p[i] );
     419                DEBOUTSL( cerr );
     420                DEBOUT( cerr, "F[i] = " << F[i] << ", p = " << p[i] );
     421                DEBOUTENDL( cerr );
    428422            }
    429 #ifdef TIMING
    430         times( &te );
    431         cout.setf( ios::fixed, ios::floatfield );
    432         cout.precision(2);
    433         cout << "time to factorize mod primes: "
    434              << float(te.tms_utime-ts.tms_utime) / CLK_TCK << " sec" << endl;
    435 #endif
     423            TIMING_END_AND_PRINT(fac_facModPrimes, "time to factorize mod primes: ");
    436424            setCharacteristic( 0 );
    437425#ifdef DEBUGOUTPUT
     426            DEBOUTLN( cerr, "D = ", ' ' );
    438427            hprint( D );
    439428#endif
     
    441430            hgroup( D );
    442431#ifdef DEBUGOUTPUT
     432            DEBOUTLN( cerr, "D = ", ' ' );
    443433            hprint( D );
    444434#endif
     
    447437                hgroup( Dh );
    448438#ifdef DEBUGOUTPUT
    449                 cerr << "Dh = ";
     439                DEBOUTLN( cerr, "Dh = ", ' ' );
    450440                hprint( Dh );
    451441#endif
    452442                hintersect( D, Dh );
    453443#ifdef DEBUGOUTPUT
    454                 cerr << "D = ";
     444                DEBOUTLN( cerr, "D = ", ' ' );
    455445                hprint( D );
    456446#endif
     
    475465            F[j].sort( cmpFactor );
    476466            I = F[j]; i = 0;
    477 #ifdef TIMING
    478             times( &ts );
    479 #endif
     467            TIMING_START(fac_liftFactors);
    480468            while ( I.hasItem() ) {
    481469                DEBOUTLN( cerr, "factor to lift = ", I.getItem().factor() );
     
    491479                    fp /= I.getItem().factor();
    492480                    ZF.append( CFFactor( dummy1, exp ) );
    493                     I.remove( 0 ); 
     481                    I.remove( 0 );
    494482                    I = F[j];
    495483                    i = 0;
     
    507495                }
    508496            }
    509 #ifdef TIMING
    510         times( &te );
    511         cout.setf( ios::fixed, ios::floatfield );
    512         cout.precision(2);
    513         cout << "time to lift the factors: "
    514              << float(te.tms_utime-ts.tms_utime) / CLK_TCK << " sec" << endl;
    515 #endif
     497            TIMING_END_AND_PRINT(fac_liftFactors, "time to lift the factors: ");
    516498            DEBOUTLN( cerr, "ZF = ", ZF );
    517499            initHG( Dh, theFactors );
    518500            hgroup( Dh );
    519501#ifdef DEBUGOUTPUT
    520             cerr << "Dh = ";
     502            DEBOUTLN( cerr, "Dh = ", ' ' );
    521503            hprint( Dh );
    522504#endif
     
    527509            DEBOUTLN( cerr, "theFactors = ", theFactors );
    528510            DEBOUTLN( cerr, "f = ", f );
    529             DEBOUT( cerr, "p = ", pk.getp() );
    530             DEBOUTLN( cerr, ", k = ", pk.getk() );
    531 #ifdef DEBUGOUTPUT
     511            DEBOUTSL( cerr );
     512            DEBOUT( cerr, "p = " << pk.getp() << ", k = " << pk.getk() );
     513            DEBOUTENDL( cerr );
     514#ifdef DEBUGOUTPUT
     515            DEBOUTLN( cerr, "D = ", ' ' );
    532516            hprint( D );
    533517#endif
     
    535519            (void)iextgcd( pk.getpk(), lf, dummy1, recip_lf );
    536520            DEBOUTLN( cerr, "recip_lf = ", recip_lf );
    537 #ifdef TIMING
    538             times( &ts );
    539 #endif
     521            TIMING_START(fac_combineFactors);
    540522            for ( i = 1; i < D[0]; i++ )
    541523                if ( D[i] != 0 )
     
    543525            if ( degree( f ) > 0 )
    544526                ZF.append( CFFactor( f, exp ) );
    545 #ifdef TIMING
    546         times( &te );
    547         cout.setf( ios::fixed, ios::floatfield );
    548         cout.precision(2);
    549         cout << "time to combine the factors: "
    550              << float(te.tms_utime-ts.tms_utime) / CLK_TCK << " sec" << endl;
    551 #endif
     527            TIMING_END_AND_PRINT(fac_combineFactors, "time to combine the factors: ");
    552528        }
    553529    }
Note: See TracChangeset for help on using the changeset viewer.