00001
00002
00003
00004
00005
00006
00007
00008 #ifndef OSCILLATIONDETECTOR_H_
00009 #define OSCILLATIONDETECTOR_H_
00010
00011
00012 #include "IntSet.h"
00013
00014
00015 #define DEFAULT_CAPACITY 10
00016 #define MAXIMUM_CAPACITY 500
00017 #define TOLERANCE 1e-16
00018
00027 class OscillationDetector {
00028 public:
00032 OscillationDetector(int newLength);
00033 virtual ~OscillationDetector();
00034
00042 bool checkState(double * a, double * b);
00043
00048 bool isOscillating() { return oscillating; }
00049
00050 private:
00051
00052 int getCheckSum(double * a);
00053 bool insert(int checkSum, double * a);
00054 void rehash();
00055 int quadraticProbe(int index, double * a);
00056 int hash(double * a);
00057
00058 bool oscillating;
00059 bool warning;
00060 IntSet * checkSums;
00061 int size, length, capacity;
00062 double ** vectors;
00063
00064 };
00065
00066 #endif