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

Function listOfRoots

Singular/ipshell.cc:5074–5118  ·  view source on GitHub ↗

from mpr_numeric.cc

Source from the content-addressed store, hash-verified

5072
5073// from mpr_numeric.cc
5074lists listOfRoots( rootArranger* self, const unsigned int oprec )
5075{
5076 int i,j;
5077 int count= self->roots[0]->getAnzRoots(); // number of roots
5078 int elem= self->roots[0]->getAnzElems(); // number of koordinates per root
5079
5080 lists listofroots= (lists)omAlloc( sizeof(slists) ); // must be done this way!
5081
5082 if ( self->found_roots )
5083 {
5084 listofroots->Init( count );
5085
5086 for (i=0; i < count; i++)
5087 {
5088 lists onepoint= (lists)omAlloc(sizeof(slists)); // must be done this way!
5089 onepoint->Init(elem);
5090 for ( j= 0; j < elem; j++ )
5091 {
5092 if ( !rField_is_long_C(currRing) )
5093 {
5094 onepoint->m[j].rtyp=STRING_CMD;
5095 onepoint->m[j].data=(void *)complexToStr((*self->roots[j])[i],oprec, currRing->cf);
5096 }
5097 else
5098 {
5099 onepoint->m[j].rtyp=NUMBER_CMD;
5100 onepoint->m[j].data=(void *)n_Copy((number)(self->roots[j]->getRoot(i)), currRing->cf);
5101 }
5102 onepoint->m[j].next= NULL;
5103 onepoint->m[j].name= NULL;
5104 }
5105 listofroots->m[i].rtyp=LIST_CMD;
5106 listofroots->m[i].data=(void *)onepoint;
5107 listofroots->m[j].next= NULL;
5108 listofroots->m[j].name= NULL;
5109 }
5110
5111 }
5112 else
5113 {
5114 listofroots->Init( 0 );
5115 }
5116
5117 return listofroots;
5118}
5119
5120// from ring.cc
5121void rSetHdl(idhdl h)

Callers 1

nuUResSolveFunction · 0.85

Calls 7

rField_is_long_CFunction · 0.85
complexToStrFunction · 0.85
n_CopyFunction · 0.85
getAnzRootsMethod · 0.80
getAnzElemsMethod · 0.80
getRootMethod · 0.80
InitMethod · 0.45

Tested by

no test coverage detected