PolyBoRi
literal_factorization.h
Go to the documentation of this file.
00001 /*
00002  *  literal_factorization.h
00003  *  PolyBoRi
00004  *
00005  *  Created by Michael Brickenstein on 29.05.06.
00006  *  Copyright 2006 The PolyBoRi Team. See LICENSE file.
00007  *
00008  */
00009 
00010 #include <algorithm>
00011 #include <vector>
00012 #include <map>
00013 #include <set>
00014 #include <utility>
00015 #include "groebner_defs.h"
00016 #ifndef PBORI_GB_LF_H
00017 #define PBORI_GB_LF_H
00018 BEGIN_NAMESPACE_PBORIGB
00019 
00020 std::vector<Polynomial> easy_linear_factors(const Polynomial &p);
00021 
00022 class LiteralFactorizationIterator;
00023 class LiteralFactorization{
00024 public:
00025     typedef LiteralFactorizationIterator const_iterator;
00026   LiteralFactorization(const Polynomial&);
00027   LiteralFactorization(){}
00028   typedef std::map<idx_type, int> map_type;
00029   map_type factors;
00030   Polynomial rest;
00031   deg_type lmDeg;
00032   bool occursAsLeadOfFactor(idx_type v) const;
00033   bool trivial() const;
00034   bool is11Factorization();
00035   bool is00Factorization();
00036   //Theorem: f BoolePolynomial with factor (x+b), b in 0, 1 (considered in the usual Polynomial Ring)
00037   //then f/(x+b) does not involve the variable x
00038   //typedef std::pair<idx_type,idx_type> var_pair_type;
00039   //typedef std::set<var_pair_type> two_var_factors;
00040   typedef std::map<idx_type, idx_type> var2var_map_type;
00041   var2var_map_type var2var_map;
00042   const_iterator begin();
00043   const_iterator end();
00044   protected:
00045 
00046 };
00047 class LiteralFactorizationIterator{
00048 public:
00049     LiteralFactorizationIterator(
00050         LiteralFactorization* literal_factorization,
00051         LiteralFactorization::map_type::const_iterator
00052             var2const_iter,
00053         LiteralFactorization::var2var_map_type::const_iterator
00054             var2var_iter
00055             
00056     ){
00057         this->literal_factorization=literal_factorization;
00058         this->var2const_iter=var2const_iter;
00059         this->var2var_iter=var2var_iter;
00060     }
00061     typedef LiteralFactorizationIterator self;
00062     LiteralFactorization::var2var_map_type::const_iterator var2var_iter;
00063     LiteralFactorization::map_type::const_iterator var2const_iter;
00064     self & operator++();
00065     Polynomial operator*() const;
00066     bool operator==(const self& other){
00067            return ((literal_factorization==other.literal_factorization)
00068            && (var2const_iter==other.var2const_iter) &&
00069            (var2var_iter==other.var2var_iter)
00070            );
00071 
00072        }
00073        bool operator!=(const self& other){
00074            return !(*this==other);
00075 
00076        }
00077 private: 
00078     const LiteralFactorization* literal_factorization;
00079    
00080       
00081 };
00082 deg_type common_literal_factors_deg(const LiteralFactorization& a, const LiteralFactorization& b);
00083 END_NAMESPACE_PBORIGB
00084 #endif