Commit 53b145c6 authored by Florent Jacquemard's avatar Florent Jacquemard
Browse files

declaration enable_shared_from_this

Distance : type rtu_t
parent f30888a0
......@@ -41,7 +41,7 @@ namespace parsing{
/// It is partial otherwise.
/// param K = class of Key in parse table
template<class K>
class RunInner : public RunInnero, std::enable_shared_from_this<RunInner<K>>
class RunInner : public RunInnero, public std::enable_shared_from_this<RunInner<K>>
{
public:
......
......@@ -30,11 +30,11 @@ TropicalWeight(0)
{
size_t j = p->lfirst();
assert (j < s->size());
for(int i = 0; i < ll; i++)
for(size_t i = 0; i < ll; i++)
{
assert (p->rbegin() <= s->point(j).rdate());
assert (s->point(j).rdate() < p->rend());
double val1 = s->point(j).rdate() - p->rbegin();
rtu_t val1 = s->point(j).rdate() - p->rbegin();
if(s->offset(j))
{
val1 *= Weight::COEF_OFFSET_DIST_LEFT;
......@@ -57,7 +57,7 @@ TropicalWeight(0)
{
assert (p->rbegin() <= s->point(j).rdate());
assert (s->point(j).rdate() <= p->rend());
double val1 = p->rend() - s->point(j).rdate();
rtu_t val1 = p->rend() - s->point(j).rdate();
if(s->offset(j))
{
val1 *= Weight::COEF_OFFSET_DIST_RIGHT;
......@@ -86,15 +86,15 @@ TropicalWeight(0)
}
double Distance::distcoeff(const InputSegment* s, size_t j)
rtu_t Distance::distcoeff(const InputSegment* s, size_t j)
{
assert(s);
assert(s->size() != 0); // non empty input seg
assert(0 <= j);
assert(j < s->size());
// double distprev;
// double distnext;
// rtu_t distprev;
// rtu_t distnext;
//
// // singleton input segment
// if ((j == 0) && (j == s->size()-1))
......@@ -123,20 +123,20 @@ double Distance::distcoeff(const InputSegment* s, size_t j)
// assert(distprev + distnext != 0);
// return (distprev + distnext);
double d = (dist_prev(s, j) + dist_next(s, j));
rtu_t d = (dist_prev(s, j) + dist_next(s, j));
assert(d >= 0);
return (d == 0)?1:d;
}
// distance to closest point before j not at the same date as j
double Distance::dist_prev(const InputSegment* s, size_t j)
rtu_t Distance::dist_prev(const InputSegment* s, size_t j)
{
// assert(s);
// assert(0 <= j);
// assert(j < s->size());
double d;
rtu_t d;
size_t i = j;
for (d = 0; d == 0 && i > 0; i--)
......@@ -151,13 +151,13 @@ double Distance::dist_prev(const InputSegment* s, size_t j)
// distance to the closest point after j not at the same rdate as j
double Distance::dist_next(const InputSegment* s, size_t j)
rtu_t Distance::dist_next(const InputSegment* s, size_t j)
{
// assert(s);
// assert(0 <= j);
// assert(j < s->size());
double d;
rtu_t d;
size_t i = j;
if(s->onset(j)){
for (d = 0; d == 0 && i < s->size()-1; i++)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment