当前位置: 首页>>代码示例>>C++>>正文


C++ TimeInterval::length方法代码示例

本文整理汇总了C++中TimeInterval::length方法的典型用法代码示例。如果您正苦于以下问题:C++ TimeInterval::length方法的具体用法?C++ TimeInterval::length怎么用?C++ TimeInterval::length使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TimeInterval的用法示例。


在下文中一共展示了TimeInterval::length方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: similar

void GroupableTimeSeriesSet::similar(GroupableTimeSeriesSet *other, int otherSeq, TimeInterval otherInt,
                                     SearchStrategy strat, int warps)
{
    if (!valid() || !other->valid()) {
        session->geterr() << "Warning: Attempted to find similarities using an invalid database." << endl;
        return;
    }

    if (grouping == NULL) {
        session->geterr() << "Warning: Attempted to find similarities on ungrouped dataset." << endl;
        return;
    }

    kBest best = grouping->getBestInterval(otherInt.length(),
                                           other->dataset->getRawData(otherSeq, otherInt.start),
                                           strat, warps);

    session->getout() << "Found most similar interval." << endl;
    session->getout() << "Sequence number and interval: " << best.seq << "@"
                      << "[" << best.interval.start << ", " << best.interval.end << "]." << endl;
    session->getout() << "Distance: " << best.dist << endl;
    if (verbosity > 0) {
        session->getout() << "Sequence: " << endl;
        dataset->printInterval(session->getout(), best.seq, best.interval);
    }
}
开发者ID:Samee-Swartz,项目名称:researchProjectWebapp,代码行数:26,代码来源:OnlineSession.cpp

示例2: returnSimilar

kBest GroupableTimeSeriesSet::returnSimilar(GroupableTimeSeriesSet *other, int otherSeq, TimeInterval otherInt,
                                     SearchStrategy strat, int warps)
{
    if (!valid() || !other->valid()) {
        session->geterr() << "Warning: Attempted to find similarities using an invalid database." << endl;
        return;
    }

    if (grouping == NULL) {
        session->geterr() << "Warning: Attempted to find similarities on ungrouped dataset." << endl;
        return;
    }

    return grouping->getBestInterval(otherInt.length(),
                                           other->dataset->getRawData(otherSeq, otherInt.start),
                                           strat, warps);

}
开发者ID:Samee-Swartz,项目名称:researchProjectWebapp,代码行数:18,代码来源:OnlineSession.cpp

示例3: kSimilar

void OnlineSession::kSimilar(int dbindex, vector<double> qdata, TimeInterval interval, int k, int strict)
{
    if (groupings[dbindex] == NULL)
        genGrouping(dbindex, defaultST);

    TimeSeriesGrouping *t = groupings[dbindex];

    int slen = dataSets[dbindex]->seqLength;
    int ilen = interval.length();

    TimeSeriesIntervalEnvelope eqdata(TimeSeriesInterval(qdata.data(), TimeInterval(0, qdata.size() - 1)));

    double gb;
    int bsfStart = 0, bsfEnd = 0, bsfIndex = -1;
    double bsf = INF;

    if (strict == 0) {
        for (int i = 0; i < slen; i++) {
            if (debug) {
                cout << "Searching groups from start=" << i << ", bsf=" << bsf << endl;
            }
            for (int j = i; j < slen; j++) {
                int k = t->groups[i * slen + j].getBestGroup(eqdata, &gb, bsf);
                if (k < 0)
                    continue;
                if (gb < bsf) {
                    bsf = gb;
                    bsfStart = i;
                    bsfEnd = j;
                    bsfIndex = k;
                }
            }
        }
    } else if (strict == 1) {
        for (int i = 0; i + ilen - 1 < slen; i++) {
            if (debug)
                cout << "Searching groups from start=" << i << endl;
            int j = i + (ilen - 1);
            int k = t->groups[i * slen + j].getBestGroup(eqdata, &gb, bsf);
            if (k < 0)
                continue;
            if (gb < bsf) {
                bsf = gb;
                bsfStart = i;
                bsfEnd = j;
                bsfIndex = k;
            }
        }
    } else {
        bsfStart = interval.start;
        bsfEnd = interval.end;
        bsfIndex = t->groups[bsfStart * slen + bsfEnd].getBestGroup(eqdata, &gb, bsf);
        if (bsfIndex >= 0)
            bsf = gb;
    }

    if (bsf == INF || bsfIndex < 0) {
        cerr << "kSimilar: Failed to find similar objects. No suitable candidate group centroids." << endl;
        return;
    }

    cout << "Found most similar interval and group: " << bsfIndex << "@"
         << "[" << bsfStart << "," << bsfEnd << "]" << endl;

    vector<kSim> sim = t->groups[bsfStart * slen + bsfEnd].groups[bsfIndex]->getSortedSimilar(eqdata, k);

    cout << "Discovered k similar points:" << endl;
    for (unsigned int i = 0; i < sim.size(); i++) {

        cout << "Series " << sim[i].index << ", interval [" << bsfStart << "," << bsfEnd
             << "] is at distance " << sim[i].distance << "." << endl;

        TimeSeriesInterval interval = (*t->groups[bsfStart * slen + bsfEnd].groups[bsfIndex]->slice)[sim[i].index];

        for (int j = 0; j < interval.length(); j++) {
            cout << interval[j] << " ";
        }
        cout << endl;
    }
}
开发者ID:rahsan,项目名称:ONEX-Code,代码行数:80,代码来源:OnlineSession.cpp


注:本文中的TimeInterval::length方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。