Skip to content

Commit e90e28c

Browse files
committed
Minor changes to docs and thread pool
1 parent eee9a6b commit e90e28c

File tree

3 files changed

+23
-22
lines changed

3 files changed

+23
-22
lines changed

docs/HTML/ExponentiallyWeightedMeanVisitor.html

+17-16
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,14 @@
4646
<td bgcolor="blue"> <font color="white">
4747
<PRE><B>
4848
enum class exponential_decay_spec : unsigned char {
49-
center_of_gravity = 1, // Decay = 1 / (1 + value) For value >= 0
50-
span = 2, // Decay = 2 / (1 + value) For value >= 1
51-
halflife = 3, // Decay = 1 - e<sup>log(0.5)/value</sup> For value > 0
52-
fixed = 4, // Decay = value For 0 < value <= 1
49+
center_of_gravity = 1, // Decay = 1 / (1 + &alpha;) For &alpha; >= 0
50+
span = 2, // Decay = 2 / (1 + &alpha;) For &alpha; >= 1
51+
halflife = 3, // Decay = 1 - e<sup>log(0.5)/&alpha; </sup> For &alpha; > 0
52+
fixed = 4, // Decay = &alpha; For 0 < &alpha; <= 1
5353
};</B></PRE></font>
5454
</td>
5555
<td>
56-
This spec determines how an exponentially moving stat decays. Based on this spec, the value parameter is converted to decay.
56+
This spec determines how an exponentially moving stat decays. Based on this spec, the value (&alpha;) parameter is converted to decay.
5757
</td>
5858
</tr>
5959

@@ -91,17 +91,18 @@
9191
</PRE></I>
9292
Formula if finite_adjust is true:<BR>
9393
<I><PRE>
94-
X<SUB>t</SUB> + (1 - decay) * X<SUB>t-1</SUB> + (1 - decay)<SUP>2</SUP> * X<SUB>t-2</SUB> + ... + (1 - decay)<SUP>t</SUP> * X<SUB>0</SUB>
95-
Y<SUB>t</SUB> = ------------------------------------------------------------------------
96-
1 + (1 - decay) + (1 - decay)<SUP>2</SUP> + ... + (1 - decay)<SUP>t</SUP>
94+
X<SUB>t</SUB>+(1-decay)*X<SUB>t-1</SUB>+(1-decay)<SUP>2</SUP>*X<SUB>t-2</SUB>+ ... +(1-decay)<SUP>t</SUP>*X<SUB>0</SUB>
95+
Y<SUB>t</SUB> = ------------------------------------------------------
96+
1+(1-decay)+(1-decay)<SUP>2</SUP>+ ... +(1-decay)<SUP>t</SUP>
9797
</PRE></I>
9898
Constructor:<BR>
9999
<I>
100100
<PRE>
101101
ExponentiallyWeightedMeanVisitor(
102102
exponential_decay_spec eds, // See exponential_decay_spec type
103-
double value, // Value to be decayed
104-
bool finite_adjust = false); // Adjust for the fact that this is not an infinite data set
103+
double value, // Value (&alpha;) to be decayed
104+
bool finite_adjust = false); // Adjust for the fact that this
105+
// is not an infinite data set
105106
</PRE>
106107
</I>
107108
</td>
@@ -135,8 +136,8 @@
135136
<I>
136137
<PRE>
137138
ExponentiallyWeightedVarVisitor(
138-
exponential_decay_spec eds, // See exponential_decay_spec type
139-
double value); // Value to be decayed
139+
exponential_decay_spec eds, // See exponential_decay_spec type
140+
double value); // Value (&alpha;) to be decayed
140141
</PRE>
141142
</I>
142143
</td>
@@ -170,8 +171,8 @@
170171
<I>
171172
<PRE>
172173
ExponentiallyWeightedCovVisitor(
173-
exponential_decay_spec eds, // See exponential_decay_spec type
174-
double value); // Value to be decayed
174+
exponential_decay_spec eds, // See exponential_decay_spec type
175+
double value); // Value (&alpha;) to be decayed
175176
</PRE>
176177
</I>
177178
</td width="30%">
@@ -205,8 +206,8 @@
205206
<I>
206207
<PRE>
207208
ExponentiallyWeightedCorrVisitor(
208-
exponential_decay_spec eds, // See exponential_decay_spec type
209-
double value); // Value to be decayed
209+
exponential_decay_spec eds, // See exponential_decay_spec type
210+
double value); // Value (&alpha;) to be decayed
210211
</PRE>
211212
</I>
212213
</td>

include/DataFrame/Utils/Threads/ThreadPool.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ class ThreadPool {
116116

117117
template<std::random_access_iterator I, long TH = 50'000L>
118118
void parallel_sort(const I begin, const I end);
119-
template<std::random_access_iterator I, typename P, long TH = 25'000L>
119+
template<std::random_access_iterator I, typename P, long TH = 50'000L>
120120
void parallel_sort(const I begin, const I end, P compare);
121121

122122
// If the pool is not shutdown and there is a pending task, run the one

include/DataFrame/Utils/Threads/ThreadPool.tcc

+5-5
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ ThreadPool::add_thread(size_type thr_num) {
7373
if (shutys > capacity_threads()) {
7474
char err[1024];
7575

76-
::snprintf(err, 1023,
76+
::snprintf(err, sizeof(err) - 1,
7777
"ThreadPool::add_thread(): Cannot subtract "
7878
"'%ld' threads from the pool with capacity '%ld'",
7979
shutys, capacity_threads());
@@ -167,7 +167,7 @@ ThreadPool::parallel_loop(I begin, I end, F &&routine, As && ... args) {
167167
ret.reserve(n);
168168
for (size_type i = 0; i < n; ++i)
169169
ret.emplace_back(dispatch(false,
170-
routine,
170+
std::forward<F>(routine),
171171
begin + i,
172172
begin + (i + 1),
173173
std::forward<As>(args) ...));
@@ -180,7 +180,7 @@ ThreadPool::parallel_loop(I begin, I end, F &&routine, As && ... args) {
180180
};
181181

182182
ret.emplace_back(dispatch(false,
183-
routine,
183+
std::forward<F>(routine),
184184
begin + i,
185185
begin + block_end,
186186
std::forward<As>(args) ...));
@@ -220,7 +220,7 @@ ThreadPool::parallel_loop2(I1 begin1, I1 end1, I2 begin2, I2 end2,
220220
ret.reserve(n);
221221
for (size_type i = 0; i < n; ++i)
222222
ret.emplace_back(dispatch(false,
223-
routine,
223+
std::forward<F>(routine),
224224
begin1 + i,
225225
begin1 + (i + 1),
226226
begin2 + i,
@@ -234,7 +234,7 @@ ThreadPool::parallel_loop2(I1 begin1, I1 end1, I2 begin2, I2 end2,
234234
};
235235

236236
ret.emplace_back(dispatch(false,
237-
routine,
237+
std::forward<F>(routine),
238238
begin1 + i,
239239
begin1 + block_end,
240240
begin2 + i,

0 commit comments

Comments
 (0)