示例#1
0
void split(struct vtx_data ** graph, int *nodes, int first,int last,int *middle) {
	int splitter=rand()*(last-first)/RAND_MAX+first;
	int val;
	int left=first+1;
	int right=last;
	int temp;

	val=nodes[splitter];  nodes[splitter]=nodes[first]; nodes[first]=val;

	while (left<right) {
		while (left<right &&  greater_eq(nodes[left],val,graph)) 
			left++;
		while (left<right && smaller_eq(nodes[right],val,graph)) 
			right--;
		if (left<right) {
			temp=nodes[left]; nodes[left]=nodes[right]; nodes[right]=temp; 
			left++; right--; // (1)
							 
		}
	}
	// in this point either, left==right (meeting), or left=right+1 (because of (1))
	// we have to decide to which part the meeting point (or left) belongs.
	
	if (!greater_eq(nodes[left],val,graph))
		left=left-1; // notice that always left>first, because of its initialization
	*middle=left;
	nodes[first]=nodes[*middle];
	nodes[*middle]=val;
}
示例#2
0
void regclass_pyngraph_op_GreaterEq(py::module m)
{
    py::class_<ngraph::op::GreaterEq,
               std::shared_ptr<ngraph::op::GreaterEq>,
               ngraph::op::util::BinaryElementwiseComparison>
        greater_eq(m, "GreaterEq");
    greater_eq.doc() = "ngraph.impl.op.GreaterEq wraps ngraph::op::GreaterEq";
    greater_eq.def(
        py::init<const std::shared_ptr<ngraph::Node>&, const std::shared_ptr<ngraph::Node>&>());
}