source: git/factory/cf_irred.cc @ f58e95

spielwiese
Last change on this file since f58e95 was f58e95, checked in by Jens Schmidt <schmidt@…>, 27 years ago
* canonicalform.h: declarations of functions from cf_factor.cc removed. In all files which refer to these functions #include of cf_algorithm.h added. git-svn-id: file:///usr/local/Singular/svn/trunk@639 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 700 bytes
Line 
1/* emacs edit mode for this file is -*- C++ -*- */
2/* $Id: cf_irred.cc,v 1.3 1997-08-29 08:38:25 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_algorithm.h"
11#include "cf_random.h"
12
13static bool
14is_irreducible ( const CanonicalForm & f )
15{
16    CFFList F = factorize( f );
17    return F.length() == 1 && F.getFirst().exp() == 1;
18}
19
20CanonicalForm
21find_irreducible ( int deg, CFRandom & gen, const Variable & x )
22{
23    CanonicalForm result;
24    int i;
25    do {
26        result = power( x, deg );
27        for ( i = deg-1; i >= 0; i-- )
28            result += gen.generate() * power( x, i );
29    } while ( ! is_irreducible( result ) );
30    return result;
31}
Note: See TracBrowser for help on using the repository browser.