Changeset 8e176b in git


Ignore:
Timestamp:
Apr 24, 2014, 10:48:27 AM (10 years ago)
Author:
Hans Schoenemann <hannes@…>
Branches:
(u'spielwiese', '17f1d200f27c5bd38f5dfc6e8a0879242279d1d8')
Children:
423ed4132d991ece24b8528843d5c19c0ef08e3d493e3de68a992f8a472eb2c2c57ca110ca7ef492
Parents:
5b267b814940e31df029cf3b609a965ad80cebfc
Message:
chg: hasIntegerCoefficientRing ->hasRingCoefficientRing

hasIntegerCoefficientRing handled only some special cases
and in an error prone way (relying in string representations).
hasRingCoefficientRing tests for the case where the coeffcients are not a
field which requires special care/different alg. in many cases
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • Singular/LIB/ring.lib

    r5b267b8 r8e176b  
    2323             (parameters in square brackets [] are optional)
    2424 optionIsSet(opt)         check if as a string given option is set or not.
     25 hasRingCoefficientRing   check if the coefficient ring is not a field
     26 hasNumericCoeffs(rng)    check for use of floating point numbers
     27 hasCommutativeVars(rng)  non-commutive or commnuative polynomial ring
     28 hasGlobalOrdering(rng)   global versus mixed/local monomial ordering
     29 isSubModule(I,J)         check if I is in J as submodule
    2530";
    2631
     
    4752}
    4853example
    49 { 
     54{
    5055    // check if the option "warn" is set.
    5156    optionIsSet("warn");
     
    908913  ring rng = 0,x,dp;
    909914  isQuotientRing(rng); //no
    910   // if a certain method does not support quotient rings, 
     915  // if a certain method does not support quotient rings,
    911916  // then a parameter test could be performed:
    912917   ASSUME( 0, 0==isQuotientRing(basering));
    913918
    914   qring q= ideal(x);  // constructs rng/ideal(x) 
     919  qring q= ideal(x);  // constructs rng/ideal(x)
    915920  isQuotientRing(q);  // yes
    916921}
     
    937942}
    938943
    939 
    940 
    941 
    942 
    943 proc hasIntegerCoefficientRing( rng )
    944 "USAGE: hasIntegerCoefficientRing ( rng );
    945 RETURN:  1 if rng is has integer ring coefficients, 0 otherwise.
    946 KEYWORDS: integer ring coefficients
    947 EXAMPLE: example hasIntegerCoefficientRing ; shows an example
    948 "
    949 proc hasIntegerCoefficientRing(rng)
    950 {
    951   def rl = ringlist(rng);
    952   if ( not (typeof(rl[1][1])=="string")    ) { return (0); }
    953   return ( rl[1][1]=="integer" );
     944proc hasRingCoefficientRing( rng )
     945"USAGE: hasRingCoefficientRing ( rng );
     946RETURN:  1 if rng is has ring coefficients, 0 otherwise.
     947KEYWORDS: ring coefficients
     948EXAMPLE: example hasRingCoefficientRing; shows an example
     949"
     950{
     951  return (attrib(rng,"ring_cf")==1);
    954952}
    955953example
    956954{
    957955  ring rng = integer,x,dp;
    958   hasIntegerCoefficientRing(rng); //yes
    959   // if a certain method supports only rings with integer coefficients, 
     956  hasRingCoefficientRing(rng); //yes
     957  // if a certain method supports only rings with integer coefficients,
    960958  // then a parameter test could be performed:
    961    ASSUME( 0, hasIntegerCoefficientRing(basering)); //ok
    962 
    963   ring rng2 = 0, x, dp;
    964   hasIntegerCoefficientRing(rng2);  // no
    965 }
    966 
    967 
    968 static proc testHasIntegerCoefficientRing()
    969 {
    970    ring rng = integer,x,dp;
    971    ASSUME(0, hasIntegerCoefficientRing( rng ) );
    972 
    973    qring q = ideal(x);
    974    ASSUME(0, hasIntegerCoefficientRing( q ) );
    975 
    976    ring rng2 = 0,x,dp;
    977    ASSUME(0, 0==hasIntegerCoefficientRing( rng2 ) );
    978 
    979    ring rng3 = (0,a),x,dp;
    980    ASSUME(0, 0==hasIntegerCoefficientRing( rng3 ) );
    981 
    982    ring rng4 = (real,a),x,dp;
    983    ASSUME(0, 0==hasIntegerCoefficientRing( rng4 ) );
    984 
    985    ring rng5 = (real),x,dp;
    986    ASSUME(0, 0==hasIntegerCoefficientRing( rng5 ) );
    987 }
    988 
    989 
    990 
    991 
     959  ring rng2 = 0, x, dp;
     960  hasRingCoefficientRing(rng2);  // no
     961}
     962
     963proc hasGlobalOrdering (rng)
     964"USAGE: hasGlobalOrdering ( rng );
     965RETURN:  1 if rng has a global monomial ordering, 0 otherwise.
     966KEYWORDS: monomial ordering
     967EXAMPLE: example hasGlobalOrdering; shows an example
     968"
     969{
     970  return (attrib(rng,"global")==1);
     971}
     972example
     973{
     974  ring rng = integer,x,dp;
     975  hasGlobalOrdering(rng); //yes
     976  ring rng2 = 0, x, ds;
     977  hasGlobalOrdering(rng2);  // no
     978}
     979
     980proc hasCommutativeVars (rng)
     981"USAGE: hasCommutativeVars ( rng );
     982RETURN:  1 if rng is a commutative polynomial ring, 0 otherwise.
     983KEYWORDS: plural
     984EXAMPLE: example hasCommutativeVars; shows an example
     985"
     986{
     987  list rl=ringlist(rng);
     988  return (size(rl)==4);
     989}
     990
     991proc hasNumericCoeffs(rng)
     992"USAGE: hasNumericCoeffs ( rng );
     993RETURN:  1 if rng has inexact coeffcients, 0 otherwise.
     994KEYWORDS: floating point
     995EXAMPLE: example hasNumericCoeffs; shows an example
     996"
     997{
     998  ERROR("not yet implemented");
     999}
     1000
     1001proc isSubModule(I,J)
     1002"USAGE: isSubModule(I,J): I, J: ideal or module
     1003RETURN: 1 if module(I) is in module(J), 0 otherwise
     1004EXAMPLE: isSubModule; shows an example
     1005{
     1006  if (attrib(J,"isSB")==1)
     1007  { return(size(reduce(I,J,1)==0)); }
     1008  else
     1009  { return(size(reduce(I,groebner(J),1)==0)); }
     1010}
     1011
     1012
  • Singular/LIB/sing.lib

    r5b267b8 r8e176b  
    371371  ASSUME( 0, 0==isQuotientRing(basering) );
    372372  // integer coefficient rings currently not supported
    373   ASSUME( 0, 0==hasIntegerCoefficientRing(basering) );
     373  ASSUME( 0, 0==hasRingCoefficientRing(basering) );
    374374
    375375
  • Tst/Short/ringutils_s.res.gz.uu

    r5b267b8 r8e176b  
    1 begin 664 ringutils_s.res.gz
    2 M'XL("/["YU(``W)I;F=U=&EL<U]S+G)E<P!MD#T+PC`0AO?^BJ,XI,M!U-:/
    3 M0@9UL"""5N>B$DN@I-)<<1#_NTV11,4EN8_WY;F[_+#*M@#`!6RR!81D""MU
    4 M#M,@?W>&`KIBH;0B%J6!_4$(:)0N6U*5*0QJ>4=#)W*>D0`7C]'',5H*"ZVY
    5 MQT2>DWQX)@BWIKX`24/[3GNT(!:Y_A3AX9(9=H]5S>=6GYE=6Y.2NG<R3^#\
    6 M6[@^F4R3+&6SK.7UJB[_/".$ITO&XG<B+XS]^#SQ*_-N%7L^>Y[6,!ZE,$B#
    7 )%TG,>MEV`0``
     1begin 640 ringutils_s.res.gz
     2M'XL(",D5'U,``W)I;F=U=&EL<U]S+G)E<P"-E5]OVC`4Q=_Y%%?1'@*B(;$=
     3M"$*)M'\/2&NE+MMSR8KI+"&GQ&;MQY]#B7T=MA2DB"B<>W['EQN[_/%E?0<`
     4M20'?UI\@T$I'>_$K6(W*\R^D`//P04BAP_%JU'Y#44`CY--1B[UZ4)'D+Y'2
     5ME;8UM`![SR)WGT8M)6AK>Y0YJEA$4#]K4<LP>*D:&8R=+"O@8UG^O/T:QM.S
     6M:*U*KCLE&.UL!I,)'!6'C9#Z#W_<@)!*\VH+]0XV6[[;6+]E85&R[L&2&,-B
     7MR//_$;L"T\39[&;@8Y4D.C40&G/ET/!J/WV=;I^=%?78!BW4_;'6@DO]W12&
     8MIM"@P14PU\#$M/EPLC^\^2=.-L>^/<_#A>D"F68N,C&>IK7\B3>]V,N+EEWF
     9M)AZ#Q(Y!$AR<Y+%3$6PL:_VO[#UC-(2$N?#4A(_]V"2](C;UW='`D@6.37/7
     10M;I*]T^Z>Z7)X@#H=C;WQ\?^*M_%ON)ES\ZZ>19.)K4UPI-^5:K-\KOEN)QYM
     11MM%,-'FU*W'(IM<MMX5LSO.$KDK)K``??/D7V<W_0XH%U$;RP1>^5&5@;\>D9
     12MHB_]23%>U7@@`44)6'Q]`NHE8(E+P-#>P-H$I]W!ANA4_0UB@,5\%MHI6.I8
     13I:<?JD^;7DU*?A+8/EKEC@)D>MT=*>V0<59B,5_!A-?H+JYB*6XH&````
    814`
    915end
  • Tst/Short/ringutils_s.tst

    r5b267b8 r8e176b  
    33
    44
    5 LIB("ring.lib");
     5LIB"ring.lib";
    66
    7 proc testRingUtils()
    8 {
    9   Ring::testIsQuotientRing();
    10   Ring::testHasIntegerCoefficientRing();
    11 }
    12 testRingUtils();
     7option("warn");
     8ASSUME(0, optionIsSet("warn") );
     9option("nowarn");
     10ASSUME(0, 0 == optionIsSet("warn") );
     11//----------------------------
     12ring rng = real,x,dp;
     13ASSUME(0, 0== isQuotientRing(rng) ) ;
     14
     15qring qrng = 1;
     16ASSUME(0, isQuotientRing(qrng) ) ;
     17
     18ring rng2 = integer,x,dp;
     19ASSUME(0, 0 == isQuotientRing(rng2) ) ;
     20
     21qring qrng2=0;
     22ASSUME(0, not isQuotientRing(qrng2) ) ;
     23
     24ring rng3 = 0,x,dp;
     25ASSUME(0, 0 == isQuotientRing(rng3) ) ;
     26
     27qring qrng3=1;
     28ASSUME(0, isQuotientRing(qrng3) ) ;
     29//--------------------------
     30ring rng = integer,x,dp;
     31ASSUME(0, hasRingCoefficientRing( rng ) );
     32
     33qring q = ideal(x);
     34ASSUME(0, hasRingCoefficientRing( q ) );
     35
     36ring rng2 = 0,x,dp;
     37ASSUME(0, 0==hasRingCoefficientRing( rng2 ) );
     38
     39ring rng3 = (0,a),x,dp;
     40ASSUME(0, 0==hasRingCoefficientRing( rng3 ) );
     41
     42ring rng4 = (real,a),x,dp;
     43ASSUME(0, 0==hasRingCoefficientRing( rng4 ) );
     44
     45ring rng5 = (real),x,dp;
     46ASSUME(0, 0==hasRingCoefficientRing( rng5 ) );
    1347
    1448
Note: See TracChangeset for help on using the changeset viewer.