MCPcopy Create free account
hub / github.com/Singular/Singular / writeMatrixProperty

Method writeMatrixProperty

gfanlib/gfanlib_polymakefile.cpp:320–356  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

318
319
320void 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
359vector<list<int> > PolymakeFile::readMatrixIncidenceProperty(const char *p)

Callers 2

toStringMethod · 0.80
toStringMethod · 0.80

Calls 5

assertFunction · 0.85
getHeightMethod · 0.80
getWidthMethod · 0.80
sizeMethod · 0.45
strMethod · 0.45

Tested by

no test coverage detected