Changeset 3ace5b6 in git


Ignore:
Timestamp:
Jul 24, 2012, 1:48:24 PM (12 years ago)
Author:
Martin Lee <martinlee84@…>
Branches:
(u'spielwiese', '17f1d200f27c5bd38f5dfc6e8a0879242279d1d8')
Children:
f55f3941f7a85ba15e8bc819fdb09964b90ea669
Parents:
8681bf84c636b8f6dc4a144d33450d09a28c5154
git-author:
Martin Lee <martinlee84@web.de>2012-07-24 13:48:24+02:00
git-committer:
Martin Lee <martinlee84@web.de>2012-09-04 17:25:37+02:00
Message:
chg: new command to get tail coeff wrt. given variable
Location:
factory
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • factory/canonicalform.cc

    r8681bf r3ace5b6  
    478478// have a taildegree larger than zero.
    479479//
     480// tailcoeff( v ) returns the tail coefficient of CO where CO is
     481// considered an univariate polynomial in the polynomial variable
     482// v.
     483// Note: If v is less than the main variable of CO we have to
     484// swap variables which may be quite expensive.
     485//
    480486// See also: InternalCF::tailcoeff(), InternalCF::tailcoeff(),
    481487// InternalPoly::tailcoeff(), InternalPoly::taildegree,
     
    490496    else
    491497        return value->tailcoeff();
     498}
     499
     500CanonicalForm
     501CanonicalForm::tailcoeff (const Variable& v) const
     502{
     503    if ( is_imm( value ) || value->inCoeffDomain() )
     504        return *this;
     505
     506    Variable x = value->variable();
     507    if ( v > x )
     508        return *this;
     509    else if ( v == x )
     510        return value->tailcoeff();
     511    else {
     512        CanonicalForm f = swapvar( *this, v, x );
     513         if ( f.mvar() == x )
     514             return swapvar( f.value->tailcoeff(), v, x );
     515         else
     516            // v did not occur in f
     517            return *this;
     518    }
    492519}
    493520
  • factory/canonicalform.h

    r8681bf r3ace5b6  
    112112
    113113    CanonicalForm tailcoeff () const;
     114    CanonicalForm tailcoeff ( const Variable & v ) const;
    114115    int taildegree () const;
    115116
     
    295296tailcoeff ( const CanonicalForm & f ) { return f.tailcoeff(); }
    296297
     298inline CanonicalForm
     299tailcoeff (const CanonicalForm& f, const Variable& v) { return f.tailcoeff(v); }
     300
    297301inline int
    298302level ( const CanonicalForm & f ) { return f.level(); }
Note: See TracChangeset for help on using the changeset viewer.