10 using std::setprecision;
12 template<
typename typmat>
16 for(
int i=0;
i<m.nrow;
i++)
19 for(
int j=0;
j<m.ncol-1;
j++)
21 if (m(
i,
j)!=0) {printf(
"*");}
29 template<
typename typmat>
33 cout<<setprecision(6);
34 cout<<
"nrow "<<m.nrow<<
" ncol "<<m.ncol<<endl;
36 for(i=0;i<m.nrow-1;i++)
40 for(j=0;j<m.ncol-1;j++)
45 cout<<m(i,j)<<
"],"<<endl;
50 for(j=0;j<m.ncol-1;j++)
52 cout<<m(i,j)<<
"]"<<endl;
54 cout<<
"]"<<endl<<setprecision(16);
57 template <
template<
class T>
class typmat,
class C>
61 std::ofstream sfic(name);
62 sfic.unsetf(std::ios::floatfield);
66 for(i=0;i<m.nrow-1;i++) {
69 for(k=0;k<m.ncol-1;k++) {
71 sfic << m(i,k) <<
"\n";
75 sfic << m(i,k) <<
"\n" ;
77 for(j=0;j<m.ncol-1;j++) {
80 sfic << m(i,j) <<
"\n";
90 template<
template<
typename T>
class typmat,
typename toto >
98 template<
template<
typename T>
class typmat >
101 fprintf(fic,
"%s:=[",name);
102 for(i=0;i<m.nrow-1;i++)
106 for(j=0;j<m.ncol-1;j++)
108 fprintf(fic,
"%.16f+(%.16f)*I,",m(i,j).real(),m(i,j).imag());
111 fprintf(fic,
"%.16f+(%.16f)*I],\n",m(i,j).real(),m(i,j).imag());
116 for(j=0;j<m.ncol-1;j++)
119 fprintf(fic,
"%.16f+(%.16f)*I,",m(i,j).real(),m(i,j).imag());
122 fprintf(fic,
"%.16f+(%.16f)*I]\n];\n",m(i,j).real(),m(i,j).imag());
126 template<
template<
typename T>
class typmat >
130 if(m.nrow==0)
return;
131 fprintf(fic,
"%s:=[",name);
132 for(i=0;i<m.nrow-1;i++)
136 for(j=0;j<m.ncol-1;j++)
138 fprintf(fic,
"%.16Lf+(%.16Lf)*I,",m(i,j).real(),m(i,j).imag());
141 fprintf(fic,
"%.16Lf+(%.16Lf)*I],\n",m(i,j).real(),m(i,j).imag());
146 for(j=0;j<m.ncol-1;j++)
149 fprintf(fic,
"%.16Lf+(%.16Lf)*I,",m(i,j).real(),m(i,j).imag());
152 fprintf(fic,
"%.16Lf+(%.16Lf)*I]\n];\n",m(i,j).real(),m(i,j).imag());
156 template<
template<
typename T>
class typmat >
160 fprintf(fic,
"%s:=[",name);
161 for(i=0;i<m.nrow-1;i++)
165 for(j=0;j<m.ncol-1;j++)
167 mpf_out_str(fic,10,
NBDIGITS,m(i,j).real().rep());
169 mpf_out_str(fic,10,
NBDIGITS,m(i,j).imag().rep());
173 mpf_out_str(fic,10,
NBDIGITS,(m(i,j).real().rep()));
175 mpf_out_str(fic,10,
NBDIGITS,m(i,j).imag().rep());
183 for(j=0;j<m.ncol-1;j++)
186 mpf_out_str(fic,10,
NBDIGITS,(m(i,j).real().rep()));
188 mpf_out_str(fic,10,
NBDIGITS,m(i,j).imag().rep());
195 mpf_out_str(fic,10,
NBDIGITS,(m(i,j).real().rep()));
197 mpf_out_str(fic,10,
NBDIGITS,m(i,j).imag().rep());
198 fprintf(fic,
")]\n];\n");
203 template<
template<
typename T>
class typmat >
206 fprintf(fic,
"%s=[",name);
207 for(i=0;i<m.nrow-1;i++)
211 for(j=0;j<m.ncol-1;j++)
213 fprintf(fic,
"%.16e+(%.16e)*I,",m(i,j).real(),m(i,j).imag());
216 fprintf(fic,
"%.16e+(%.16e)*I;\n",m(i,j).real(),m(i,j).imag());
221 for(j=0;j<m.ncol-1;j++)
224 fprintf(fic,
"%.16e+(%.16e)*I,",m(i,j).real(),m(i,j).imag());
227 fprintf(fic,
"%.16e+(%.16e)*I\n];\n",m(i,j).real(),m(i,j).imag());
231 template<
template<
typename T>
class typmat >
234 fprintf(fic,
"%s=[",name);
235 for(i=0;i<m.nrow-1;i++)
239 for(j=0;j<m.ncol-1;j++)
241 fprintf(fic,
"%.32Le+(%.32Le)*I,",m(i,j).real(),m(i,j).imag());
244 fprintf(fic,
"%.32Le+(%.32Le)*I;\n",m(i,j).real(),m(i,j).imag());
249 for(j=0;j<m.ncol-1;j++)
252 fprintf(fic,
"%.32Le+(%.32Le)*I,",m(i,j).real(),m(i,j).imag());
255 fprintf(fic,
"%.32Le+(%.32Le)*I\n];\n",m(i,j).real(),m(i,j).imag());
260 template<
template<
typename T>
class typmat >
264 fprintf(fic,
"%s:=[",name);
265 for(i=0;i<m.nrow-1;i++)
269 for(j=0;j<m.ncol-1;j++)
271 fprintf(fic,
"%.16f,",m(i,j));
274 fprintf(fic,
"%.16f],\n",m(i,j));
279 for(j=0;j<m.ncol-1;j++)
282 fprintf(fic,
"%.16f,",m(i,j));
285 fprintf(fic,
"%.16f]\n];\n",m(i,j));
289 template<
template<
typename T>
class typmat >
293 fprintf(fic,
"%s:=[",name);
294 for(i=0;i<m.nrow-1;i++)
298 for(j=0;j<m.ncol-1;j++)
300 fprintf(fic,
"%.16Lf,",m(i,j));
303 fprintf(fic,
"%.16Lf],\n",m(i,j));
308 for(j=0;j<m.ncol-1;j++)
311 fprintf(fic,
"%.16Lf,",m(i,j));
314 fprintf(fic,
"%.16Lf]\n];\n",m(i,j));
319 template<
template<
typename T>
class typmat ,
typename TT>
323 fprintf(fic,
"%s:=[",name);
324 for(i=0;i<m.nrow-1;i++)
328 for(j=0;j<m.ncol-1;j++)
330 fprintf(fic,
"%d,",m(i,j).rep);
333 fprintf(fic,
"%d],\n",m(i,j).rep);
338 for(j=0;j<m.ncol-1;j++)
341 fprintf(fic,
"%d,",m(i,j).rep);
344 fprintf(fic,
"%d]\n];\n",m(i,j).rep);
349 template<
template<
typename T>
class typmat >
353 fprintf(fic,
"%s:=[",name);
354 for(i=0;i<m.nrow-1;i++)
358 for(j=0;j<m.ncol-1;j++)
360 mpq_out_str(fic,10,&(m(i,j).rep()));
363 mpq_out_str(fic,10,&(m(i,j).rep()));
369 for(j=0;j<m.ncol-1;j++)
371 mpq_out_str(fic,10,&(m(i,j).rep()));
374 mpq_out_str(fic,10,&(m(i,j).rep()));
375 fprintf(fic,
"]\n];\n");
380 template<
template<
typename T>
class typmat >
384 fprintf(fic,
"%d %d\n",m.nrow,m.ncol);
385 for(i=0;i<m.nrow;i++)
387 for(j=0;j<m.ncol;j++)
389 fprintf(fic,
"%d %d ",i,j);
390 mpf_out_str(fic,10,
NBDIGITS,(m(i,j).rep()));
396 template<
template<
typename T>
class typmat >
400 fprintf(fic,
"%s:=[",name);
401 for(i=0;i<m.nrow-1;i++)
405 for(j=0;j<m.ncol-1;j++)
407 mpf_out_str(fic,10,
NBDIGITS,(m(i,j).rep()));
410 mpf_out_str(fic,10,
NBDIGITS,(m(i,j).rep()));
416 for(j=0;j<m.ncol-1;j++)
418 mpf_out_str(fic,10,
NBDIGITS,(m(i,j).rep()));
421 mpf_out_str(fic,10,
NBDIGITS,(m(i,j).rep()));
422 fprintf(fic,
"]\n];\n");
432 template <
typename typP>
436 typedef typename typP::value_type
pol;
438 FILE *fic=fopen(name,
"r");
439 char * chaine=(
char*)
malloc(1000000001);
440 for (;fgets(chaine,1000000000,fic)!=NULL;)
447 toto.push_back(p=
pol(chaine));
454 template <
typename typP>
458 typedef typename typP::value_type
pol;
461 std::ifstream f(name);
473 while (c !=
';' && f.good()) {
477 chaine.push_back(
';');
479 if(chaine.size()>1) {
481 toto.push_back(p=
pol(chaine.c_str()));
516 fprintf(fic,
"%Lf",c);
521 mpq_out_str(fic,10,&c.
data);
526 mpf_out_str(fic,10,30,c.
data);
528 #ifdef __GMP_PLUSPLUS__
531 mpf_out_str(fic,10,30,c.get_mpf_t());
539 fprintf(fic,
"%d",c.
rep);
546 for(
int i=0;i<=
lvar(m.
rep);i++)
550 fprintf(fic,
"*x%d",i);
557 template<
typename typdump>
560 fprintf(fic,
"#begin: dump\n");
561 for(
typename typdump::const_iterator iter=dump.begin();
562 iter!=dump.end();iter++)
564 fprintf(fic,
"k: %d\n",iter->k);
565 fprintf(fic,
"size: %d",iter->size);
566 for(
int i=0;i<iter->size;i++)
570 for(
int j=0;j<iter->nf[
i].size;j++)
583 fprintf(fic,
"#end: dump\n");
586 template <
typename typdump>
589 typedef typename typdump::value_type
pol;
591 char * chaine=(
char*)
malloc(10000001);
592 for (;fgets(chaine,10000000,fic)!=NULL;)
594 printf(
"chainelue %s\n",chaine);fflush(stdout);
595 toto.push_back(p=
pol(chaine));
596 cout<<
"g pushe "<<p<<endl;
mon monofindex(int j, pol< mon, T > &p)
Definition: pol.hpp:210
void affdebug(const typmat &m)
Definition: io.hpp:30
void readdump(FILE *fic, typdump &toto)
Definition: io.hpp:587
int lvar(const dynamicexp< X, E > &A)
Definition: dynamicexp.hpp:178
void affdebug2(const typmat &m)
Definition: io.hpp:13
T data
Definition: Scl.hpp:34
C GetCoeff() const
Definition: Monom.hpp:67
void readfile(typP &toto, const char *name)
Definition: io.hpp:433
void raw_printmatfile(const typmat< C > &m, const char *name)
Definition: io.hpp:58
MSKconetypee MSKrealt MSKint32t MSKint32t j
Definition: mosek.h:2421
void printdump(FILE *fic, const typdump &dump)
Definition: io.hpp:558
Definition: mdebug.hpp:11
MSKint32t k
Definition: mosek.h:2713
R rep
Definition: Monom.hpp:30
void printmatfile_pequan(const typmat< Scl< MPF > > &m, FILE *fic)
Definition: io.hpp:381
void printmatfile(const typmat< toto > &m, const char *name, FILE *fic)
Definition: io.hpp:91
exponent_t GetDegree() const
Definition: Monom.hpp:70
MSKrealt * c
Definition: mosek.h:2678
MSKint32t MSKint32t MSKint32t i
Definition: mosek.h:2278
void printmon(FILE *fic, mon m)
Definition: io.hpp:543
void printmatfilescilab(const typmat< complex< double > > &m, const char *name, FILE *fic)
Definition: io.hpp:204
T rep
Definition: Zp.hpp:25
#define NBDIGITS
Definition: solver_bb_floating.cpp:104
void printcoeff(FILE *fic, double c)
Definition: io.hpp:509
#define pol
Definition: pol2ter.hpp:3
Multivariate monomials.
Definition: Monom.hpp:21
void readfilemin(typP &toto, int &numeq, int &numineq, char *name)
Definition: io.hpp:455
MSKint32t MSKint32t char * name
Definition: mosek.h:2853