Esempio n. 1
0
BOOL PageReliefTrans::OnInitDialog() 
{
	PageTrans::OnInitDialog();
	
	// TODO: Add extra initialization here
	m_dlgSpecial.Create(IDD_TWOSPECIAL,this);
	Combine(this,m_Box1,m_dlgSpecial);
	m_dlgInitTrans.ShowWindow(SW_HIDE);
	m_dlgTransData.ChangeName();
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}
Esempio n. 2
0
void MergeSort(LinkedList* list, int (*comparator)(void* left, void* right))
{
  int size = LLSize(list);
  if ( size > 1 )
  {
    int middle = size / 2;
    LinkedList* spliced = LLSplice(list, middle);
    MergeSort(list, comparator);
    MergeSort(spliced, comparator);
    Combine(list, spliced, comparator);
    LLDestroy(spliced);
  }
}
Esempio n. 3
0
BOOL PageReliefModel::OnInitDialog()
{
    BaseDlg::OnInitDialog();

    // TODO: Add extra initialization here
    m_dlgBasisArea.Create(IDD_DLGBASISAREA,this);
    Combine(this,m_Box,m_dlgBasisArea);
    m_tab1.AddPage(_T("图表"),&m_page1,IDD_PAGECHART);
    m_tab1.Show();
    UpdateData(FALSE);
    return TRUE;  // return TRUE unless you set the focus to a control
    // EXCEPTION: OCX Property Pages should return FALSE
}
Esempio n. 4
0
gbool GUrlCache::GetUmelUrl(const char *url, CString &srcFilePath,GFileInfo &info, gbool &isFile)
{
    CString relFilePath,absFilePath;

    // get relative path

    //if (striprefix(url,G_URN_UMEL))

    relFilePath=url;
    srcFilePath = relFilePath;

    // check UMEL writeMediaCacheDir directory

    if (writeMediaCacheDirValid) {
        if (Combine(writeMediaCacheDir,relFilePath,absFilePath) && (Exists(absFilePath,&info))) {
            srcFilePath = absFilePath;
            isFile = TRUE;
            return TRUE;
        }
    }

    // check readonly  UMEL directory

    for (int i=0; i<umelCacheDirs.GetSize(); i++) {
        const CString &dir = umelCacheDirs.ElementAt(i);

        if (Combine(dir,relFilePath,absFilePath) && (Exists(absFilePath,&info))) {
            srcFilePath = absFilePath;
            isFile = TRUE;

            return TRUE;
        }

    }

    return FALSE;

}
Esempio n. 5
0
GmDirEntryNode::GmDirEntryNode (GmDirectoryNode<GmLeafNode> * pDirNode
								, GmUifSourceEntry * pSource
								, GmRestoreNode * pParent)
								: _pParent (pParent)
								, _pSource (pSource)
								, _pDirNode (pDirNode)
{
	assert (pDirNode);
	assert (pParent);
	assert (pSource);

	int iNodeType = _pParent->getType ();

	if (iNodeType == GNT_DIR)
		_prefixPath = Combine (((GmDirEntryNode*)_pParent)->_prefixPath, _pParent->getName ());
}
Esempio n. 6
0
wxString GmSrcEntryNode::getName (void)
{
	ubyte2 iSourceType = _pSource->sourceType;
	wxString szName;

	if (iSourceType == (ubyte2)FST_DIR_SOURCE)
		szName = ToWxString (_pSource->absolutePath);
	else if (iSourceType == (ubyte2)FST_FILE_SOURCE) {
		wxString path = ToWxString (_pSource->absolutePath);
		wxString file = ToWxString (_pSource->sourceFileName);
		szName = Combine (path, file);
	}
	else
		assert (false);

	return szName;
}
Esempio n. 7
0
//Ham tim to hop cua tap szX
void Combine(CString szX, CString s, int k,CStringArray& aszC)
{
    if(szX.GetLength() > 12)
    {
        AfxMessageBox("So to hop qua lon",MB_OK);
        szX = szX.Left(12);
    }

    int i,j;
    CStringArray  aszTemp;
    for(i=k; i<szX.GetLength(); i++)
    {
        aszTemp.Add(s + szX[i]);
        aszC.Add(Union(s , szX[i]));
    }
    k++;
    for(j=0; j<aszTemp.GetSize(); j++)
        Combine(szX,aszTemp[j],j+k,aszC);
}
Esempio n. 8
0
void Combine(CStringArray& aszX, CString s, int k,CStringArray& aszC)
{
    if(aszX.GetSize() > 10)
    {
        AfxMessageBox("So to hop qua lon",MB_OK);
        aszX.SetSize(10);
    }

    int i,j;
    CStringArray  aszTemp;
    for(i=k; i<aszX.GetSize(); i++)
    {
        aszTemp.Add(s + aszX[i]);
        aszC.Add(Union(s , aszX[i]));
    }
    k++;
    for(j=0; j<aszTemp.GetSize(); j++)
        Combine(aszX,aszTemp[j],j+k,aszC);
}
Esempio n. 9
0
void main()
{
	T_DATA_SET slist[3];
	int set0[2] = {1, 2};
	int set1[5] = {4, 5, 6, 7, 8};	
	int set2[2] = {7, 8};
	slist[0].set = set0;
	slist[0].size = 2;
	slist[1].set = set1;
	slist[1].size = 5;
	slist[2].set = set2;
	slist[2].size = 2;
	
	Product(slist, 3);

	printf("******\n");

	Combine(set1, 5, 3);
}
Esempio n. 10
0
void MixMod::Compute(int * NUMK, double * LL, double * P, double * T, double * COMP_VAR)
{ 
 int numk,i;
// MessageBox (0, "0", "START", MB_ICONINFORMATION);
 Grid();   // construct grid of potential subpopulation means 
 CalcMat(); // calculation of mxing kernel density
 vem();   // VEM algorithm
 Update(); // Find subpoplations with positve weight, i.e. p > 0.01
 EM(numstep); // refiend soultion with EM algorithm

 numk=Combine(); // final solution: combine close components
 if (dens==0) COMP_VAR[0] = compvar;
 NUMK[0] = numk;
 LL[0] = ll;
 for(i=0;i<numk;i++){
 P[i] = p[i];
 T[i] = t[i];      
 }
 
}
Esempio n. 11
0
static void ShouldCutAndPaste()
{
	auto text = L"one\ntwo\nthree";
	auto expected = L"one\none\ntwo\nthreetwo\nthree";

	document doc(null_view, text);

	{
		undo_group ug(doc);
		auto copy = Combine(doc.text());
		doc.insert_text(ug, text_location(0, 1), copy);
		should::Equal(expected, doc.str());
	}

	doc.undo();
	should::Equal(text, doc.str(), L"undo");

	doc.redo();
	should::Equal(expected, doc.str(), L"redo");
}
void FEventGraphSample::Combine_Recurrent( const FEventGraphSamplePtr& Other )
{
	Combine( Other );

	// Check other children.
	for( int32 ChildIndex = 0; ChildIndex < Other->_ChildrenPtr.Num(); ++ChildIndex )
	{
		const FEventGraphSamplePtr& OtherChild = Other->_ChildrenPtr[ChildIndex];
		FEventGraphSamplePtr ThisChild = FindChildPtr( OtherChild );

		if( ThisChild.IsValid() )
		{
			ThisChild->Combine_Recurrent( OtherChild );
		}
		else
		{
			AddChildAndSetParentPtr( OtherChild->DuplicateWithHierarchyPtr() );
		}
	}
}
Esempio n. 13
0
//Calculate the bonetransforms
void MeshAnimator::Update(const tt::GameContext& context)
{
	float currentTick = context.GameTimer.GetTotalSeconds() * m_CurrentClip.KeysPerSecond;
	
	//Get remainder of currentTick and clipDuration
	float clipDuration = (m_CurrentClip.Keys.end()-1)->KeyTime - m_CurrentClip.Keys.begin()->KeyTime;
	float targetTick = currentTick - ((int)(currentTick/clipDuration)) * clipDuration;
	
	//Get animation tick after target tick
	auto itNextTick = find_if(m_CurrentClip.Keys.begin(), m_CurrentClip.Keys.end(), [=](const AnimationKey& thisKey){
		return thisKey.KeyTime > targetTick;
	});

	//Get animation tick before target tick
	std::vector<AnimationKey>::iterator itPrevTick;
	if(itNextTick == m_CurrentClip.Keys.end())
		MyServiceLocator::GetInstance()->GetService<DebugService>()->Log(_T("Failed to find next animation tick."), LogLevel::Error);
	else if(itNextTick == m_CurrentClip.Keys.begin())
		itPrevTick = m_CurrentClip.Keys.end()-1;
	else 
		itPrevTick = itNextTick - 1;

	//Lerp between transformations of previous and next animation tick
	float blendFactor = (targetTick - itPrevTick->KeyTime) / (itNextTick->KeyTime - itPrevTick->KeyTime);
	
	m_BoneTransforms.resize(itPrevTick->BoneTransforms.size());
	m_DualQuats.resize(m_BoneTransforms.size());

	for(UINT i = 0; i < itPrevTick->BoneTransforms.size(); ++i)
	{		
		tt::DualQuaternion bindposeInv = tt::DualQuaternion::Inverse(m_pModel->m_Skeleton[i].BindPose)*-1;
	
		auto trans1 = itPrevTick->BoneTransforms[i];
		auto trans2 = itNextTick->BoneTransforms[i];
	
		auto dlb = tt::DualQuaternion::DLB(trans1, trans2, blendFactor);
		
		m_DualQuats[i] = Combine(bindposeInv, dlb);
	}
		
}
Esempio n. 14
0
Transformation3d :: 
Transformation3d (const Point3d & c, double alpha, 
		  double beta, double gamma)
{
  // total = T_c x Rot_0 x T_c^{-1}
  // Use Euler angles, see many books from tech mech, e.g. 
  // Shabana "multibody systems"

  Transformation3d tc(c);
  Transformation3d tcinv;
  tc.CalcInverse (tcinv);

  Transformation3d r1, r2, r3, ht, ht2;
  r1.SetAxisRotation (3, alpha);
  r2.SetAxisRotation (1, beta);
  r3.SetAxisRotation (3, gamma);

  ht.Combine (tc, r3);
  ht2.Combine (ht, r2);
  ht.Combine (ht2, r1);
  Combine (ht, tcinv);
}
Esempio n. 15
0
void main()

{
SqList la,lb,lc,ld;
int i,j;
Elemtype e;
 InitList_Sq(la);
CreateList(la);
print(la);
printf("请输入要查找的元素:\n");
scanf("%d",&e);
j=location(la,e);
printf("该元素的位置为%d\n",j);

printf("请输入要插入的位置和元素:\n");
scanf("%d%d",&i,&e);

ListInsert_Sq(la,i,e);
printf("输出插入后的顺序表:\n");
print(la);
printf("请输入要删除的位置:\n");
scanf("%d",&i);
ListDelect_Sq(la,i,e);
printf("删除的那个元素是:%d\n",e);
printf("输出删除后的顺序表:\n");
print(la);
InitList_Sq(lb);
CreateList(lb);
print(lb);
InitList_Sq(lc);
CreateList(lc);
print(lc);
InitList_Sq(ld);
Combine(lb,lc,ld);
printf("合并后的顺序表为:\n");
print(ld);

}
Esempio n. 16
0
static  void    FindPhrases( void )
//=================================
{
    msg_list    *msg;
    msg_word    *word;
    word_list   *w1;
    word_list   *w2;

    for( msg = HeadMsg; (word = msg->msg) != NULL; msg = msg->link ) {
        while( word != NULL ) {
            w1 = word->word;
            if( word->link == NULL )
                break;
            w2 = word->link->word;
            if( ( w1 != w2 ) &&
                ( w1->ref_count == w2->ref_count ) &&
                ( PhraseCount( msg, word, w1, w2 ) == w1->ref_count ) ) {
                Combine( w1, w2 );
            } else {
                word = word->link;
            }
        }
    }
}
Esempio n. 17
0
String Path::ChangeExtension(RCString path, RCString ext) {
	return Combine(GetDirectoryName(path), GetFileNameWithoutExtension(path) + ext);
}
///////////////////////////////////////////////////////////////////////////////////////////
// Build()
//
// Builds a strip forward as far as we can go, then builds backwards, and joins the two lists
//
void NvStripInfo::Build(NvEdgeInfoVec &edgeInfos, NvFaceInfoVec &faceInfos)
{
	// used in building the strips forward and backward
	WordVec scratchIndices;
	
	// build forward... start with the initial face
	NvFaceInfoVec forwardFaces, backwardFaces;
	forwardFaces.push_back(m_startInfo.m_startFace);

	MarkTriangle(m_startInfo.m_startFace);
	
	int v0 = (m_startInfo.m_toV1 ? m_startInfo.m_startEdge->m_v0 : m_startInfo.m_startEdge->m_v1);
	int v1 = (m_startInfo.m_toV1 ? m_startInfo.m_startEdge->m_v1 : m_startInfo.m_startEdge->m_v0);
	
	// easiest way to get v2 is to use this function which requires the
	// other indices to already be in the list.
	scratchIndices.push_back(v0);
	scratchIndices.push_back(v1);
	int v2 = NvStripifier::GetNextIndex(scratchIndices, m_startInfo.m_startFace);
	scratchIndices.push_back(v2);

	//
	// build the forward list
	//
	int nv0 = v1;
	int nv1 = v2;

	NvFaceInfo *nextFace = NvStripifier::FindOtherFace(edgeInfos, nv0, nv1, m_startInfo.m_startFace);
	while (nextFace != NULL && !IsMarked(nextFace))
	{
		//check to see if this next face is going to cause us to die soon
		int testnv0 = nv1;
		int testnv1 = NvStripifier::GetNextIndex(scratchIndices, nextFace);
		
		NvFaceInfo* nextNextFace = NvStripifier::FindOtherFace(edgeInfos, testnv0, testnv1, nextFace);

		if( (nextNextFace == NULL) || (IsMarked(nextNextFace)) )
		{
			//uh, oh, we're following a dead end, try swapping
			NvFaceInfo* testNextFace = NvStripifier::FindOtherFace(edgeInfos, nv0, testnv1, nextFace);

			if( ((testNextFace != NULL) && !IsMarked(testNextFace)) )
			{
				//we only swap if it buys us something
				
				//add a "fake" degenerate face
				NvFaceInfo* tempFace = new NvFaceInfo(nv0, nv1, nv0, true);
				
				forwardFaces.push_back(tempFace);
				MarkTriangle(tempFace);

				scratchIndices.push_back(nv0);
				testnv0 = nv0;

				++m_numDegenerates;
			}

		}

		// add this to the strip
		forwardFaces.push_back(nextFace);

		MarkTriangle(nextFace);
		
		// add the index
		//nv0 = nv1;
		//nv1 = NvStripifier::GetNextIndex(scratchIndices, nextFace);
		scratchIndices.push_back(testnv1);
		
		// and get the next face
		nv0 = testnv0;
		nv1 = testnv1;

		nextFace = NvStripifier::FindOtherFace(edgeInfos, nv0, nv1, nextFace);
	
	}
	
	// tempAllFaces is going to be forwardFaces + backwardFaces
	// it's used for Unique()
	NvFaceInfoVec tempAllFaces;
	for(size_t i = 0; i < forwardFaces.size(); i++)
		tempAllFaces.push_back(forwardFaces[i]);

	//
	// reset the indices for building the strip backwards and do so
	//
	scratchIndices.resize(0);
	scratchIndices.push_back(v2);
	scratchIndices.push_back(v1);
	scratchIndices.push_back(v0);
	nv0 = v1;
	nv1 = v0;
	nextFace = NvStripifier::FindOtherFace(edgeInfos, nv0, nv1, m_startInfo.m_startFace);
	while (nextFace != NULL && !IsMarked(nextFace))
	{
		//this tests to see if a face is "unique", meaning that its vertices aren't already in the list
		// so, strips which "wrap-around" are not allowed
		if(!Unique(tempAllFaces, nextFace))
			break;

		//check to see if this next face is going to cause us to die soon
		int testnv0 = nv1;
		int testnv1 = NvStripifier::GetNextIndex(scratchIndices, nextFace);
		
		NvFaceInfo* nextNextFace = NvStripifier::FindOtherFace(edgeInfos, testnv0, testnv1, nextFace);

		if( (nextNextFace == NULL) || (IsMarked(nextNextFace)) )
		{
			//uh, oh, we're following a dead end, try swapping
			NvFaceInfo* testNextFace = NvStripifier::FindOtherFace(edgeInfos, nv0, testnv1, nextFace);
			if( ((testNextFace != NULL) && !IsMarked(testNextFace)) )
			{
				//we only swap if it buys us something
				
				//add a "fake" degenerate face
				NvFaceInfo* tempFace = new NvFaceInfo(nv0, nv1, nv0, true);

				backwardFaces.push_back(tempFace);
				MarkTriangle(tempFace);
				scratchIndices.push_back(nv0);
				testnv0 = nv0;

				++m_numDegenerates;
			}
				
		}

		// add this to the strip
		backwardFaces.push_back(nextFace);
		
		//this is just so Unique() will work
		tempAllFaces.push_back(nextFace);

		MarkTriangle(nextFace);
		
		// add the index
		//nv0 = nv1;
		//nv1 = NvStripifier::GetNextIndex(scratchIndices, nextFace);
		scratchIndices.push_back(testnv1);
		
		// and get the next face
		nv0 = testnv0;
		nv1 = testnv1;
		nextFace = NvStripifier::FindOtherFace(edgeInfos, nv0, nv1, nextFace);
	}
	
	// Combine the forward and backwards stripification lists and put into our own face vector
	Combine(forwardFaces, backwardFaces);
}
Esempio n. 19
0
}

typedef FastNlMeansDenoisingTestBase FastNlMeansDenoisingColored;

OCL_TEST_P(FastNlMeansDenoisingColored, Mat)
{
    for (int j = 0; j < test_loop_times; j++)
    {
        generateTestData();

        OCL_OFF(cv::fastNlMeansDenoisingColored(src_roi, dst_roi, h[0], h[0], templateWindowSize, searchWindowSize));
        OCL_ON(cv::fastNlMeansDenoisingColored(usrc_roi, udst_roi, h[0], h[0], templateWindowSize, searchWindowSize));

        OCL_EXPECT_MATS_NEAR(dst, 1);
    }
}

OCL_INSTANTIATE_TEST_CASE_P(Photo, FastNlMeansDenoising,
                            Combine(Values(1, 2, 3, 4), Values((int)NORM_L2, (int)NORM_L1),
                                    Bool(), Values(true)));
OCL_INSTANTIATE_TEST_CASE_P(Photo, FastNlMeansDenoising_hsep,
                            Combine(Values(1, 2, 3, 4), Values((int)NORM_L2, (int)NORM_L1),
                                    Bool(), Values(true)));
OCL_INSTANTIATE_TEST_CASE_P(Photo, FastNlMeansDenoisingColored,
                            Combine(Values(3, 4), Values((int)NORM_L2), Bool(), Values(false)));

}
} // namespace cvtest::ocl

#endif // HAVE_OPENCL
Esempio n. 20
0
void wDocument::AscMemberSingle(wAscBuffer *buffer,sBool allowpif)
{
    if(Scan->IfName("pif"))
    {
        if(!allowpif)
            Scan->Error("pifs are not allowed in this type");
        Scan->Match('(');
        wPredicate *pred = _Predicate();
        Scan->Match(')');
        wPredicate *old = Predicate;
        Predicate = Combine(pred,old);
        AscMemberBlock(buffer,allowpif);
        if(Scan->IfName("pelse"))
        {
            Predicate = Combine(Negate(pred),old);
            AscMemberBlock(buffer,allowpif);
        }
        Predicate = old;
    }
    else
    {
        wAscMember *mem = new wAscMember();
        wAscType *type = new wAscType();

moreflags:
        if(Scan->Token==TokExtern)
        {
            Scan->Scan();
            mem->Flags |= wMF_Extern;
            goto moreflags;
        }
        if(Scan->Token==TokStatic)
        {
            Scan->Scan();
            mem->Flags |= wMF_Static;
            goto moreflags;
        }
        if(Scan->Token==TokUniform)
        {
            Scan->Scan();
            mem->Flags |= wMF_Uniform;
            goto moreflags;
        }
        if(Scan->Token==TokVolatile)
        {
            Scan->Scan();
            mem->Flags |= wMF_Volatile;
            goto moreflags;
        }
        if(Scan->Token==sTOK_Name && Scan->Name=="nointerpolation")
        {
            Scan->Scan();
            mem->Flags |= wMF_NoInterpolation;
            goto moreflags;
        }
        if(Scan->Token==sTOK_Name && Scan->Name=="precise")
        {
            Scan->Scan();
            mem->Flags |= wMF_Precise;
            goto moreflags;
        }
        if(Scan->Token==sTOK_Name && Scan->Name=="groupshared")
        {
            Scan->Scan();
            mem->Flags |= wMF_GroupShared;
            goto moreflags;
        }
        if(Scan->Token==sTOK_Name && Scan->Name=="shared")
        {
            Scan->Scan();
            mem->Flags |= wMF_Shared;
            goto moreflags;
        }


        if(Scan->IfName("row_major"))
        {
        }
        else if(Scan->IfName("column_major"))
        {
            type->ColumnMajor = 1;
        }

        sString<64> tname;
        Scan->ScanName(tname);

        sInt len = sGetStringLen(tname);
        if(len>0 && tname[len-1]>='1' && tname[len-1]<='4')
        {
            type->Columns = tname[len-1]-'0';
            len--;
            if(len>1 && tname[len-1]=='x' && tname[len-2]>='1' && tname[len-2]<='4')
            {
                type->Rows = tname[len-2]-'0';
                len-=2;
            }
            tname[len] = 0;
        }

        if(tname=="bool") type->Base = wTB_Bool;
        else if(tname=="int") type->Base = wTB_Int;
        else if(tname=="uint") type->Base = wTB_UInt;
        else if(tname=="float") type->Base = wTB_Float;
        else if(tname=="double") type->Base = wTB_Double;
        else if(tname=="min16float") type->Base = wTB_Min16Float;
        else if(tname=="min10float") type->Base = wTB_Min10Float;
        else if(tname=="min16int") type->Base = wTB_Min16Int;
        else if(tname=="min12int") type->Base = wTB_Min12Int;
        else if(tname=="min16uint") type->Base = wTB_Min16UInt;
        else Scan->Error("unknown type %q",tname);

        mem->Name = Scan->ScanName();
        mem->Type = type;
        mem->Predicate = Predicate;

        if(Scan->IfToken('['))
        {
            type->Array = Scan->ScanInt();
            Scan->Match(']');
        }

        if(Scan->IfToken(':'))
            mem->Binding = Scan->ScanName();

        Scan->Match(';');

        buffer->Members.AddTail(mem);
    }
}
Esempio n. 21
0
            if (!eq || errdiff > 1e-1)
            {
                ++mistmatch;
                continue;
            }

            eq = std::abs(cpuErr[i] - err[i]) < 0.01;
            if(!eq)
                ++errmatch;
        }
    }

    double bad_ratio = static_cast<double>(mistmatch) / (nextPts.size());
    double err_ratio = static_cast<double>(errmatch) / (nextPts.size());

    ASSERT_LE(bad_ratio, eps);
    ASSERT_LE(err_ratio, erreps);
}

OCL_INSTANTIATE_TEST_CASE_P(Video, PyrLKOpticalFlow,
                            Combine(
                                Values(11, 15, 21, 25),
                                Values(3, 5)
                                )
                           );

} } // namespace cvtest::ocl


#endif // HAVE_OPENCL
Esempio n. 22
0
    bool Jets(Cluster_Amplitude *ampl,int mode)
    {
      DEBUG_FUNC("mode = "<<mode);
      msg_Debugging()<<*ampl<<"\n";
      PHASIC::Jet_Finder *jf(ampl->JF<PHASIC::Jet_Finder>());
      double q2cut(jf->Ycut()*sqr(rpa->gen.Ecms()));
      double q2min(std::numeric_limits<double>::max());
      size_t imin(0), jmin(0), kmin(0);
      Flavour mofl;
      for (size_t i(0);i<ampl->Legs().size();++i) {
	Cluster_Leg *li(ampl->Leg(i));
	for (size_t j(Max(i+1,ampl->NIn()));j<ampl->Legs().size();++j) {
	  Cluster_Leg *lj(ampl->Leg(j));
	  if (j<ampl->NIn()) continue;
	  for (size_t k(0);k<ampl->Legs().size();++k) {
	    if (k==i || k==j) continue;
	    Cluster_Leg *lk(ampl->Leg(k));
	    if (i<ampl->NIn() && k>=ampl->NIn()) continue;
	    if (lk->Flav().Strong() &&
		li->Flav().Strong() && lj->Flav().Strong()) {
	      if (i<ampl->NIn()) li->SetMom(-li->Mom());
	      if (k<ampl->NIn()) lk->SetMom(-lk->Mom());
	      double q2ijk(pT2pythia(ampl,*li,*lj,*lk,i<ampl->NIn()?-1:1));
	      msg_Debugging()<<"Q_{"<<ID(li->Id())<<ID(lj->Id())
			     <<","<<ID(lk->Id())<<"} = "<<sqrt(q2ijk)<<"\n";
	      if (i<ampl->NIn()) li->SetMom(-li->Mom());
	      if (k<ampl->NIn()) lk->SetMom(-lk->Mom());
	      if (mode==0) {
		if (q2ijk<q2cut) return false;
	      }
	      else {
		if (q2ijk<q2min) {
		  q2min=q2ijk;
		  mofl=Flavour(kf_gluon);
		  if (li->Flav().IsGluon()) mofl=lj->Flav();
		  if (lj->Flav().IsGluon()) mofl=li->Flav();
		  imin=i;
		  jmin=j;
		  kmin=k;
		}
	      }
	    }
	  }
	}
      }
      if (mode!=0 && imin!=jmin) {
	Vec4D_Vector p=Combine(*ampl,imin,jmin,kmin,mofl);
	if (p.empty()) {
	  msg_Error()<<METHOD<<"(): Combine failed. Use R configuration."<<std::endl;
	  return Jets(ampl,0);
	}
	Cluster_Amplitude *bampl(Cluster_Amplitude::New());
	bampl->SetProc(ampl->Proc<void>());
	bampl->SetMS(ampl->MS());
	bampl->SetNIn(ampl->NIn());
	bampl->SetJF(ampl->JF<void>());
	for (int i(0), j(0);i<ampl->Legs().size();++i) {
	  if (i==jmin) continue;
	  if (i==imin) {
	    bampl->CreateLeg(p[j],mofl,ampl->Leg(i)->Col());
	    bampl->Legs().back()->SetId(ampl->Leg(imin)->Id()|ampl->Leg(jmin)->Id());
	    bampl->Legs().back()->SetK(ampl->Leg(kmin)->Id());	
	  }
	  else {
	    bampl->CreateLeg(p[j],ampl->Leg(i)->Flav(),ampl->Leg(i)->Col());
	  }
	  ++j;
	}
	bool res=Jets(bampl,0);
	bampl->Delete();
	return res;
      }
      msg_Debugging()<<"--- Jet veto ---\n";
      return true;
    }
Esempio n. 23
0
void sfTransform_Combine(sfTransform* transform, const sfTransform* other)
{
    CSFML_CHECK(other);

    CSFML_CALL(transform, Combine(other->This));
}
Esempio n. 24
0
    declare.in(src).out(dst);

    TEST_CYCLE() warpPerspective(src, dst, warpMat, sz, interType, borderMode, borderColor);

#ifdef __ANDROID__
    SANITY_CHECK(dst, interType == INTER_LINEAR ? 5 : 10);
#else
    SANITY_CHECK(dst, 1);
#endif
}

PERF_TEST_P( TestWarpPerspectiveNear_t, WarpPerspectiveNear,
             Combine(
                 Values( Size(640,480), Size(1920,1080), Size(2592,1944) ),
                 InterType::all(),
                 BorderMode::all(),
                 Values( CV_8UC1, CV_8UC4 )
                 )
             )
{
    Size size;
    int borderMode, interType, type;
    size       = get<0>(GetParam());
    interType  = get<1>(GetParam());
    borderMode = get<2>(GetParam());
    type       = get<3>(GetParam());
    Scalar borderColor = Scalar::all(150);

    Mat src(size, type), dst(size, type);
    cvtest::fillGradient(src);
    if(borderMode == BORDER_CONSTANT) cvtest::smoothBorder(src, borderColor, 1);
Esempio n. 25
0
File: hash.c Progetto: OpenXT/ocaml
static void hash_aux(value obj)
{
  unsigned char * p;
  mlsize_t i, j;
  tag_t tag;

  hash_univ_limit--;
  if (hash_univ_count < 0 || hash_univ_limit < 0) return;

 again:
  if (Is_long(obj)) {
    hash_univ_count--;
    Combine(Long_val(obj));
    return;
  }

  /* Pointers into the heap are well-structured blocks. So are atoms.
     We can inspect the block contents. */

  Assert (Is_block (obj));  
  if (Is_in_value_area(obj)) {
    tag = Tag_val(obj);
    switch (tag) {
    case String_tag:
      hash_univ_count--;
      i = caml_string_length(obj);
      for (p = &Byte_u(obj, 0); i > 0; i--, p++)
        Combine_small(*p);
      break;
    case Double_tag:
      /* For doubles, we inspect their binary representation, LSB first.
         The results are consistent among all platforms with IEEE floats. */
      hash_univ_count--;
#ifdef ARCH_BIG_ENDIAN
      for (p = &Byte_u(obj, sizeof(double) - 1), i = sizeof(double);
           i > 0;
           p--, i--)
#else
      for (p = &Byte_u(obj, 0), i = sizeof(double);
           i > 0;
           p++, i--)
#endif
        Combine_small(*p);
      break;
    case Double_array_tag:
      hash_univ_count--;
      for (j = 0; j < Bosize_val(obj); j += sizeof(double)) {
#ifdef ARCH_BIG_ENDIAN
      for (p = &Byte_u(obj, j + sizeof(double) - 1), i = sizeof(double);
           i > 0;
           p--, i--)
#else
      for (p = &Byte_u(obj, j), i = sizeof(double);
           i > 0;
           p++, i--)
#endif
        Combine_small(*p);
      }
      break;
    case Abstract_tag:
      /* We don't know anything about the contents of the block.
         Better do nothing. */
      break;
    case Infix_tag:
      hash_aux(obj - Infix_offset_val(obj));
      break;
    case Forward_tag:
      obj = Forward_val (obj);
      goto again;
    case Object_tag:
      hash_univ_count--;
      Combine(Oid_val(obj));
      break;
    case Custom_tag:
      /* If no hashing function provided, do nothing */
      if (Custom_ops_val(obj)->hash != NULL) {
        hash_univ_count--;
        Combine(Custom_ops_val(obj)->hash(obj));
      }
      break;
    default:
      hash_univ_count--;
      Combine_small(tag);
      i = Wosize_val(obj);
      while (i != 0) {
        i--;
        hash_aux(Field(obj, i));
      }
      break;
    }
    return;
  }

  /* Otherwise, obj is a pointer outside the heap, to an object with
     a priori unknown structure. Use its physical address as hash key. */
  Combine((intnat) obj);
}
Esempio n. 26
0
void ParsedObject::ReadExpression(LispInt depth)
{
    ReadAtom();

    for (;;) {
        //Handle special case: a[b]. a is matched with lowest precedence!!
        if (iLookAhead == iParser.iEnvironment.iProgOpen->String()) {
            // Match opening bracket
            MatchToken(iLookAhead);
            // Read "index" argument
            ReadExpression(KMaxPrecedence);
            // Match closing bracket
            if (iLookAhead != iParser.iEnvironment.iProgClose->String())
                throw LispErrGeneric(std::string("Expecting a ] close bracket for program block, but got ") + *iLookAhead + std::string(" instead"));

            MatchToken(iLookAhead);
            // Build into Ntn(...)
            const LispString* theOperator = iParser.iEnvironment.iNth->String();
            InsertAtom(theOperator);
            Combine(2);
        } else {
            LispOperators::const_iterator opi = iParser.iInfixOperators.find(iLookAhead);
            
            if (opi == iParser.iInfixOperators.end()) {
                if (!IsSymbolic((*iLookAhead)[0]))
                    return;
                
                const std::size_t origlen = iLookAhead->size();
                std::size_t len = origlen;

                while (len > 1) {
                    len -= 1;
                    const LispString* lookUp =
                            iParser.iEnvironment.HashTable().LookUp(iLookAhead->substr(0, len));

                    opi = iParser.iInfixOperators.find(lookUp);

                    if (opi != iParser.iInfixOperators.end()) {

                        const LispString* lookUpRight =
                                iParser.iEnvironment.HashTable().LookUp(iLookAhead->substr(len, origlen - len));

                        if (iParser.iPrefixOperators.find(lookUpRight) != iParser.iPrefixOperators.end()) {
                            iLookAhead = lookUp;
                            LispInput& input = iParser.iInput;
                            LispInt newPos = input.Position() - (origlen - len);
                            input.SetPosition(newPos);
                            break;
                        }

                        opi = iParser.iInfixOperators.end();
                    }
                }

                if (opi == iParser.iInfixOperators.end())
                    return;
            }

            
            if (depth < opi->second.iPrecedence)
                return;
            LispInt upper = opi->second.iPrecedence;
            if (!opi->second.iRightAssociative)
                upper--;
            GetOtherSide(2, upper);
        }
    }
}
Esempio n. 27
0
bool udtPath::Combine(udtString& combinedPath, udtVMLinearAllocator& allocator, const udtString& folderPath, const char* extra)
{
	return Combine(combinedPath, allocator, folderPath, udtString::NewConstRef(extra));
}
Esempio n. 28
0
ComponentView* Component::Create (ClassId viewId) {
    ClassId gv = Combine(GetClassId(), viewId);

    return (ComponentView*) unidraw->GetCatalog()->GetCreator()->Create(gv);
}
Esempio n. 29
0
void ParsedObject::ReadAtom()
{
    LispOperators::const_iterator opi =
            iParser.iPrefixOperators.find(iLookAhead);
    if (opi != iParser.iPrefixOperators.end()) {
        const LispString* theOperator = iLookAhead;
        MatchToken(iLookAhead);
        {
            ReadExpression(opi->second.iPrecedence);
            InsertAtom(theOperator);
            Combine(1);
        }
    }        // Else parse brackets
    else if (iLookAhead == iParser.iEnvironment.iBracketOpen->String()) {
        MatchToken(iLookAhead);
        ReadExpression(KMaxPrecedence); // least precedence
        MatchToken(iParser.iEnvironment.iBracketClose->String());
    }        //Parse lists
    else if (iLookAhead == iParser.iEnvironment.iListOpen->String()) {
        LispInt nrargs = 0;
        MatchToken(iLookAhead);
        while (iLookAhead != iParser.iEnvironment.iListClose->String()) {
            ReadExpression(KMaxPrecedence); // least precedence
            nrargs++;

            if (iLookAhead == iParser.iEnvironment.iComma->String()) {
                MatchToken(iLookAhead);
            } else if (iLookAhead != iParser.iEnvironment.iListClose->String()) {
                throw LispErrGeneric(std::string("Expecting a } close bracket for program block, but got ") + *iLookAhead + std::string(" instead"));
            }
        }
        MatchToken(iLookAhead);
        const LispString* theOperator = iParser.iEnvironment.iList->String();
        InsertAtom(theOperator);
        Combine(nrargs);

    }        // Parse prog bodies
    else if (iLookAhead == iParser.iEnvironment.iProgOpen->String()) {
        LispInt nrargs = 0;

        MatchToken(iLookAhead);
        while (iLookAhead != iParser.iEnvironment.iProgClose->String()) {
            ReadExpression(KMaxPrecedence); // least precedence
            nrargs++;

            if (iLookAhead == iParser.iEnvironment.iEndStatement->String()) {
                MatchToken(iLookAhead);
            } else {
                throw LispErrGeneric(std::string("Expecting ; end of statement in program block, but got ") + *iLookAhead + std::string(" instead"));
            }
        }
        MatchToken(iLookAhead);
        const LispString* theOperator = iParser.iEnvironment.iProg->String();
        InsertAtom(theOperator);

        Combine(nrargs);
    }        // Else we have an atom.
    else {
        const LispString* theOperator = iLookAhead;
        MatchToken(iLookAhead);

        LispInt nrargs = -1;
        if (iLookAhead == iParser.iEnvironment.iBracketOpen->String()) {
            nrargs = 0;
            MatchToken(iLookAhead);
            while (iLookAhead != iParser.iEnvironment.iBracketClose->String()) {
                ReadExpression(KMaxPrecedence); // least precedence
                nrargs++;

                if (iLookAhead == iParser.iEnvironment.iComma->String()) {
                    MatchToken(iLookAhead);
                } else if (iLookAhead != iParser.iEnvironment.iBracketClose->String()) {
                    throw LispErrGeneric(std::string("Expecting a ) closing bracket for sub-expression, but got ") + *iLookAhead + std::string(" instead"));
                }
            }
            MatchToken(iLookAhead);

            opi = iParser.iBodiedOperators.find(theOperator);
            if (opi != iParser.iBodiedOperators.end()) {
                ReadExpression(opi->second.iPrecedence); // KMaxPrecedence
                nrargs++;
            }
        }
        InsertAtom(theOperator);
        if (nrargs >= 0)
            Combine(nrargs);

    }

    // Parse postfix operators

    while (iParser.iPostfixOperators.find(iLookAhead) != iParser.iPostfixOperators.end()) {
        InsertAtom(iLookAhead);
        MatchToken(iLookAhead);
        Combine(1);
    }
}
Esempio n. 30
0
namespace opencv_test
{

INSTANTIATE_TEST_CASE_P(RGB2GrayTestFluid, RGB2GrayTest,
                        Combine(Values(cv::Size(1280, 720),
                                cv::Size(640, 480)),
                                Values(true, false),
                                Values(cv::compile_args(IMGPROC_FLUID))));

INSTANTIATE_TEST_CASE_P(BGR2GrayTestFluid, BGR2GrayTest,
                        Combine(Values(cv::Size(1280, 720),
                                       cv::Size(640, 480)),
                                Values(true, false),
                                Values(cv::compile_args(IMGPROC_FLUID))));

INSTANTIATE_TEST_CASE_P(RGB2YUVTestFluid, RGB2YUVTest,
                        Combine(Values(cv::Size(1280, 720),
                                       cv::Size(640, 480)),
                                Values(true, false),
                                Values(cv::compile_args(IMGPROC_FLUID))));

INSTANTIATE_TEST_CASE_P(YUV2RGBTestFluid, YUV2RGBTest,
                        Combine(Values(cv::Size(1280, 720),
                                       cv::Size(640, 480)),
                                Values(true, false),
                                Values(cv::compile_args(IMGPROC_FLUID))));

INSTANTIATE_TEST_CASE_P(RGB2LabTestFluid, RGB2LabTest,
                        Combine(Values(cv::Size(1280, 720),
                                       cv::Size(640, 480)),
                                Values(true, false),
                                Values(cv::compile_args(IMGPROC_FLUID))));

// FIXME: Not supported by Fluid yet (no kernel implemented)
INSTANTIATE_TEST_CASE_P(BGR2LUVTestFluid, BGR2LUVTest,
                        Combine(Values(cv::Size(1280, 720),
                                       cv::Size(640, 480)),
                                Values(true, false),
                                Values(cv::compile_args(IMGPROC_FLUID))));

INSTANTIATE_TEST_CASE_P(blurTestFluid, BlurTest,
                        Combine(Values(CV_8UC1, CV_16UC1, CV_16SC1),
                                Values(3), // add kernel size=5 when implementation is ready
                                Values(cv::Size(1280, 720),
                                       cv::Size(640, 480)),
                                Values(cv::BORDER_DEFAULT),
                                Values(0.0),
                                Values(true, false),
                                Values(cv::compile_args(IMGPROC_FLUID))));

INSTANTIATE_TEST_CASE_P(gaussBlurTestFluid, GaussianBlurTest,
                        Combine(Values(CV_8UC1, CV_16UC1, CV_16SC1),
                                Values(3), // add kernel size=5 when implementation is ready
                                Values(cv::Size(1280, 720),
                                       cv::Size(640, 480)),
                                Values(true, false),
                                Values(cv::compile_args(IMGPROC_FLUID))));

INSTANTIATE_TEST_CASE_P(medianBlurTestFluid, MedianBlurTest,
                        Combine(Values(CV_8UC1, CV_16UC1, CV_16SC1),
                                Values(3), // add kernel size=5 when implementation is ready
                                Values(cv::Size(1280, 720),
                                       cv::Size(640, 480)),
                                Values(true, false),
                                Values(cv::compile_args(IMGPROC_FLUID))));

INSTANTIATE_TEST_CASE_P(erodeTestFluid, ErodeTest,
                        Combine(Values(CV_8UC1, CV_16UC1, CV_16SC1),
                                Values(3), // add kernel size=5 when implementation is ready
                                Values(cv::Size(1280, 720),
                                       cv::Size(640, 480)),
                                Values(cv::MorphShapes::MORPH_RECT,
                                       cv::MorphShapes::MORPH_CROSS,
                                       cv::MorphShapes::MORPH_ELLIPSE),
                                Values(true, false),
                                Values(cv::compile_args(IMGPROC_FLUID))));

INSTANTIATE_TEST_CASE_P(dilateTestFluid, DilateTest,
                        Combine(Values(CV_8UC1, CV_16UC1, CV_16SC1),
                                Values(3), // add kernel size=5 when implementation is ready
                                Values(cv::Size(1280, 720),
                                       cv::Size(640, 480)),
                                Values(cv::MorphShapes::MORPH_RECT,
                                       cv::MorphShapes::MORPH_CROSS,
                                       cv::MorphShapes::MORPH_ELLIPSE),
                                Values(true, false),
                                Values(cv::compile_args(IMGPROC_FLUID))));

INSTANTIATE_TEST_CASE_P(SobelTestFluid, SobelTest,
                        Combine(Values(CV_8UC1, CV_16UC1, CV_16SC1),
                                Values(3), // add kernel size=5 when implementation is ready
                                Values(cv::Size(1280, 720),
                                       cv::Size(640, 480)),
                                Values(-1, CV_32F),
                                Values(0, 1),
                                Values(1, 2),
                                Values(true, false),
                                Values(cv::compile_args(IMGPROC_FLUID))));

INSTANTIATE_TEST_CASE_P(boxFilterTestFluid, BoxFilterTest,
                        Combine(Values(CV_8UC1, CV_16UC1, CV_16SC1),
                                Values(3), // add kernel size=5 when implementation is ready
                                Values(cv::Size(1280, 720),
                                       cv::Size(640, 480)),
                                Values(cv::BORDER_DEFAULT),
                                Values(-1, CV_32F),
                                Values(0.0),
                                Values(true, false),
                                Values(cv::compile_args(IMGPROC_FLUID))));

// FIXME: Tests are failing on Fluid backend (accuracy issue?)
INSTANTIATE_TEST_CASE_P(sepFilterTestFluid, SepFilterTest,
                        Combine(Values(CV_32FC1),
                                Values(3), // add kernel size=5 when implementation is ready
                                Values(cv::Size(1280, 720),
                                       cv::Size(640, 480)),
                                Values(-1, CV_32F),
                                Values(true, false),
                                Values(cv::compile_args(IMGPROC_FLUID))));

INSTANTIATE_TEST_CASE_P(filter2DTestFluid, Filter2DTest,
                        Combine(Values(CV_8UC1, CV_16UC1, CV_16SC1),
                                Values(3), // add kernel size=4,5,7 when implementation ready
                                Values(cv::Size(1280, 720),
                                       cv::Size(640, 480),
                                       cv::Size(128, 128)),
                                Values(cv::BORDER_DEFAULT),
                                Values(-1, CV_32F),
                                Values(true, false),
                                Values(cv::compile_args(IMGPROC_FLUID))));

} // opencv_test