diff options
| author | Jeremy Erickson <jerickso@cs.unc.edu> | 2012-10-29 12:18:48 -0400 |
|---|---|---|
| committer | Jeremy Erickson <jerickso@cs.unc.edu> | 2012-10-29 14:10:32 -0400 |
| commit | 107da1b6a3840b0e39b436ea51686aa381d27b90 (patch) | |
| tree | 92391d2791c6c858ac426c532111fa507cf7f17c /native/include | |
| parent | 37dbd04e4f9d8956cf4be1c196e282760aa37011 (diff) | |
Added arbitrary-precision arithmetic to native module
Diffstat (limited to 'native/include')
| -rw-r--r-- | native/include/edf/gel_pl.h | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/native/include/edf/gel_pl.h b/native/include/edf/gel_pl.h index 4093d95..1127d50 100644 --- a/native/include/edf/gel_pl.h +++ b/native/include/edf/gel_pl.h | |||
| @@ -13,17 +13,21 @@ class GELPl | |||
| 13 | int no_cpus; | 13 | int no_cpus; |
| 14 | const TaskSet& tasks; | 14 | const TaskSet& tasks; |
| 15 | int rounds; | 15 | int rounds; |
| 16 | std::vector<double> S_i; | 16 | std::vector<fractional_t> S_i; |
| 17 | std::vector<double> G_i; | 17 | std::vector<fractional_t> G_i; |
| 18 | 18 | ||
| 19 | // For faster lookups, to avoid too many conversions. | 19 | // For faster lookups, to avoid too many conversions. |
| 20 | std::vector<double> utilizations; | 20 | std::vector<fractional_t> utilizations; |
| 21 | 21 | ||
| 22 | double compute_exact_s(double S, const std::vector<double>& Y_ints); | 22 | void compute_exact_s(const fractional_t& S, |
| 23 | double compute_binsearch_s(double S, const std::vector<double>& Y_ints); | 23 | const std::vector<fractional_t>& Y_ints, |
| 24 | fractional_t& s); | ||
| 25 | void compute_binsearch_s(const fractional_t& S, | ||
| 26 | const std::vector<fractional_t>& Y_ints, | ||
| 27 | fractional_t& s); | ||
| 24 | 28 | ||
| 25 | inline double compute_M(double s, double S, | 29 | inline bool M_lt_0(const fractional_t& s, const fractional_t& S, |
| 26 | const std::vector<double>& Y_ints); | 30 | const std::vector<fractional_t>& Y_ints); |
| 27 | 31 | ||
| 28 | // These are basically just structs that override operator< to allow | 32 | // These are basically just structs that override operator< to allow |
| 29 | // sort algorithms to work. | 33 | // sort algorithms to work. |
| @@ -31,8 +35,8 @@ class GELPl | |||
| 31 | public: | 35 | public: |
| 32 | unsigned int old_task; | 36 | unsigned int old_task; |
| 33 | unsigned int new_task; | 37 | unsigned int new_task; |
| 34 | double location; | 38 | fractional_t location; |
| 35 | double old_task_utilization; | 39 | fractional_t old_task_utilization; |
| 36 | 40 | ||
| 37 | bool operator<(const ReplacementType& other) const { | 41 | bool operator<(const ReplacementType& other) const { |
| 38 | return (location < other.location) | 42 | return (location < other.location) |
| @@ -44,7 +48,7 @@ class GELPl | |||
| 44 | class TaggedValue { | 48 | class TaggedValue { |
| 45 | public: | 49 | public: |
| 46 | unsigned int task; | 50 | unsigned int task; |
| 47 | double value; | 51 | fractional_t value; |
| 48 | 52 | ||
| 49 | //Order is reversed - we are going to want the largest, rather than the | 53 | //Order is reversed - we are going to want the largest, rather than the |
| 50 | //smallest, values. | 54 | //smallest, values. |
| @@ -68,12 +72,14 @@ class GELPl | |||
| 68 | return bounds[index]; | 72 | return bounds[index]; |
| 69 | } | 73 | } |
| 70 | 74 | ||
| 75 | // Converted to double for the sake of Python | ||
| 71 | double get_Si(unsigned int index) { | 76 | double get_Si(unsigned int index) { |
| 72 | return S_i[index]; | 77 | return S_i[index].get_d(); |
| 73 | } | 78 | } |
| 74 | 79 | ||
| 80 | // Converted to double for the sake of Python | ||
| 75 | double get_Gi(unsigned int index) { | 81 | double get_Gi(unsigned int index) { |
| 76 | return G_i[index]; | 82 | return G_i[index].get_d(); |
| 77 | } | 83 | } |
| 78 | }; | 84 | }; |
| 79 | 85 | ||
