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

Method solver

kernel/numeric/mpr_numeric.cc:437–463  ·  view source on GitHub ↗

-> void rootContainer::solver()

Source from the content-addressed store, hash-verified

435
436//-> void rootContainer::solver()
437bool rootContainer::solver( const int polishmode )
438{
439 int i;
440
441 // there are maximal tdg roots, so *roots ranges form 0 to tdg-1.
442 theroots= (gmp_complex**)omAlloc( tdg*sizeof(gmp_complex*) );
443 for ( i=0; i < tdg; i++ ) theroots[i]= new gmp_complex();
444
445 // copy the coefficients of type number to type gmp_complex
446 gmp_complex **ad= (gmp_complex**)omAlloc( (tdg+1)*sizeof(gmp_complex*) );
447 for ( i=0; i <= tdg; i++ )
448 {
449 ad[i]= new gmp_complex();
450 if ( coeffs[i] ) *ad[i] = numberToComplex( coeffs[i], currRing->cf );
451 }
452
453 // now solve
454 found_roots= laguer_driver( ad, theroots, polishmode != 0 );
455 if (!found_roots)
456 WarnS("rootContainer::solver: No roots found!");
457
458 // free memory
459 for ( i=0; i <= tdg; i++ ) delete ad[i];
460 omFreeSize( (void *) ad, (tdg+1)*sizeof(gmp_complex*) );
461
462 return found_roots;
463}
464//<-
465
466//-> gmp_complex* rootContainer::laguer_driver( bool polish )

Callers 4

renamingStringsMethod · 0.80
nuLagSolveFunction · 0.80
minkowksiFunction · 0.80
solve_allMethod · 0.80

Calls 2

numberToComplexFunction · 0.85
WarnSFunction · 0.85

Tested by

no test coverage detected