Changeset 3566734 in git


Ignore:
Timestamp:
Nov 20, 2007, 2:42:50 PM (16 years ago)
Author:
Hans Schönemann <hannes@…>
Branches:
(u'spielwiese', '2a584933abf2a2d3082034c7586d38bb6de1a30a')
Children:
dae1edfbb5143f8c4553bf8acd18e2f85b155432
Parents:
62f8cca6dc508c925bc4d657aea450dafba04fb9
Message:
*hannes: ld


git-svn-id: file:///usr/local/Singular/svn/trunk@10431 2c84dea3-7e68-4137-9b89-c4e89433aadc
Location:
factory
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • factory/ffreval.cc

    r62f8cca r3566734  
    1414#include "ftmpl_functions.h"
    1515#include "ffreval.h"
     16
     17void FFREvaluation::init()
     18{
     19  int n = values.max();
     20
     21  for( int i=values.min(); i<=n; i++ )
     22    values[i] = offset[i] = gen->generate(); // generate random point
     23}
     24
     25bool FFREvaluation::step()
     26{
     27  // enumerates the points stored in values
     28  int n = values.max();
     29  int p = getCharacteristic();
     30
     31  int i;
     32  for(i=values.min(); i<=n; i++ )
     33  {
     34    if( values[i] != p-1 )
     35    {
     36      values[i] += 1;
     37      break;
     38    }
     39    values[i] += 1; // becomes 0
     40  }
     41  for(i=values.min();i<=n;i++)
     42  {
     43    if(values[i]!=offset[i]) return true;
     44  }
     45  return false;
     46}
     47
     48FFREvaluation& FFREvaluation::operator= ( const FFREvaluation & e )
     49{
     50  if( this != &e )
     51  {
     52    if( gen != 0 )
     53      delete gen;
     54    values = e.values;
     55    offset = e.offset;
     56    if( e.gen == 0 )
     57      gen = 0;
     58    else
     59      gen = e.gen->clone();
     60  }
     61  return *this;
     62}   
    1663
    1764/* forward declarations:*/
  • factory/ffreval.h

    r62f8cca r3566734  
    2121};
    2222
    23 void FFREvaluation::init()
    24 {
    25   int n = values.max();
    26 
    27   for( int i=values.min(); i<=n; i++ )
    28     values[i] = offset[i] = gen->generate(); // generate random point
    29 }
    30 
    31 bool FFREvaluation::step()
    32 {
    33   // enumerates the points stored in values
    34   int n = values.max();
    35   int p = getCharacteristic();
    36 
    37   int i;
    38   for(i=values.min(); i<=n; i++ )
    39   {
    40     if( values[i] != p-1 )
    41     {
    42       values[i] += 1;
    43       break;
    44     }
    45     values[i] += 1; // becomes 0
    46   }
    47   for(i=values.min();i<=n;i++)
    48   {
    49     if(values[i]!=offset[i]) return true;
    50   }
    51   return false;
    52 }
    53 
    54 FFREvaluation& FFREvaluation::operator= ( const FFREvaluation & e )
    55 {
    56   if( this != &e )
    57   {
    58     if( gen != 0 )
    59       delete gen;
    60     values = e.values;
    61     offset = e.offset;
    62     if( e.gen == 0 )
    63       gen = 0;
    64     else
    65       gen = e.gen->clone();
    66   }
    67   return *this;
    68 }   
    69 
    7023CanonicalForm fin_ezgcd ( const CanonicalForm & FF, const CanonicalForm & GG );
    7124
Note: See TracChangeset for help on using the changeset viewer.