Changeset 12223d in git for factory/canonicalform.cc


Ignore:
Timestamp:
Jun 29, 1998, 4:37:16 PM (26 years ago)
Author:
Jens Schmidt <schmidt@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
f80ca1285366900f540a03b74bc9491c0cf6cc4d
Parents:
518a1f5f4950c70d6cf676a70549e89edd38c2ef
Message:
	* canonicalform.cc, canonicalform.h (CanonicalForm,
	  ~CanonicalForm, isOne, isZero, operator =): definitions of
 	  methods moved to `cf_inline.cc'.  Declarations marked as
 	  `CF_INLINE' or `CF_NO_INLINE', resp.
	  (operator -, operator +, operator *, operator /, operator %,
	  div, mod): definitions of operators moved to `cf_inline.cc'.
  	  Declarations marked as `CF_INLINE' or `CF_NO_INLINE', resp.


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

Legend:

Unmodified
Added
Removed
  • factory/canonicalform.cc

    r518a1f r12223d  
    11/* emacs edit mode for this file is -*- C++ -*- */
    2 /* $Id: canonicalform.cc,v 1.26 1998-03-12 10:28:56 schmidt Exp $ */
     2/* $Id: canonicalform.cc,v 1.27 1998-06-29 14:37:16 schmidt Exp $ */
    33
    44#include <config.h>
     
    4949
    5050//{{{ constructors, destructors, selectors
    51 CanonicalForm::CanonicalForm() : value( CFFactory::basic( (int)0 ) )
    52 {
    53 }
    54 
    55 CanonicalForm::CanonicalForm( const int i ) : value( CFFactory::basic( i ) )
    56 {
    57 }
    58 
    59 CanonicalForm::CanonicalForm( const CanonicalForm & cf ) : value( is_imm( cf.value ) ? cf.value : cf.value->copyObject() )
    60 {
    61 }
    62 
    63 CanonicalForm::CanonicalForm( InternalCF * cf ) : value( cf )
    64 {
    65 }
    66 
    67 CanonicalForm::CanonicalForm( const Variable & v ) : value( CFFactory::poly( v ) )
    68 {
    69 }
    70 
    71 CanonicalForm::CanonicalForm( const Variable & v, int e ) : value( CFFactory::poly( v, e ) )
    72 {
    73 }
    74 
    7551CanonicalForm::CanonicalForm( const char * str ) : value( CFFactory::basic( str ) )
    7652{
    77 }
    78 
    79 CanonicalForm::~CanonicalForm()
    80 {
    81     if ( (! is_imm( value )) && value->deleteObject() )
    82         delete value;
    8353}
    8454
     
    10373
    10474//{{{ predicates
    105 bool
    106 CanonicalForm::isOne() const
    107 {
    108     if ( is_imm( value ) == FFMARK )
    109         return imm_isone_p( value );
    110     else  if ( is_imm( value ) == GFMARK )
    111         return imm_isone_gf( value );
    112     else  if ( is_imm( value ) )
    113         return imm_isone( value );
    114     else
    115         return value->isOne();
    116 }
    117 
    118 bool
    119 CanonicalForm::isZero() const
    120 {
    121     if ( is_imm( value ) == FFMARK )
    122         return imm_iszero_p( value );
    123     else  if ( is_imm( value ) == GFMARK )
    124         return imm_iszero_gf( value );
    125     else  if ( is_imm( value ) )
    126         return imm_iszero( value );
    127     else
    128         return value->isZero();
    129 }
    130 
    13175bool
    13276CanonicalForm::isImm() const
     
    586530//{{{ assignment operators
    587531CanonicalForm &
    588 CanonicalForm::operator = ( const CanonicalForm & cf )
    589 {
    590     if ( this != &cf ) {
    591         if ( (! is_imm( value )) && value->deleteObject() )
    592             delete value;
    593         value = (is_imm( cf.value )) ? cf.value : cf.value->copyObject();
    594     }
    595     return *this;
    596 }
    597 
    598 CanonicalForm &
    599 CanonicalForm::operator = ( const int cf )
    600 {
    601     if ( (! is_imm( value )) && value->deleteObject() )
    602         delete value;
    603     value = CFFactory::basic( cf );
    604     return *this;
    605 }
    606 
    607 CanonicalForm &
    608532CanonicalForm::operator += ( const CanonicalForm & cf )
    609533{
     
    14131337    else
    14141338        return lhs.value->level() < rhs.value->level();
    1415 }
    1416 //}}}
    1417 
    1418 //{{{ arithmetic operators
    1419 CanonicalForm
    1420 operator - ( const CanonicalForm & cf )
    1421 {
    1422     CanonicalForm result( cf );
    1423     int what = is_imm( result.value );
    1424     if ( what == FFMARK )
    1425         result.value = imm_neg_p( result.value );
    1426     else  if ( what == GFMARK )
    1427         result.value = imm_neg_gf( result.value );
    1428     else  if ( what )
    1429         result.value = imm_neg( result.value );
    1430     else
    1431         result.value = result.value->neg();
    1432     return result;
    1433 }
    1434 
    1435 CanonicalForm
    1436 operator + ( const CanonicalForm &c1, const CanonicalForm &c2 )
    1437 {
    1438     CanonicalForm result( c1 );
    1439     result += c2;
    1440     return result;
    1441 }
    1442 
    1443 CanonicalForm
    1444 operator - ( const CanonicalForm &c1, const CanonicalForm &c2 )
    1445 {
    1446     CanonicalForm result( c1 );
    1447     result -= c2;
    1448     return result;
    1449 }
    1450 
    1451 CanonicalForm
    1452 operator * ( const CanonicalForm &c1, const CanonicalForm &c2 )
    1453 {
    1454     CanonicalForm result( c1 );
    1455     result *= c2;
    1456     return result;
    1457 }
    1458 
    1459 CanonicalForm
    1460 operator / ( const CanonicalForm &c1, const CanonicalForm &c2 )
    1461 {
    1462     CanonicalForm result( c1 );
    1463     result /= c2;
    1464     return result;
    1465 }
    1466 
    1467 CanonicalForm
    1468 div ( const CanonicalForm &c1, const CanonicalForm &c2 )
    1469 {
    1470     CanonicalForm result( c1 );
    1471     result.div( c2 );
    1472     return result;
    1473 }
    1474 
    1475 CanonicalForm
    1476 mod ( const CanonicalForm &c1, const CanonicalForm &c2 )
    1477 {
    1478     CanonicalForm result( c1 );
    1479     result.mod( c2 );
    1480     return result;
    1481 }
    1482 
    1483 CanonicalForm
    1484 operator % ( const CanonicalForm &c1, const CanonicalForm &c2 )
    1485 {
    1486     CanonicalForm result( c1 );
    1487     result %= c2;
    1488     return result;
    14891339}
    14901340//}}}
Note: See TracChangeset for help on using the changeset viewer.