Changeset ff12c6 in git


Ignore:
Timestamp:
Oct 8, 2012, 6:44:02 PM (10 years ago)
Author:
Oleksandr Motsak <motsak@…>
Branches:
(u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'a800fe4b3e9d37a38c5a10cc0ae9dfa0c15a4ee6')
Children:
7ec05993a90b8b8d6cd1f03ce111460365a98194
Parents:
e9927ff3cc13ebaddd8a4a7419c26390ff895c18
git-author:
Oleksandr Motsak <motsak@mathematik.uni-kl.de>2012-10-08 18:44:02+02:00
git-committer:
Oleksandr Motsak <motsak@mathematik.uni-kl.de>2012-10-08 20:37:21+02:00
Message:
Testing of ClearContent&ClearDenominators

add: testing the use of CPolyCoeffsEnumerator by n_ClearDenominators and n_ClearContent
add/chg: better generic testing of Clear* functions
add: more testing of Clear* functions: cleardenom + ERROR() + exit on wrong test result
add: testing of "-leadcoeff" normalization (for TestClearContent) but not for TestClearDenominators...
NOTE: ClearContent should make leading coeff. positive!
NOTE: testing alg. and trans. extensions of Q aswell as Q itself

add: Added testing of Clear* to 'make check'
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • Singular/LIB/schreyer.lib

    re9927f rff12c6  
    14041404        listvar(Syzextra);
    14051405      }
     1406
     1407      exportto(Top, Syzextra::ClearContent);
     1408      exportto(Top, Syzextra::ClearDenominators);
    14061409     
    14071410//      export Syzextra;
     
    14391442      }
    14401443     
     1444      exportto(Top, Syzextra_g::ClearContent);
     1445      exportto(Top, Syzextra_g::ClearDenominators);
     1446
    14411447//      export Syzextra_g;
    14421448//      exportto(Schreyer, Syzextra_g::noop);
  • dyn_modules/syzextra/mod_main.cc

    re9927f rff12c6  
    66
    77#include <coeffs/coeffs.h>
     8
     9#include <polys/PolyEnumerator.h>
    810
    911#include <polys/monomials/p_polys.h>
     
    4547  res->data = NULL;
    4648}
     49
     50/// wrapper around n_ClearContent
     51static BOOLEAN _ClearContent(leftv res, leftv h)
     52{
     53  NoReturn(res);
     54
     55  const char *usage = "'ClearContent' needs a (non-zero!) poly or vector argument...";
     56 
     57  if( h == NULL )
     58  {
     59    WarnS(usage);
     60    return TRUE;
     61  }
     62
     63  assume( h != NULL );
     64
     65  if( !( h->Typ() == POLY_CMD || h->Typ() == VECTOR_CMD) )
     66  {
     67    WarnS(usage);
     68    return TRUE;
     69  }
     70
     71  assume (h->Next() == NULL);
     72 
     73  poly ph = reinterpret_cast<poly>(h->Data());
     74 
     75  if( ph == NULL )
     76  {
     77    WarnS(usage);
     78    return TRUE;
     79  }
     80 
     81  const ring r =  currRing;
     82  assume( r != NULL ); assume( r->cf != NULL ); const coeffs C = r->cf;
     83
     84  number n;
     85
     86  // experimentall (recursive enumerator treatment) of alg. ext
     87  CPolyCoeffsEnumerator itr(ph);
     88  n_ClearContent(itr, n, C);
     89
     90  res->data = n;
     91  res->rtyp = NUMBER_CMD;
     92
     93  return FALSE;
     94}
     95
     96/// wrapper around n_ClearDenominators
     97static BOOLEAN _ClearDenominators(leftv res, leftv h)
     98{
     99  NoReturn(res);
     100
     101  const char *usage = "'ClearDenominators' needs a (non-zero!) poly or vector argument...";
     102
     103  if( h == NULL )
     104  {
     105    WarnS(usage);
     106    return TRUE;
     107  }
     108
     109  assume( h != NULL );
     110
     111  if( !( h->Typ() == POLY_CMD || h->Typ() == VECTOR_CMD) )
     112  {
     113    WarnS(usage);
     114    return TRUE;
     115  }
     116
     117  assume (h->Next() == NULL);
     118
     119  poly ph = reinterpret_cast<poly>(h->Data());
     120
     121  if( ph == NULL )
     122  {
     123    WarnS(usage);
     124    return TRUE;
     125  }
     126
     127  const ring r =  currRing;
     128  assume( r != NULL ); assume( r->cf != NULL ); const coeffs C = r->cf;
     129
     130  number n;
     131
     132  // experimentall (recursive enumerator treatment) of alg. ext.
     133  CPolyCoeffsEnumerator itr(ph);
     134  n_ClearDenominators(itr, n, C);
     135
     136  res->data = n;
     137  res->rtyp = NUMBER_CMD;
     138
     139  return FALSE;
     140}
     141
    47142
    48143/// try to get an optional (simple) integer argument out of h
     
    851946// #define ADD(A,B,C,D,E) ADD0(iiAddCproc, "", C, D, E)
    852947  #define ADD(A,B,C,D,E) ADD0(A->iiAddCproc, B, C, D, E)
     948  ADD(psModulFunctions, currPack->libname, "ClearContent", FALSE, _ClearContent);
     949  ADD(psModulFunctions, currPack->libname, "ClearDenominators", FALSE, _ClearDenominators);
     950
    853951  ADD(psModulFunctions, currPack->libname, "DetailedPrint", FALSE, DetailedPrint);
    854952  ADD(psModulFunctions, currPack->libname, "leadmonomial", FALSE, leadmonom);
  • dyn_modules/syzextra/test.sh

    re9927f rff12c6  
    22
    33# env
     4"$SINGULAR_EXECUTABLE" -teq "$srcdir/test_clear_enum.tst"
    45
    56"$SINGULAR_EXECUTABLE" -teq "$srcdir/syzextra.tst" && "$SINGULAR_EXECUTABLE" -teq "$srcdir/ederc.tst"
Note: See TracChangeset for help on using the changeset viewer.