My Project
Loading...
Searching...
No Matches
ftmpl_factor.h
Go to the documentation of this file.
1/* emacs edit mode for this file is -*- C++ -*- */
2
3#ifndef INCL_FACTOR_H
4#define INCL_FACTOR_H
5
6#ifndef NOSTREAMIO
7#ifdef HAVE_IOSTREAM
8#include <iostream>
9#define OSTREAM std::ostream
10#elif defined(HAVE_IOSTREAM_H)
11#include <iostream.h>
12#define OSTREAM ostream
13#endif
14#endif /* NOSTREAMIO */
15
16
17template <class T>
18class Factor {
19private:
21 int _exp;
22public:
23 Factor() : _factor(1), _exp(0) {}
25 Factor( const T & f, int e ) : _factor(f), _exp(e) {}
26 Factor( const T & f ) : _factor(f), _exp(1) {}
29 Factor<T>& operator= ( const T& );
30 T factor() const { return _factor; }
31 int exp() const { return _exp; }
32 T value() const { return power( _factor, _exp ); }
33 Factor<T>& operator+= ( int i ) { _exp += i; return *this; }
34 Factor<T>& operator*= ( int i ) { _exp *= i; return *this; }
35 Factor<T>& operator*= ( const T & f ) { _factor *= f; return *this; }
36#ifndef NOSTREAMIO
37 void print ( OSTREAM& ) const;
38#endif /* NOSTREAMIO */
39};
40
41template <class T> int
42operator== ( const Factor<T>&, const Factor<T>& );
43
44#ifndef NOSTREAMIO
45template <class T>
46OSTREAM& operator<< ( OSTREAM & os, const Factor<T> & f );
47#endif /* NOSTREAMIO */
48
49#endif /* ! INCL_FACTOR_H */
CanonicalForm power(const CanonicalForm &f, int n)
exponentiation
int i
Definition: cfEzgcd.cc:132
FILE * f
Definition: checklibs.c:9
Factor< T > & operator=(const Factor< T > &)
Definition: ftmpl_factor.cc:6
void print(OSTREAM &) const
Definition: ftmpl_factor.cc:31
Factor(const Factor< T > &f)
Definition: ftmpl_factor.h:24
Factor< T > & operator+=(int i)
Definition: ftmpl_factor.h:33
Factor< T > & operator*=(int i)
Definition: ftmpl_factor.h:34
int exp() const
Definition: ftmpl_factor.h:31
T value() const
Definition: ftmpl_factor.h:32
T factor() const
Definition: ftmpl_factor.h:30
Factor(const T &f)
Definition: ftmpl_factor.h:26
Factor(const T &f, int e)
Definition: ftmpl_factor.h:25
int _exp
Definition: ftmpl_factor.h:21
OSTREAM & operator<<(OSTREAM &os, const Factor< T > &f)
Definition: ftmpl_factor.cc:40
int operator==(const Factor< T > &, const Factor< T > &)
Definition: ftmpl_factor.cc:24
#define OSTREAM
Definition: ftmpl_factor.h:9
STATIC_VAR jList * T
Definition: janet.cc:30