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


C++ DistanceMatrix::addElement方法代码示例

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


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

示例1: testUpdateDistanceMatrix

    void testUpdateDistanceMatrix() 
	{

        PeakListCollection PLC = SamplePeakListCollection();

        DistanceMatrix DM = PLC.buildDistanceMatrix_(200., 0.5, 0, 0.);
        DistanceMatrix Ref = PLC.buildDistanceMatrix_(200., 0.5, 0, 0.);

        DM.addElement(99.); //Add a dummy element, we will delete it again

        unsigned int merged_lower = 4; //last two elements
        unsigned int merged_upper = 5;

        PLC.plContent_.clear();
        PLC.plContent_.resize(6,1);

        PLC.updateDistanceMatrix_(DM, merged_lower, merged_upper, 200., 0.5, 0, 0.);

        //Size should still be 5
        shouldEqual((int)DM.size(),5);

        //Matrix should be the same as the original matrix Ref
        for(unsigned int i = 0; i < 5; i++){
            for(unsigned int j = 0; j < i; j++){
                shouldEqualTolerance(DM(i,j),Ref(i,j),TOL);
            }
        }

        return;
    }
开发者ID:CanaanShen,项目名称:HDP-Align,代码行数:30,代码来源:PeakListCollection-test.cpp

示例2: buildDistanceMatrix_

    //build a distance matrix out of all PeakLists
    DistanceMatrix PeakListCollection::buildDistanceMatrix_(double drt, double dmz, double dz, double dint = 0.)
    {
        //number of Peaklists
        unsigned int numPl = c_.size();

        DistanceMatrix DM;
        //Add new elements to the Distance Matrix
        for(unsigned int i = 0; i<numPl; i++){
            DM.addElement();
            //Calculate distance to the other elements / the cost of merging them
            for(unsigned int j = 0; j<i; j++){
                StableMarriage sm(c_[i],c_[j],drt,dmz,dz,dint);
                sm.setLimit(1.);
                DM(i,j) = sm.getCost();
            }
        }

        return DM;
    }
开发者ID:hroest,项目名称:sima,代码行数:20,代码来源:PeakListCollection.cpp

示例3: updateDistanceMatrix_

    //Update the Distance Matrix
    void PeakListCollection::updateDistanceMatrix_(DistanceMatrix& D, unsigned int merged_lower, unsigned int merged_upper,
                                                   double drt, double dmz, double dz, double dint = 0.)
    {

        //remove distances of merged PeakLists from distance matrix
        D.deleteElement(merged_upper);
        D.deleteElement(merged_lower);

        //add a new column for the merged PeakList
        D.addElement();

        //fill distances
        unsigned int sz = D.size();
        for(unsigned int i = 0; i<sz-1; i++){
            StableMarriage sm(c_[i],c_[sz-1],drt,dmz,dz,dint);
            sm.setLimit(1.);
            D(i,sz-1) = sm.getCost();
        }

        return;
    }
开发者ID:hroest,项目名称:sima,代码行数:22,代码来源:PeakListCollection.cpp


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