Changeset b1a453 in git
- Timestamp:
- Feb 19, 2014, 2:49:08 PM (10 years ago)
- Branches:
- (u'spielwiese', '8e0ad00ce244dfd0756200662572aef8402f13d5')
- Children:
- ace936d6dc5d51a34013b39f57841e36db382b01
- Parents:
- 607d8449052875a7ec694f015644148d54da45b5
- git-author:
- Martin Lee <martinlee84@web.de>2014-02-19 14:49:08+01:00
- git-committer:
- Martin Lee <martinlee84@web.de>2014-03-06 11:04:13+01:00
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/extra.cc
r607d84 rb1a453 2679 2679 // } 2680 2680 // else 2681 /*==================== isSqrFree =============================*/2682 if(strcmp(sys_cmd,"isSqrFree")==0)2683 {2684 if ((h!=NULL) &&(h->Typ()==POLY_CMD))2685 {2686 res->rtyp=INT_CMD;2687 res->data=(void *)(long) singclap_isSqrFree((poly)h->Data(), currRing);2688 return FALSE;2689 }2690 else2691 WerrorS("poly expected");2692 }2693 else2694 2681 /*==================== pDivStat =============================*/ 2695 2682 #if defined(PDEBUG) || defined(PDIV_DEBUG) -
factory/cf_algorithm.h
r607d84 rb1a453 71 71 CFFList sqrFree ( const CanonicalForm & f, bool sort= false ); 72 72 73 bool isSqrFree ( const CanonicalForm & f );74 75 73 CanonicalForm homogenize( const CanonicalForm & f, const Variable & x); 76 74 CanonicalForm homogenize( const CanonicalForm & f, const Variable & x, -
factory/cf_factor.cc
r607d84 rb1a453 780 780 } 781 781 782 bool isSqrFree ( const CanonicalForm & f )783 {784 // ASSERT( f.isUnivariate(), "multivariate factorization not implemented" );785 if ( getCharacteristic() == 0 )786 return isSqrFreeZ( f );787 else788 return isSqrFreeFp( f );789 }790 -
factory/fac_sqrfree.cc
r607d84 rb1a453 11 11 #include "cf_map.h" 12 12 #include "cf_algorithm.h" 13 14 static int divexp = 1;15 16 static void divexpfunc ( CanonicalForm &, int & e )17 {18 e /= divexp;19 }20 13 21 14 static int … … 49 42 return result; 50 43 } 51 52 CFFList sqrFreeFp ( const CanonicalForm & f )53 {54 CanonicalForm t0 = f, t, v, w, h;55 CanonicalForm leadcf = t0.lc();56 Variable x = f.mvar();57 CFFList F;58 int p = getCharacteristic();59 int k, e = 1;60 61 if ( ! leadcf.isOne() )62 t0 /= leadcf;63 64 divexp = p;65 while ( t0.degree(x) > 0 )66 {67 t = gcd( t0, t0.deriv() );68 v = t0 / t;69 k = 0;70 while ( v.degree(x) > 0 )71 {72 k = k+1;73 if ( k % p == 0 )74 {75 t /= v;76 k = k+1;77 }78 w = gcd( t, v );79 h = v / w;80 v = w;81 t /= v;82 if ( h.degree(x) > 0 )83 F.append( CFFactor( h/h.lc(), e*k ) );84 }85 t0 = apply( t, divexpfunc );86 e = p * e;87 }88 if ( ! leadcf.isOne() )89 {90 if ( !F.isEmpty() && (F.getFirst().exp() == 1) )91 {92 leadcf = F.getFirst().factor() * leadcf;93 F.removeFirst();94 }95 F.insert( CFFactor( leadcf, 1 ) );96 }97 return F;98 }99 100 bool isSqrFreeFp( const CanonicalForm & f )101 {102 CFFList F = sqrFreeFp( f );103 return ( F.length() == 1 && F.getFirst().exp() == 1 );104 }105 106 bool isSqrFreeZ ( const CanonicalForm & f )107 {108 return gcd( f, f.deriv() ).degree() == 0;109 }110 111 /*112 113 CFFList sqrFreeZ ( const CanonicalForm & a )114 {115 CanonicalForm b = a.deriv(), c = gcd( a, b );116 CanonicalForm y, z, w = a / c;117 int i = 1;118 CFFList F;119 120 while ( ! c.degree() == 0 )121 {122 y = gcd( w, c ); z = w / y;123 if ( degree( z ) > 0 )124 if ( lc( z ).sign() < 0 )125 F.append( CFFactor( -z, i ) );126 else127 F.append( CFFactor( z, i ) );128 i++;129 w = y; c = c / y;130 }131 if ( degree( w ) > 0 )132 if ( lc( w ).sign() < 0 )133 F.append( CFFactor( -w, i ) );134 else135 F.append( CFFactor( w, i ) );136 return F;137 }138 */139 44 140 45 CFFList sqrFreeZ ( const CanonicalForm & a ) -
factory/fac_sqrfree.h
r607d84 rb1a453 10 10 CFFList sortCFFList ( CFFList & F ); 11 11 12 CFFList sqrFreeFp ( const CanonicalForm & f );13 14 bool isSqrFreeFp ( const CanonicalForm & f );15 16 12 CFFList sqrFreeZ ( const CanonicalForm & f ); 17 18 bool isSqrFreeZ ( const CanonicalForm & f );19 13 20 14 /// squarefree part of a poly -
libpolys/polys/clapsing.cc
r607d84 rb1a453 1550 1550 } 1551 1551 1552 BOOLEAN singclap_isSqrFree(poly f, const ring r)1553 {1554 BOOLEAN b=FALSE;1555 CanonicalForm F( convSingPFactoryP( f,r ) );1556 if((r->cf->type==n_Zp)&&(!F.isUnivariate()))1557 goto err;1558 b=(BOOLEAN)isSqrFree(F);1559 Off(SW_RATIONAL);1560 return b;1561 err:1562 WerrorS( feNotImplemented );1563 return 0;1564 }1565 1566 1552 poly singclap_det( const matrix m, const ring s ) 1567 1553 { -
libpolys/polys/clapsing.h
r607d84 rb1a453 60 60 # endif 61 61 62 BOOLEAN singclap_isSqrFree(poly f, const ring r);63 64 62 matrix singclap_irrCharSeries ( ideal I, const ring r); 65 63 char* singclap_neworder ( ideal I, const ring r);
Note: See TracChangeset
for help on using the changeset viewer.