fieker-DuValspielwiese
Last change
on this file since 5df7d0 was
806c18,
checked in by Hans Schoenemann <hannes@…>, 14 years ago
|
format
git-svn-id: file:///usr/local/Singular/svn/trunk@13655 2c84dea3-7e68-4137-9b89-c4e89433aadc
|
-
Property mode set to
100644
|
File size:
669 bytes
|
Rev | Line | |
---|
[493c477] | 1 | /* emacs edit mode for this file is -*- C++ -*- */ |
---|
[341696] | 2 | /* $Id$ */ |
---|
[2dd068] | 3 | |
---|
[ab4548f] | 4 | #include <config.h> |
---|
| 5 | |
---|
[2dd068] | 6 | #include "assert.h" |
---|
[ab4548f] | 7 | |
---|
[2dd068] | 8 | #include "cf_defs.h" |
---|
| 9 | #include "canonicalform.h" |
---|
[f58e95] | 10 | #include "cf_algorithm.h" |
---|
[2dd068] | 11 | #include "cf_random.h" |
---|
| 12 | |
---|
| 13 | static bool |
---|
| 14 | is_irreducible ( const CanonicalForm & f ) |
---|
| 15 | { |
---|
| 16 | CFFList F = factorize( f ); |
---|
| 17 | return F.length() == 1 && F.getFirst().exp() == 1; |
---|
| 18 | } |
---|
| 19 | |
---|
| 20 | CanonicalForm |
---|
| 21 | find_irreducible ( int deg, CFRandom & gen, const Variable & x ) |
---|
| 22 | { |
---|
| 23 | CanonicalForm result; |
---|
| 24 | int i; |
---|
| 25 | do { |
---|
[806c18] | 26 | result = power( x, deg ); |
---|
| 27 | for ( i = deg-1; i >= 0; i-- ) |
---|
| 28 | result += gen.generate() * power( x, i ); |
---|
[2dd068] | 29 | } while ( ! is_irreducible( result ) ); |
---|
| 30 | return result; |
---|
| 31 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.