spielwiese
Last change
on this file since 493c477 was
493c477,
checked in by Jens Schmidt <schmidt@…>, 27 years ago
|
o header fixed
git-svn-id: file:///usr/local/Singular/svn/trunk@404 2c84dea3-7e68-4137-9b89-c4e89433aadc
|
-
Property mode set to
100644
|
File size:
674 bytes
|
Line | |
---|
1 | /* emacs edit mode for this file is -*- C++ -*- */ |
---|
2 | /* $Id: cf_irred.cc,v 1.2 1997-06-19 12:24:26 schmidt Exp $ */ |
---|
3 | |
---|
4 | #include <config.h> |
---|
5 | |
---|
6 | #include "assert.h" |
---|
7 | |
---|
8 | #include "cf_defs.h" |
---|
9 | #include "canonicalform.h" |
---|
10 | #include "cf_random.h" |
---|
11 | |
---|
12 | static bool |
---|
13 | is_irreducible ( const CanonicalForm & f ) |
---|
14 | { |
---|
15 | CFFList F = factorize( f ); |
---|
16 | return F.length() == 1 && F.getFirst().exp() == 1; |
---|
17 | } |
---|
18 | |
---|
19 | CanonicalForm |
---|
20 | find_irreducible ( int deg, CFRandom & gen, const Variable & x ) |
---|
21 | { |
---|
22 | CanonicalForm result; |
---|
23 | int i; |
---|
24 | do { |
---|
25 | result = power( x, deg ); |
---|
26 | for ( i = deg-1; i >= 0; i-- ) |
---|
27 | result += gen.generate() * power( x, i ); |
---|
28 | } while ( ! is_irreducible( result ) ); |
---|
29 | return result; |
---|
30 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.