Changeset 5625fe in git


Ignore:
Timestamp:
Feb 19, 2013, 1:20:53 PM (10 years ago)
Author:
Oleksandr Motsak <motsak@…>
Branches:
(u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'a800fe4b3e9d37a38c5a10cc0ae9dfa0c15a4ee6')
Children:
e3c718ce6966101d56d035026b091d8a404af532
Parents:
73b2e93d708311ad220a6ca578c7bff10757938aedb81bb221ceae0874c0570e0ac83e5a84b6f77d
Message:
Merge pull request #274 from mmklee/sync

Sync
Files:
12 added
14 edited

Legend:

Unmodified
Added
Removed
  • Singular/iparith.cc

    r73b2e9 r5625fe  
    6363#include <Singular/linearAlgebra_ip.h>
    6464#ifdef HAVE_FACTORY
     65#  include <factory/factory.h>
    6566#  include <polys/clapsing.h>
    6667#  include <kernel/kstdfac.h>
    67 #endif /* HAVE_FACTORY */
    68 #ifdef HAVE_FACTORY
    6968#  include <kernel/fglm.h>
    7069#  include <Singular/fglm.h>
     
    23512350static BOOLEAN jjGCD_BI(leftv res, leftv u, leftv v)
    23522351{
     2352#ifdef HAVE_FACTORY
     2353  number n1 = (number) u->CopyD();
     2354  number n2 = (number) v->CopyD();
     2355  CanonicalForm C1, C2;
     2356  C1 = coeffs_BIGINT->convSingNFactoryN (n1,TRUE,coeffs_BIGINT);
     2357  C2 = coeffs_BIGINT->convSingNFactoryN (n2,TRUE,coeffs_BIGINT);
     2358  CanonicalForm G = gcd (C1,C2);
     2359  number g = coeffs_BIGINT->convFactoryNSingN (G,coeffs_BIGINT);
     2360  res->data = g;
     2361  return FALSE;
     2362#else
    23532363  number a=(number) u->Data();
    23542364  number b=(number) v->Data();
     
    23642374  }
    23652375  return FALSE;
     2376#endif
    23662377}
    23672378static BOOLEAN jjGCD_N(leftv res, leftv u, leftv v)
  • Tst/New.lst

    redb81b r5625fe  
    1818New/print_param_poly_short.tst
    1919New/ignoring_denominators_of_coefficients.tst
     20New/syz_cleardenom.tst
     21New/sat_cleardenom.tst
     22New/quotient_cleardenom.tst
     23
  • Tst/Short.lst

    redb81b r5625fe  
    243243;MP Short/stratify.tst
    244244Short/string.tst
     245Short/symodstd.tst
    245246Short/test_c_dp.tst
    246247Short/triang_s.tst
  • Tst/Short/ncfactor_example2_7FromMaster_s.tst

    • Property mode changed from 100755 to 100644
  • Tst/Short/ncfactor_example_all_procedures_s.res.gz.uu

    • Property mode changed from 100755 to 100644
  • Tst/Short/ncfactor_inhomog_s.res.gz.uu

    • Property mode changed from 100755 to 100644
  • Tst/Short/ncfactor_koepfShift_s.tst

    • Property mode changed from 100755 to 100644
  • Tst/Short/ncfactor_koepf_s.tst

    • Property mode changed from 100755 to 100644
  • Tst/Short/ncfactor_tsai_s.tst

    • Property mode changed from 100755 to 100644
  • factory/ftmpl_inst.cc

    r73b2e9 r5625fe  
    4444template class SubMatrix<CanonicalForm>;
    4545template class Array<REvaluation>;
     46// libfac:
     47template class Array<int>;
     48template class Array<Variable>;
     49template class List<Variable>;
     50template class ListItem<Variable>;
     51template class ListIterator<Variable> ;
     52template class List<int>;
     53template class ListItem<int>;
     54template class ListIterator<int>;
     55template class List< List<int> >;
     56template class ListItem< List<int> >;
     57template class ListIterator< List<int> >;
     58template class List< List<CanonicalForm> >;
     59template class ListIterator< List<CanonicalForm> >;
     60
     61
     62template List<Variable> Union ( const List<Variable>&, const List<Variable>& );
     63template List<Variable> Difference ( const List<Variable>&, const List<Variable>& );
     64
    4665//}}}
    4766
  • factory/int_rat.cc

    r73b2e9 r5625fe  
    1313#include "gmpext.h"
    1414
    15 static int intgcd( int a, int b )
     15static long intgcd( long a, long b )
    1616{
    1717    if ( a < 0 ) a = -a;
    1818    if ( b < 0 ) b = -b;
    1919
    20     int c;
     20    long c;
    2121
    2222    while ( b != 0 )
     
    2929}
    3030
    31 static long intgcd( long a, long b )
    32 {
    33     if ( a < 0 ) a = -a;
    34     if ( b < 0 ) b = -b;
    35 
    36     long c;
    37 
    38     while ( b != 0 )
    39     {
    40         c = a % b;
    41         a = b;
    42         b = c;
    43     }
    44     return a;
    45 }
    46 
    4731
    4832InternalRational::InternalRational()
     
    6852    else
    6953    {
    70         int g = intgcd( n, d );
     54        long g = intgcd( (long) n, (long) d );
    7155        if ( d < 0 )
    7256        {
    73           mpz_init_set_si( _num, -n / g );
    74           mpz_init_set_si( _den, -d / g );
     57          mpz_init_set_si( _num, -((long)n) / g );
     58          mpz_init_set_si( _den, -((long)d) / g );
    7559        }
    7660        else
  • factory/libfac/factor/tmpl_inst.cc

    r73b2e9 r5625fe  
    1313#include "cf_reval.h"
    1414
    15 #include "templates/ftmpl_array.cc"
    16 #include "templates/ftmpl_factor.cc"
     15//#include "templates/ftmpl_array.cc"
     16//#include "templates/ftmpl_factor.cc"
    1717#include "templates/ftmpl_list.cc"
    18 #include "templates/ftmpl_functions.h"
    19 #include "templates/ftmpl_matrix.cc"
     18//#include "templates/ftmpl_functions.h"
     19//#include "templates/ftmpl_matrix.cc"
    2020
    2121// place here your own template stuff, not instantiated by factory
     
    2323#include <libfac/factor/class.cc>
    2424
    25 template class List<int>;
    26 template class ListIterator<int>;
    27 
    28 template class List<IntList>;
    29 template class ListIterator<IntList>;
     25//template class List<IntList>;
     26//template class ListIterator<IntList>;
    3027
    3128template class Substitution<CanonicalForm>;
     
    3936
    4037// for charsets:
    41 template class List<CFList>;
    42 template class ListIterator<CFList>;
    43 template class List<Variable>;
    44 template class ListIterator<Variable> ;
    45 
    46 template List<Variable> Union ( const List<Variable>&, const List<Variable>& );
    47 template List<Variable> Difference ( const List<Variable>&, const List<Variable>& );
     38//template class List<CFList>;
     39//template class ListIterator<CFList>;
    4840
    4941#ifndef NOSTREAMIO
  • libpolys/polys/ext_fields/algext.cc

    redb81b r5625fe  
    5252#endif
    5353
    54    
     54
    5555#include <polys/ext_fields/algext.h>
    5656#define TRANSEXT_PRIVATES 1
     
    670670}
    671671#endif
     672number napLcm(number b, const coeffs cf)
     673{
     674  number h=n_Init(1,naRing->cf);
     675  poly bb=(poly)b;
     676  number d;
     677  while(bb!=NULL)
     678  {
     679    d=n_Lcm(h,pGetCoeff(bb), naRing->cf);
     680    n_Delete(&h,naRing->cf);
     681    h=d;
     682    pIter(bb);
     683  }
     684}
     685number naLcmContent(number a, number b, const coeffs cf)
     686{
     687  if (nCoeff_is_Zp(naRing->cf)) return naCopy(a,cf);
     688  else return ndGcd(a,b,cf);
     689  #if 0
     690  {
     691    a=(number)p_Copy((poly)a,naRing);
     692    number t=napLcm(b,cf);
     693    if(!naIsOne(t,cf))
     694    {
     695      number bt, rr;
     696      poly xx=(poly)a;
     697      while (xx!=NULL)
     698      {
     699        bt = n_Gcd(t, pGetCoeff(xx), naRing->cf);
     700        rr = n_Mult(t, pGetCoeff(xx), naRing->cf);
     701        n_Delete(&pGetCoeff(xx),naRing->cf);
     702        pGetCoeff(xx) = n_Div(rr, bt, naRing->cf);
     703        n_Normalize(pGetCoeff(xx),naRing->cf);
     704        n_Delete(&bt,naRing->cf);
     705        n_Delete(&rr,naRing->cf);
     706        pIter(xx);
     707      }
     708    }
     709    n_Delete(&t,naRing->cf);
     710    return (number) a;
     711  }
     712  #endif
     713}
    672714
    673715/* expects *param to be castable to AlgExtInfo */
     
    689731  if( rEqual(naRing, e->r, TRUE) ) // also checks the equality of qideals
    690732  {
    691     const ideal mi = naRing->qideal; 
     733    const ideal mi = naRing->qideal;
    692734    assume( IDELEMS(mi) == 1 );
    693735    const ideal ii = e->r->qideal;
     
    696738    // TODO: the following should be extended for 2 *equal* rings...
    697739    assume( p_EqualPolys(mi->m[0], ii->m[0], naRing, e->r) );
    698    
     740
    699741    rDelete(e->r);
    700    
     742
    701743    return TRUE;
    702744  }
     
    773815number naGcd(number a, number b, const coeffs cf)
    774816{
     817  if (a==NULL)  return naCopy(b,cf);
     818  if (b==NULL)  return naCopy(a,cf);
     819
     820  poly ax=(poly)a;
     821  poly bx=(poly)b;
     822  if (pNext(ax)!=NULL)
     823    return (number)p_Copy(ax, naRing);
     824  else
     825  {
     826    if(nCoeff_is_Zp(naRing->cf))
     827      return naInit(1,cf);
     828    else
     829    {
     830      number x = n_Copy(pGetCoeff((poly)a),naRing->cf);
     831      if (n_IsOne(x,naRing->cf))
     832        return (number)p_NSet(x,naRing);
     833      while (pNext(ax)!=NULL)
     834      {
     835        pIter(ax);
     836        number y = n_Gcd(x, pGetCoeff(ax), naRing->cf);
     837        n_Delete(&x,naRing->cf);
     838        x = y;
     839        if (n_IsOne(x,naRing->cf))
     840          return (number)p_NSet(x,naRing);
     841      }
     842      do
     843      {
     844        number y = n_Gcd(x, pGetCoeff(bx), naRing->cf);
     845        n_Delete(&x,naRing->cf);
     846        x = y;
     847        if (n_IsOne(x,naRing->cf))
     848          return (number)p_NSet(x,naRing);
     849        pIter(bx);
     850      }
     851      while (bx!=NULL);
     852      return (number)p_NSet(x,naRing);
     853    }
     854  }
     855#if 0
    775856  naTest(a); naTest(b);
    776   if ((a == NULL) && (b == NULL)) WerrorS(nDivBy0);
    777857  const ring R = naRing;
    778858  return (number) singclap_gcd(p_Copy((poly)a, R), p_Copy((poly)b, R), R);
     859#endif
    779860//  return (number)p_Gcd((poly)a, (poly)b, naRing);
    780861}
     
    784865  naTest(a);
    785866  if (a == NULL) WerrorS(nDivBy0);
    786  
     867
    787868  poly aFactor = NULL; poly mFactor = NULL; poly theGcd = NULL;
    788869// singclap_extgcd!
     
    792873
    793874//  if( ret ) theGcd = p_ExtGcd((poly)a, aFactor, naMinpoly, mFactor, naRing);
    794  
     875
    795876  naTest((number)theGcd); naTest((number)aFactor); naTest((number)mFactor);
    796877  p_Delete(&mFactor, naRing);
    797  
     878
    798879  //  /* the gcd must be 1 since naMinpoly is irreducible and a != NULL: */
    799   //  assume(naIsOne((number)theGcd, cf)); 
     880  //  assume(naIsOne((number)theGcd, cf));
    800881
    801882  if( !naIsOne((number)theGcd, cf) )
    802   { 
     883  {
    803884    WerrorS("zero divisor found - your minpoly is not irreducible");
    804885    p_Delete(&aFactor, naRing); aFactor = NULL;
     
    9841065  const ring   R = cf->extRing;
    9851066  assume(R != NULL);
    986   const coeffs Q = R->cf; 
    987   assume(Q != NULL); 
    988   assume(nCoeff_is_Q(Q)); 
     1067  const coeffs Q = R->cf;
     1068  assume(Q != NULL);
     1069  assume(nCoeff_is_Q(Q));
    9891070
    9901071  numberCollectionEnumerator.Reset();
     
    10041085
    10051086  int normalcount = 0;
    1006  
     1087
    10071088  poly cand1, cand;
    1008  
     1089
    10091090  do
    10101091  {
     
    10131094
    10141095    naTest(n);
    1015    
     1096
    10161097    cand1 = (poly)n;
    10171098
     
    10361117    number& n = numberCollectionEnumerator.Current();
    10371118    ++length;
    1038    
     1119
    10391120    if( (--normalcount) <= 0)
    10401121      naNormalize(n, cf);
    1041    
     1122
    10421123    naTest(n);
    10431124
    10441125//    p_InpGcd(cand, (poly)n, R);
    1045    
     1126
    10461127    cand = singclap_gcd(cand, p_Copy((poly)n, R), R);
    10471128
    10481129//    cand1 = p_Gcd(cand,(poly)n, R); p_Delete(&cand, R); cand = cand1;
    1049    
     1130
    10501131    assume( naGreaterZero((number)cand, cf) ); // ???
    10511132/*
     
    10691150    }
    10701151*/
    1071    
    1072   } 
     1152
     1153  }
    10731154
    10741155  // part3: all coeffs = all coeffs / cand
     
    10761157    cand = p_Neg(cand, R);
    10771158
    1078   c = (number)cand; naTest(c); 
     1159  c = (number)cand; naTest(c);
    10791160
    10801161  poly cInverse = (poly)naInvers(c, cf);
    10811162  assume(cInverse != NULL); // c is non-zero divisor!?
    10821163
    1083  
     1164
    10841165  numberCollectionEnumerator.Reset();
    10851166
     
    11021183      assume(length == 0);
    11031184    }
    1104    
    1105     definiteReduce((poly &)n, naMinpoly, cf);   
    1106   }
    1107  
     1185
     1186    definiteReduce((poly &)n, naMinpoly, cf);
     1187  }
     1188
    11081189  assume(length == 0);
    11091190  assume(cInverse == NULL); //   p_Delete(&cInverse, R);
     
    11141195  number cc;
    11151196
    1116   n_ClearContent(itr, cc, Q); // TODO: get rid of (-LC) normalization!? 
     1197  n_ClearContent(itr, cc, Q); // TODO: get rid of (-LC) normalization!?
    11171198
    11181199  // over alg. ext. of Q // takes over the input number
    1119   c = (number) p_Mult_nn( (poly)c, cc, R); 
     1200  c = (number) p_Mult_nn( (poly)c, cc, R);
    11201201//      p_Mult_q(p_NSet(cc, R), , R);
    11211202
     
    11691250      }
    11701251    }
    1171 */ 
    1172 
    1173  
     1252*/
     1253
     1254
    11741255//  c = n_Init(1, cf); assume(FALSE); // TODO: NOT YET IMPLEMENTED!!!
    11751256}
     
    11831264
    11841265  assume(cf->extRing != NULL);
    1185   const coeffs Q = cf->extRing->cf; 
    1186   assume(Q != NULL); 
    1187   assume(nCoeff_is_Q(Q)); 
     1266  const coeffs Q = cf->extRing->cf;
     1267  assume(Q != NULL);
     1268  assume(nCoeff_is_Q(Q));
    11881269  number n;
    11891270  CRecursivePolyCoeffsEnumerator<NAConverter> itr(numberCollectionEnumerator); // recursively treat the numbers as polys!
     
    12691350#endif
    12701351  cf->cfGcd          = naGcd;
    1271   //cf->cfLcm          = naLcm;
     1352  cf->cfLcm          = naLcmContent;
    12721353  cf->cfSize         = naSize;
    12731354  cf->nCoeffIsEqual  = naCoeffIsEqual;
     
    12891370    cf->cfClearDenominators = naClearDenominators;
    12901371  }
    1291  
     1372
    12921373  return FALSE;
    12931374}
Note: See TracChangeset for help on using the changeset viewer.