Changeset 424e5c in git


Ignore:
Timestamp:
Sep 29, 1997, 6:07:28 PM (27 years ago)
Author:
Jens Schmidt <schmidt@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
815bc0ff6567320e2b1f9f0547c94fb7f4075a94
Parents:
9fddd96f0126cdadd4279e51ed5e1800c898321a
Message:
	* cf_ops.cc (size( CF ), size( CF, Var )): new functions.
	  Declarations added.


git-svn-id: file:///usr/local/Singular/svn/trunk@761 2c84dea3-7e68-4137-9b89-c4e89433aadc
File:
1 edited

Legend:

Unmodified
Added
Removed
  • factory/cf_ops.cc

    r9fddd9 r424e5c  
    11/* emacs edit mode for this file is -*- C++ -*- */
    2 /* $Id: cf_ops.cc,v 1.7 1997-09-09 08:39:02 schmidt Exp $ */
     2/* $Id: cf_ops.cc,v 1.8 1997-09-29 16:07:28 schmidt Exp $ */
    33
    44//{{{ docu
     
    582582}
    583583//}}}
     584
     585//{{{ int size ( const CanonicalForm & f, const Variable & v )
     586//{{{ docu
     587//
     588// size() - count number of monomials of f with level higher
     589//   or equal than level of v.
     590//
     591// Returns one if f is in an base domain.
     592//
     593//}}}
     594int
     595size ( const CanonicalForm & f, const Variable & v )
     596{
     597    if ( f.inBaseDomain() )
     598        return 1;
     599
     600    int result = 0;
     601    CFIterator i;
     602    if ( f.mvar() < v )
     603        // polynomials with level < v1 are counted as coefficients
     604        return 1;
     605    else {
     606        // polynomials with level > v2 are not counted al all
     607        for ( i = f; i.hasTerms(); i++ )
     608            result += size( i.coeff(), v );
     609        return result;
     610    }
     611}
     612//}}}
     613
     614//{{{ int size ( const CanonicalForm & f )
     615//{{{ docu
     616//
     617// size() - return number of monomials in f which are in an
     618//   coefficient domain.
     619//
     620// Returns one if f is in an coefficient domain.
     621//
     622//}}}
     623int
     624size ( const CanonicalForm & f )
     625{
     626    if ( f.inCoeffDomain() )
     627        return 1;
     628    else {
     629        int result = 0;
     630        CFIterator i;
     631        for ( i = f; i.hasTerms(); i++ )
     632            result += size( i.coeff() );
     633        return result;
     634    }
     635}
     636//}}}
Note: See TracChangeset for help on using the changeset viewer.