Ejemplo n.º 1
0
inline
void
VectorDBase<T>::assignT(T v, const IndexSet& is)
{
    for (typename IndexSet::Iter i = is.begin(); i != is.end(); ++i) {
        start[i] = v;
    } 
}
Ejemplo n.º 2
0
inline
void
VectorDBase<T>::assign(const VectorDBase<T>& v1, const IndexSet& is)
{
    assert(v1.get_size() == is.get_size());
    assert(get_size() == is.count());
    T* i = start;
    for (typename IndexSet::Iter i1 = is.begin(); i1 != is.end(); ++i1) {
        *i = v1[i1]; ++i;
    } 
}
Ejemplo n.º 3
0
void
LocalViewSelection::replaceViews(IndexSet const & toBeReplaced)
{
    IndexSet::const_iterator tbr = toBeReplaced.begin();
    while (tbr != toBeReplaced.end()) {
        available[*tbr] = false;
        selected.erase(*tbr);
        ++tbr;
    }
    success = false;
    performVS();
}
Ejemplo n.º 4
0
void CombinedProfile::printDrift(const CombinedProfile& other,
                                 llvm::raw_ostream& stream) const
{

    // build union of non-zero histograms
    IndexSet I;

    for(unsigned i = 0, E = size(); i < E; ++i)
        if( (_histograms[i] != NULL) && _histograms[i]->nonZero() )
            I.insert(i);

    for(unsigned i = 0, E = other.size(); i < E; ++i)
        if( (other._histograms[i] != NULL) && other._histograms[i]->nonZero() )
            I.insert(i);

    if(I.size() == 0)
        errs() << "Warning: no histograms\n";

    // Compute and print drift
    stream << "#" << getNameStr() << "Index\t0-out\t0-in\n";
    for(IndexSet::iterator i = I.begin(), E = I.end(); i != E; ++i)
    {
        // check for 0-overlap (100% drift) cases
        if( (*i > size()) || (*i > other.size())
                || (_histograms[*i] == NULL) || (other._histograms[*i] == NULL)
                || !_histograms[*i]->nonZero() || !other._histograms[*i]->nonZero() )
        {
            errs() << "Warning: histogram " << *i << " only exists in one profile!\n";
            stream << *i << "\t1.0\t1.0\n";
            continue;
        }

        CPHistogram* h1 = _histograms[*i];
        CPHistogram* h2 = other._histograms[*i];

        if( h1->isPoint() && h2->isPoint() && (h1->min() != h2->min()))
        {
            errs() << "Warning: histogram " << *i << " has different point values\n";
            stream << *i << "\t1.0\t1.0\n";
            continue;
        }

        // finally, no exceptional situations!
        stream << *i << "\t" << 1-h1->overlap(*h2, false) << "\t"
               << 1-h1->overlap(*h2, true) << "\n";

    }
}
Ejemplo n.º 5
0
MVS_NAMESPACE_BEGIN

LocalViewSelection::LocalViewSelection(
    SingleViewPtrList const& views,
    Settings const& settings,
    IndexSet const& globalViewIDs,
    IndexSet const& propagated,
    PatchSampler::Ptr sampler)
    :
    ViewSelection(settings),
    success(false),
    views(views),
    sampler(sampler)
{
    // inherited attribute
    this->selected = propagated;

    if (!sampler->success[settings.refViewNr]) {
        return;
    }
    if (selected.size() == settings.nrReconNeighbors)
        success = true;
    else if (selected.size() > settings.nrReconNeighbors) {
        std::cerr << "ERROR: Too many local neighbors propagated!" << std::endl;
        selected.clear();
    }

    available.clear();
    available.resize(views.size(), false);
    IndexSet::const_iterator id;
    for (id = globalViewIDs.begin(); id != globalViewIDs.end(); ++id) {
        available[*id] = true;
    }
    IndexSet::const_iterator sel;
    for (sel = selected.begin(); sel != selected.end(); ++sel) {
        available[*sel] = false;
    }
}