src/UCRDTW_memory_parallel.cpp
/// LB_Keogh 2: Create Envelop for the data
/// Note that the envelops have been created (in main function) when each data point has been read.
///
/// Variable Explanation,
/// tz: Z-normalized data
/// qo: sorted query
/// cb: (output) current bound at each position. Used later for early abandoning in DTW.
/// l,u: lower and upper envelop of the current data
LB_Keogh 2: Create Envelop for the data
Note that the envelops have been created (in main function) when each data point has been read.

Variable Explanation,
tz: Z-normalized data
qo: sorted query
cb: (output) current bound at each position. Used later for early abandoning in DTW.
l,u: lower and upper envelop of the current data
LB_Keogh 2 : Create Envelop for the data Note that the envelops have been created ( in main function ) when each data point has been read . Variable Explanation tz : Z - normalized data qo : sorted query cb : ( output ) current bound at each position . Used later for early abandoning in DTW . l u : lower and upper envelop of the current data
float lb_keogh_data_cumulative(int *order, float *tz, float *qo, float *cb, float *l, float *u, int len, float mean, float std, _Bool bNormalized, float best_so_far = FLT_MAX)
{
    float lb = 0;
    float uu, ll, d;
    for (int i = 0; i < len && lb < best_so_far; i++)
    {
        d = 0;
        if (bNormalized)
        {
            uu = (u[order[i]] - mean) / std;
            ll = (l[order[i]] - mean) / std;
            if (qo[i] > uu)
                d = dist(qo[i], uu);
            else
            {
                if (qo[i] < ll)
                    d = dist(qo[i], ll);
            }
        }
        else
        {
            if (qo[i] > u[order[i]])
                d = dist(qo[i], u[order[i]]);
            else
            {
                if (qo[i] < l[order[i]])
                    d = dist(qo[i], l[order[i]]);
            }
        }
        lb += d;
        cb[order[i]] = d;
    }
    return lb;
}
float lb_keogh_data_cumulative ( int * order , float * tz , float * qo , float * cb , float * l , float * u , int len , float mean , float std , _Bool bNormalized , float best_so_far = FLT_MAX ) { float lb = 0 ; float uu , ll , d ; for ( int i = 0 ; i < len && lb < best_so_far ; i ++ ) { d = 0 ; if ( bNormalized ) { uu = ( u [ order [ i ] ] - mean ) / std ; ll = ( l [ order [ i ] ] - mean ) / std ; if ( qo [ i ] > uu ) d = dist ( qo [ i ] , uu ) ; else { if ( qo [ i ] < ll ) d = dist ( qo [ i ] , ll ) ; } } else { if ( qo [ i ] > u [ order [ i ] ] ) d = dist ( qo [ i ] , u [ order [ i ] ] ) ; else { if ( qo [ i ] < l [ order [ i ] ] ) d = dist ( qo [ i ] , l [ order [ i ] ] ) ; } } lb += d ; cb [ order [ i ] ] = d ; } return lb ; }
LB_Keogh 2: Create Envelop for the data
Note that the envelops have been created (in main function) when each data point has been read.
LB_Keogh 2 : Create Envelop for the data Note that the envelops have been created ( in main function ) when each data point has been read .