Changeset 98474f in git for libpolys/coeffs/coeffs.h


Ignore:
Timestamp:
Jul 17, 2012, 9:09:26 PM (12 years ago)
Author:
Oleksandr Motsak <motsak@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
975db1808b2b0917d858a9096710abc55c256aec
Parents:
805d0b10ffd62e7ff079f116851129cc4ae8f89d
git-author:
Oleksandr Motsak <motsak@mathematik.uni-kl.de>2012-07-17 21:09:26+02:00
git-committer:
Oleksandr Motsak <motsak@mathematik.uni-kl.de>2012-07-17 21:33:55+02:00
Message:
Abstract iterator/enumerator interfaces + dummies for ClearContent and ClearDenominators
File:
1 edited

Legend:

Unmodified
Added
Removed
  • libpolys/coeffs/coeffs.h

    r805d0b1 r98474f  
    1313
    1414#include <coeffs/si_gmp.h>
     15
     16#include <coeffs/Enumerator.h>
    1517
    1618#ifdef HAVE_FACTORY
     
    6466typedef number (*nMapFunc)(number a, const coeffs src, const coeffs dst);
    6567
     68
     69/// Abstract interface for an enumerator of number coefficients for an
     70/// object, e.g. a polynomial
     71typedef IEnumerator<number> ICoeffsEnumerator;
     72
     73/// goes over coeffs given by the ICoeffsEnumerator and changes them.
     74/// Additionally returns a number;
     75typedef void (*nCoeffsEnumeratorFunc)(ICoeffsEnumerator& numberCollectionEnumerator, number& output, const coeffs r);
     76
     77
    6678/// Creation data needed for finite fields
    6779typedef struct
     
    196208   /// create i^th parameter or NULL if not possible
    197209   number  (*cfParameter)(const int i, const coeffs r);
     210       
     211   /// function pointer behind n_ClearContent
     212   nCoeffsEnumeratorFunc cfClearContent;
     213
     214   /// function pointer behind n_ClearDenominators
     215   nCoeffsEnumeratorFunc cfClearDenominators;
    198216
    199217#ifdef HAVE_FACTORY
     
    793811
    794812
    795 #endif
    796 
     813/// Computes the content and (inplace) divides it out on a collection
     814/// of numbers
     815/// NOTE/TODO: see the description by Hans
     816/// TODO: what exactly is c?
     817static inline void n_ClearContent(ICoeffsEnumerator& numberCollectionEnumerator, number& c, const coeffs r)
     818{
     819  assume(r != NULL);
     820  r->cfClearContent(numberCollectionEnumerator, c, r);
     821}
     822
     823/// (inplace) Clears denominators on a collection of numbers
     824/// NOTE/TODO: see the description by Hans
     825/// TODO: what exactly is d?
     826static inline void n_ClearDenominators(ICoeffsEnumerator& numberCollectionEnumerator, number& d, const coeffs r)
     827{
     828  assume(r != NULL);
     829  r->cfClearDenominators(numberCollectionEnumerator, d, r);
     830}
     831
     832// convenience helpers (no number returned - but the input enumeration
     833// is to be changed
     834// TODO: do we need separate hooks for these as our existing code does
     835// *different things* there: compare p_Cleardenom (which calls
     836// *p_Content) and p_Cleardenom_n (which doesn't)!!!
     837
     838static inline void n_ClearContent(ICoeffsEnumerator& numberCollectionEnumerator, const coeffs r)
     839{
     840  number c;
     841  n_ClearContent(numberCollectionEnumerator, c, r);
     842  n_Delete(&c, r);
     843}
     844
     845static inline void n_ClearDenominators(ICoeffsEnumerator& numberCollectionEnumerator, const coeffs r)
     846{
     847  assume(r != NULL);
     848  number d;
     849  n_ClearDenominators(numberCollectionEnumerator, d, r);
     850  n_Delete(&d, r);
     851}
     852
     853
     854#endif
     855
Note: See TracChangeset for help on using the changeset viewer.