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

Method readMatrixProperty

gfanlib/gfanlib_polymakefile.cpp:284–317  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

282
283
284ZMatrix PolymakeFile::readMatrixProperty(const char *p, int height, int width)
285{
286 ZMatrix ret(0,width);
287
288 assert(hasProperty(p,true));
289 list<PolymakeProperty>::iterator prop=findProperty(p);
290 stringstream s(prop->value);
291// for(int i=0;i<height;i++)
292 for(int i=0;;i++)
293 {
294 if(i==height)break;
295 ZVector w(width);
296 for(int j=0;j<width;j++)
297 {
298 int v;
299 eatComment(s);
300 s>>v;
301 if(s.eof())goto done;
302 w[j]=v;
303 }
304 ret.appendRow(w);
305 }
306 done:
307
308 if(height>=0)assert(ret.getHeight()==height);
309// cerr<<p;
310 // eatComment(s);
311 // int v;
312 // s>>v;
313// while(!s.eof())std::cerr<<char(s.get());
314 // assert(s.eof());
315
316 return ret;
317}
318
319
320void PolymakeFile::writeMatrixProperty(const char *p, const ZMatrix &m, bool indexed, const vector<string> *comments)

Callers 2

readFanMethod · 0.80
ZFanMethod · 0.80

Calls 4

assertFunction · 0.85
eatCommentFunction · 0.85
appendRowMethod · 0.80
getHeightMethod · 0.80

Tested by

no test coverage detected