| 318 | |
| 319 | |
| 320 | void PolymakeFile::writeMatrixProperty(const char *p, const ZMatrix &m, bool indexed, const vector<string> *comments) |
| 321 | { |
| 322 | stringstream t; |
| 323 | |
| 324 | if(comments)assert((int)comments->size()>=m.getHeight()); |
| 325 | if(isXml) |
| 326 | { |
| 327 | t << "<matrix>\n"; |
| 328 | for(int i=0;i<m.getHeight();i++) |
| 329 | { |
| 330 | t << "<vector>"; |
| 331 | for(int j=0;j<m.getWidth();j++) |
| 332 | { |
| 333 | if(j!=0)t<<" "; |
| 334 | t<<m[i][j]; |
| 335 | } |
| 336 | t<<endl; |
| 337 | t << "</vector>\n"; |
| 338 | } |
| 339 | t << "</matrix>\n"; |
| 340 | } |
| 341 | else |
| 342 | { |
| 343 | for(int i=0;i<m.getHeight();i++) |
| 344 | { |
| 345 | for(int j=0;j<m.getWidth();j++) |
| 346 | { |
| 347 | if(j!=0)t<<" "; |
| 348 | t<<m[i][j]; |
| 349 | } |
| 350 | if(indexed)t<<"\t# "<<i; |
| 351 | if(comments)t<<"\t# "<<(*comments)[i]; |
| 352 | t<<endl; |
| 353 | } |
| 354 | } |
| 355 | writeProperty(p,t.str()); |
| 356 | } |
| 357 | |
| 358 | |
| 359 | vector<list<int> > PolymakeFile::readMatrixIncidenceProperty(const char *p) |