Loading...
Searching...
No Matches
ftmpl_factor.h
Go to the documentation of this file.
/* emacs edit mode for this file is -*- C++ -*- */
#ifndef INCL_FACTOR_H
#define INCL_FACTOR_H
#ifndef NOSTREAMIO
#ifdef HAVE_IOSTREAM
#include <iostream>
#define OSTREAM std::ostream
#elif defined(HAVE_IOSTREAM_H)
#include <iostream.h>
#define OSTREAM ostream
#endif
#endif /* NOSTREAMIO */
template <class T>
class Factor {
private:
T _factor;
int _exp;
public:
Factor() : _factor(1), _exp(0) {}
Factor( const Factor<T> & f ) : _factor(f._factor), _exp(f._exp) {}
Factor( const T & f, int e ) : _factor(f), _exp(e) {}
Factor( const T & f ) : _factor(f), _exp(1) {}
~Factor() {}
Factor<T>& operator= ( const Factor<T>& );
Factor<T>& operator= ( const T& );
T factor() const { return _factor; }
int exp() const { return _exp; }
T value() const { return power( _factor, _exp ); }
Factor<T>& operator+= ( int i ) { _exp += i; return *this; }
Factor<T>& operator*= ( int i ) { _exp *= i; return *this; }
Factor<T>& operator*= ( const T & f ) { _factor *= f; return *this; }
#ifndef NOSTREAMIO
void print ( OSTREAM& ) const;
#endif /* NOSTREAMIO */
};
template <class T> int
operator== ( const Factor<T>&, const Factor<T>& );
#ifndef NOSTREAMIO
template <class T>
OSTREAM& operator<< ( OSTREAM & os, const Factor<T> & f );
#endif /* NOSTREAMIO */
#endif /* ! INCL_FACTOR_H */
power
CanonicalForm power(const CanonicalForm &f, int n)
exponentiation
Definition canonicalform.cc:1896
OSTREAM
#define OSTREAM
Definition canonicalform.h:16
i
int i
Definition cfEzgcd.cc:132
f
FILE * f
Definition checklibs.c:9
Factor
Definition ftmpl_factor.h:18
Factor::operator=
Factor< T > & operator=(const Factor< T > &)
Definition ftmpl_factor.cc:6
Factor::~Factor
~Factor()
Definition ftmpl_factor.h:27
Factor::print
void print(OSTREAM &) const
Definition ftmpl_factor.cc:31
Factor::Factor
Factor(const Factor< T > &f)
Definition ftmpl_factor.h:24
Factor::operator+=
Factor< T > & operator+=(int i)
Definition ftmpl_factor.h:33
Factor::operator*=
Factor< T > & operator*=(int i)
Definition ftmpl_factor.h:34
Factor::exp
int exp() const
Definition ftmpl_factor.h:31
Factor::value
T value() const
Definition ftmpl_factor.h:32
Factor::factor
T factor() const
Definition ftmpl_factor.h:30
Factor< CanonicalForm >::_factor
CanonicalForm _factor
Definition ftmpl_factor.h:20
Factor::Factor
Factor(const T &f)
Definition ftmpl_factor.h:26
Factor::Factor
Factor(const T &f, int e)
Definition ftmpl_factor.h:25
Factor< CanonicalForm >::_exp
int _exp
Definition ftmpl_factor.h:21
Factor::Factor
Factor()
Definition ftmpl_factor.h:23
operator<<
OSTREAM & operator<<(OSTREAM &os, const Factor< T > &f)
Definition ftmpl_factor.cc:40
operator==
int operator==(const Factor< T > &, const Factor< T > &)
Definition ftmpl_factor.cc:24
T
STATIC_VAR jList * T
Definition janet.cc:30