spielwiese
Last change
on this file since 806c18 was
806c18,
checked in by Hans Schoenemann <hannes@…>, 13 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:
1.5 KB
|
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" |
---|
[c5323e] | 7 | |
---|
[2dd068] | 8 | #include "cf_defs.h" |
---|
| 9 | #include "cf_eval.h" |
---|
| 10 | |
---|
| 11 | static CanonicalForm evalCF ( const CanonicalForm & f, const CFArray & a, int m, int n ); |
---|
| 12 | |
---|
| 13 | |
---|
| 14 | Evaluation& Evaluation::operator= ( const Evaluation & e ) |
---|
| 15 | { |
---|
| 16 | if ( this != &e ) { |
---|
[806c18] | 17 | values = e.values; |
---|
[2dd068] | 18 | } |
---|
| 19 | return *this; |
---|
| 20 | } |
---|
| 21 | |
---|
| 22 | CanonicalForm |
---|
| 23 | Evaluation::operator() ( const CanonicalForm & f ) const |
---|
| 24 | { |
---|
| 25 | if ( f.inCoeffDomain() || f.level() < values.min() ) |
---|
[806c18] | 26 | return f; |
---|
[2dd068] | 27 | else if ( f.level() < values.max() ) |
---|
[806c18] | 28 | return evalCF( f, values, values.min(), f.level() ); |
---|
[2dd068] | 29 | else |
---|
[806c18] | 30 | return evalCF( f, values, values.min(), values.max() ); |
---|
[2dd068] | 31 | } |
---|
| 32 | |
---|
| 33 | CanonicalForm |
---|
| 34 | Evaluation::operator() ( const CanonicalForm & f, int i, int j ) const |
---|
| 35 | { |
---|
| 36 | if ( i > j ) |
---|
[806c18] | 37 | return f; |
---|
[2dd068] | 38 | return evalCF( f, values, i, j ); |
---|
| 39 | } |
---|
| 40 | |
---|
| 41 | void |
---|
| 42 | Evaluation::nextpoint() |
---|
| 43 | { |
---|
| 44 | int n = values.max(); |
---|
| 45 | for ( int i = values.min(); i <= n; i++ ) |
---|
[806c18] | 46 | values[i] += 1; |
---|
[2dd068] | 47 | } |
---|
| 48 | |
---|
[c5323e] | 49 | #ifndef NOSTREAMIO |
---|
[181148] | 50 | OSTREAM& |
---|
| 51 | operator<< ( OSTREAM& s, const Evaluation &e ) |
---|
[2dd068] | 52 | { |
---|
[6400f5] | 53 | e.values.print(s); |
---|
[2dd068] | 54 | return s; |
---|
| 55 | } |
---|
[c5323e] | 56 | #endif /* NOSTREAMIO */ |
---|
[2dd068] | 57 | |
---|
| 58 | CanonicalForm |
---|
| 59 | evalCF ( const CanonicalForm & f, const CFArray & a, int m, int n ) |
---|
| 60 | { |
---|
| 61 | if ( m > n ) |
---|
[806c18] | 62 | return f; |
---|
[2dd068] | 63 | else { |
---|
[806c18] | 64 | CanonicalForm result = f; |
---|
| 65 | while ( n >= m ) { |
---|
| 66 | result = result( a[n], Variable( n ) ); |
---|
| 67 | n--; |
---|
| 68 | } |
---|
| 69 | return result; |
---|
[2dd068] | 70 | } |
---|
| 71 | // iterated method turned out to be faster than |
---|
| 72 | // return evalCF( f( a[n], Variable( n ) ), a, m, n-1 ); |
---|
| 73 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.