GiNaCRA
0.6.4
|
00001 /* 00002 * GiNaCRA - GiNaC Real Algebra package 00003 * Copyright (C) 2010-2012 Ulrich Loup, Joachim Redies, Sebastian Junges 00004 * 00005 * This file is part of GiNaCRA. 00006 * 00007 * GiNaCRA is free software: you can redistribute it and/or modify 00008 * it under the terms of the GNU General Public License as published by 00009 * the Free Software Foundation, either version 3 of the License, or 00010 * (at your option) any later version. 00011 * 00012 * GiNaCRA is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 * GNU General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU General Public License 00018 * along with GiNaCRA. If not, see <http://www.gnu.org/licenses/>. 00019 * 00020 */ 00021 00022 00023 #ifndef GINACRA_MULTIVARIATEMONOMIALMR_H 00024 #define GINACRA_MULTIVARIATEMONOMIALMR_H 00025 00026 // #define GINACRA_MULTIVARIATEPOLYNOMIAL_DEBUG 00027 00028 #include <ginac/ginac.h> 00029 #include <stdexcept> 00030 #include <iostream> 00031 #include <numeric> 00032 #include <vector> 00033 00034 namespace GiNaCRA 00035 { 00036 typedef std::pair<unsigned, unsigned> pui; 00037 typedef std::vector<pui>::const_iterator vui_cIt; 00038 00039 class MultivariateTermMR; 00040 00051 class MultivariateMonomialMR 00052 { 00053 public: 00054 friend class MultivariateTermMR; 00055 MultivariateMonomialMR(); 00056 00061 MultivariateMonomialMR( unsigned nrVars ); 00062 //MultivariateMonomialMR( const GiNaC::ex& expr ); 00063 00069 MultivariateMonomialMR( unsigned varIndex, int exponent ); 00070 00076 MultivariateMonomialMR( vui_cIt vecBegin, vui_cIt vecEnd ); 00077 00082 inline unsigned tdeg() const 00083 { 00084 return mTotDeg; 00085 } 00086 00087 inline bool constant() const 00088 { 00089 return (tdeg() == 0); 00090 } 00091 00092 //InternalMultivariateMonomialMR& operator=(const InternalMultivariateMonomialMR& rhs); 00093 //InternalMultivariateMonomialMR& operator*=(const InternalMultivariateMonomialMR& rhs); 00094 //InternalMultivariateMonomialMR& operator/=(const InternalMultivariateMonomialMR& rhs); 00095 00100 GiNaC::ex toEx() const; 00101 00102 friend const MultivariateMonomialMR operator *( const MultivariateMonomialMR& m1, const MultivariateMonomialMR& m2 ); 00103 friend const MultivariateMonomialMR operator /( const MultivariateMonomialMR& nom, const MultivariateMonomialMR& denom ); 00104 00105 friend bool operator !=( const MultivariateMonomialMR& lhs, const MultivariateMonomialMR& rhs ); 00106 friend bool operator ==( const MultivariateMonomialMR& lhs, const MultivariateMonomialMR& rhs ); 00107 friend std::ostream& operator <<( std::ostream& os, const MultivariateMonomialMR& rhs ); 00108 00109 //static bool varsMatch(const MultivariateMonomialMR& lhs, const MultivariateMonomialMR& rhs); 00110 00117 static const MultivariateMonomialMR lcm( const MultivariateMonomialMR& m1, const MultivariateMonomialMR& m2 ); 00118 00125 static bool LexCompare( const MultivariateMonomialMR& m1, const MultivariateMonomialMR& m2 ); 00126 00133 static bool GrLexCompare( const MultivariateMonomialMR& m1, const MultivariateMonomialMR& m2 ); 00134 00141 static bool GrRevLexCompare( const MultivariateMonomialMR& m1, const MultivariateMonomialMR& m2 ); 00142 00143 private: 00145 std::vector<std::pair<unsigned, unsigned> > mExponents; 00147 unsigned mTotDeg; 00148 00149 }; 00150 00151 } 00152 #endif