Changeset f85427 in git


Ignore:
Timestamp:
Sep 24, 1997, 12:52:23 PM (26 years ago)
Author:
Jens Schmidt <schmidt@…>
Branches:
(u'spielwiese', '2fa36c576e6a4ddbb1093b43c7f8e9835e17e52a')
Children:
48c9340cb4d19ff111c8fa74e7276d0f439354b7
Parents:
ab660bee1023859df55fe928883bfbd26b8076a1
Message:
	* canonicalform.cc (deriv): speeded up

	* canonicalform.cc: doc fix


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

Legend:

Unmodified
Added
Removed
  • factory/canonicalform.cc

    rab660b rf85427  
    11/* emacs edit mode for this file is -*- C++ -*- */
    2 /* $Id: canonicalform.cc,v 1.18 1997-09-12 15:25:25 schmidt Exp $ */
     2/* $Id: canonicalform.cc,v 1.19 1997-09-24 10:52:23 schmidt Exp $ */
    33
    44#include <config.h>
     
    360360}
    361361
    362 //{{{ CanonicalForm CanonicalForm::deriv() const
     362//{{{ CanonicalForm CanonicalForm::deriv () const
    363363//{{{ docu
    364364//
     
    370370//}}}
    371371CanonicalForm
    372 CanonicalForm::deriv() const
     372CanonicalForm::deriv () const
    373373{
    374374    if ( inCoeffDomain() )
     
    385385//}}}
    386386
    387 //{{{ CanonicalForm CanonicalForm::deriv( const Variable & x ) const
     387//{{{ CanonicalForm CanonicalForm::deriv ( const Variable & x ) const
    388388//{{{ docu
    389389//
    390390// deriv() - return the formal derivation of CO with respect to x.
    391391//
    392 // Note: If x is less than the main variable of CO we have to
    393 // swap variables which may be quite expensive.  x should be a
    394 // polynomial variable.  Returns zero if f is in a coefficient
    395 // domain.
     392// x should be a polynomial variable.  Returns zero if f is in a
     393// coefficient domain.
    396394//
    397395// Timing Note (for the developer): I tried the same without
     
    402400//}}}
    403401CanonicalForm
    404 CanonicalForm::deriv( const Variable & x ) const
     402CanonicalForm::deriv ( const Variable & x ) const
    405403{
    406404    ASSERT( x.level() > 0, "cannot derive with respect to algebraic variables" );
     
    413411    else if ( x == y )
    414412        return deriv();
    415     else
    416         return swapvar( swapvar( *this, x, y ).deriv( y ), x, y );
     413    else {
     414        CanonicalForm result;
     415        CFIterator i;
     416        for ( i = *this; i.hasTerms(); i++ )
     417            result += i.coeff().deriv( x ) * power( y, i.exp() );
     418        return result;
     419    }
    417420}
    418421//}}}
     
    12961299}
    12971300
    1298 //{{{ CanonicalForm CanonicalForm::sqrt() const
     1301//{{{ CanonicalForm CanonicalForm::sqrt () const
    12991302//{{{ docu
    13001303//
     
    13081311// Computational Algebraic Number Theory', ch. 1.7.1.
    13091312//
    1310 // See also: InternalCF::sqrt(), InternalInteger::sqrt()
     1313// See also: InternalCF::sqrt(), InternalInteger::sqrt(), ::sqrt()
    13111314//
    13121315//}}}
    13131316CanonicalForm
    1314 CanonicalForm::sqrt() const
     1317CanonicalForm::sqrt () const
    13151318{
    13161319    if ( is_imm( value ) ) {
     
    13441347// base 2.  CO should be a positive integer.
    13451348//
    1346 // See also: InternalCF::ilog2(), InternalInteger::ilog2()
     1349// See also: InternalCF::ilog2(), InternalInteger::ilog2(), ::ilog2()
    13471350//
    13481351//}}}
Note: See TracChangeset for help on using the changeset viewer.