-> void rootContainer::solver()
| 435 | |
| 436 | //-> void rootContainer::solver() |
| 437 | bool 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 ) |
no test coverage detected