Borderbasix

matmul3sdp.hpp
Go to the documentation of this file.
1 #ifndef ALREADY_matmul3
2 #define ALREADY_matmul3
3 
4 template<typename typMk>
5 int indice(const typename typMk::value_type & m, const typMk &stockmon)
6 {
7  int res=0;
8  for(typename typMk::const_iterator iter=stockmon.begin();
9  (iter->rep!=m.rep)&&(iter!=stockmon.end());iter++,res++);
10  return res;
11 }
12 
13 //on suppose stockmon vide
14 template<typename Base, typename typstock, typename typdump>
15 void computestockmon(typstock &stockmon, const Base &b, const typdump &dump)
16 {
17  //typedef typename typdump::value_type::pol_t pol;
18  //typedef typename pol::monom_t mon;
19  typedef typename typstock::value_type mon;
20  int maxdeg=0;
21  //int taillequo=0,tmp=0;
22  // mon *who=NULL;
23  list<mon> current;
24  current.push_back(mon(1));
25  stockmon.push_back(mon(1));
26  {
27  typename typdump::const_iterator iter;
28  for(iter=dump.begin();
29  iter!=dump.end();iter++);
30  maxdeg=(--iter)->k;
31  }
32  //on a le degre max
33  //le quotient est connexe a 1 donc on part
34  //de 1 et on decrit le reste en multipliant par les variables
35  for(int i=0;i<maxdeg;i++)
36  {
37  list<mon> tmpcurrent=current;
38  //my_merge(stockmon,current);
39  current.erase(current.begin(),current.end());
40  for(int i=0;i<b.nbvar();i++)
41  {
42  for(typename list<mon>::iterator iter=tmpcurrent.begin();
43  iter!=tmpcurrent.end();iter++)
44  current.push_back((*iter)*mon(i,1));
45  }
46  //maintenant on tri;
47  for(typename list<mon>::iterator iter=current.begin();iter!=current.end();iter++)
48  if((IsinB(*iter,b))&&(!member(stockmon,*iter)))
49  {
50  stockmon.push_back(*iter);
51  }
52  else
53  {
54  current.erase(iter--);
55  }
56  }
57  return;
58 }
59 
60 
61 //on suppose dqans un premier temps que le pol qui est donne
62 //en parametre est en fait une variable
63 template<typename typmat,typename typdump,typename Base, typename typstock,
64  typename monomial_server>
65 void matmul(typmat & m,const int p,const typdump &dump,const Base &b
66  , const typstock &stockmon, monomial_server & serv)
67 {
68  typedef typename typdump::value_type::pol_t pol;
69  typedef typename pol::monom_t mon;
70  typedef typename pol::coeff_t coeff;
71  typstock current;
72  typedef typename typstock::value_type monstock;
73  //dans stockmon on a maintenant les monomes du quotient;
74  //on le multiplis par la variable p
75  current=stockmon;
76  for(typename typstock::iterator iter=current.begin();iter!=current.end()
77  ;iter++)
78  {
79  *iter*=monstock(p,1);
80  }
81  //maintenant on ecrit la matrice
82  {
83  int j=0;
84  m=typmat(current.size(),current.size());
85  for(typename typstock::iterator iter=current.begin()
86  ;iter!=current.end();iter++,j++)
87  {
88  if(!IsinB(*iter,b))
89  {
90  pol tmp;
91  int count=0;
92  tmp.sizenf=-1;
93  findcorresppol(*iter,dump,tmp);
94  typename typstock::value_type tmpmon;
95  // cout<<invconv<Poly>(tmp)<<endl;
96  for(int i=0;i<tmp.sizenf;i++)
97  {
98  if(tmp.nfind[i])
99  for(int jj=0;jj<8;jj++)
100  if((tmp.nfind[i]>>jj)&1)
101  {
102  serv.int2mon(8*i+jj,tmpmon);
103  m(indice(tmpmon,stockmon),j,tmp.nf[count++]*(coeff)(-1));
104  }
105  }
106  }
107  else
108  {
109  //cout<<"indice "<<indice(*iter,current)<<endl;
110  m(indice(*iter,stockmon),j,(coeff)(1));
111  }
112  }
113  }
114  return;
115 }
116 #endif //ALREADY_matmul3
void int2mon(const int &i, mon &res)
Definition: placemon3.hpp:664
int indice(const typename typMk::value_type &m, const typMk &stockmon)
Definition: matmul3sdp.hpp:5
void findcorresppol(const mon &m, const typdump &dump, pol &res)
Definition: corealgo.hpp:2031
int member(const typMk &tmpMk, const typename typMk::value_type mon)
Definition: corealgo.hpp:1391
T coeff_t
Definition: pol.hpp:9
int nbvar()
Definition: types.hpp:37
MSKconetypee MSKrealt MSKint32t MSKint32t j
Definition: mosek.h:2421
void matmul(typmat &m, const int p, const typdump &dump, const Base &b, const typstock &stockmon, monomial_server &serv)
Definition: matmul3sdp.hpp:65
MSKint32t k
Definition: mosek.h:2713
Definition: placemon3.hpp:14
int IsinB(const mon &m, const Base &b)
Definition: IsinB3.hpp:68
Mon mon
Definition: solver_bb_floating.cpp:136
Definition: types.hpp:14
MSKint32t MSKint32t MSKint32t i
Definition: mosek.h:2278
#define pol
Definition: pol2ter.hpp:3
Multivariate monomials.
Definition: Monom.hpp:21
T * nf
Definition: pol.hpp:12
void computestockmon(typstock &stockmon, const Base &b, const typdump &dump)
Definition: matmul3sdp.hpp:15
Home  |  Download & InstallContributions