source: git/factory/cf_reval.cc @ 1f545af

spielwiese
Last change on this file since 1f545af was 1f545af, checked in by Hans Schönemann <hannes@…>, 19 years ago
*hannes: off by 1 git-svn-id: file:///usr/local/Singular/svn/trunk@8561 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 1.3 KB
Line 
1/* emacs edit mode for this file is -*- C++ -*- */
2/* $Id: cf_reval.cc,v 1.6 2005-08-24 13:31:55 Singular Exp $ */
3
4#define MORE_ZEROES
5
6#include <config.h>
7
8#include "assert.h"
9
10#include "cf_defs.h"
11#include "cf_reval.h"
12
13
14REvaluation::REvaluation( const REvaluation & e )
15{
16    if ( e.gen == 0 )
17        gen = 0;
18    else
19        gen = e.gen->clone();
20    values = e.values;
21    cnt = e.cnt;
22}
23
24REvaluation::~REvaluation()
25{
26    if ( gen != 0 )
27        delete gen;
28}
29
30REvaluation&
31REvaluation::operator= ( const REvaluation & e )
32{
33    if ( this != &e ) {
34        if (gen!=0)
35          delete gen;
36        values = e.values;
37        cnt = e.cnt;
38        if ( e.gen == 0 )
39            gen = 0;
40        else
41            gen = e.gen->clone();
42    }
43    return *this;
44}
45
46void
47REvaluation::nextpoint()
48{
49    int n = values.max();
50    for ( int i = values.min(); i <= n; i++ )
51        values[i] = gen->generate();
52}
53
54void
55REvaluation::nextpoint_0()
56{
57    int n = values.max();
58#ifdef MORE_ZEROES
59   // for ( int i = values.min(); i <= n; i++ )
60//      values[i] = gen->generate();
61  if (cnt<=n /* values.max() */ )
62  {
63    cnt++;
64    int t;
65    int m=values.min();
66    if (m<n)
67    {
68      t=factoryrandom(n-m+1)+m;
69    }
70    else t=n;
71    values[t]=gen->generate();
72  }
73  else
74#endif
75  {
76    for ( int i = values.min(); i <= n; i++ )
77        values[i] = gen->generate();
78  }
79}
Note: See TracBrowser for help on using the repository browser.