Ejemplo n.º 1
0
/// set RESULT into set of instances of A such that they do have data roles R and S
void
ReasoningKernel :: getDataRelatedIndividuals ( TDRoleExpr* R, TDRoleExpr* S, int op, IndividualSet& Result )
{
	preprocessKB();	// ensure KB is ready to answer the query
	Result.clear();
	const TRole* r = getRole ( R, "Role expression expected in the getDataRelatedIndividuals()" );
	const TRole* s = getRole ( S, "Role expression expected in the getDataRelatedIndividuals()" );

	// prepare DT reasoners
	const DLDag& dag = getTBox()->getDag();
	const DataTypeCenter& dtc = getTBox()->getDataTypeCenter();

	DataTypeReasoner Op1(dag);
	DataTypeReasoner Op2(dag);
	dtc.initDataTypeReasoner(Op1);
	dtc.initDataTypeReasoner(Op2);

	// vector of individuals
	typedef TDLNAryExpression<TDLIndividualExpression> IndVec;
	IndVec Individuals ("individual expression","data related individuals");
	Individuals.add(getExpressionManager()->getArgList());
	for ( IndVec::iterator q = Individuals.begin(), q_end = Individuals.end(); q != q_end; ++q )
	{
		const TIndividual* ind = getIndividual ( *q, "individual name expected in getDataRelatedIndividuals()" );
		const DlCompletionTree* vR = NULL;
		const DlCompletionTree* vS = NULL;
		for ( DlCompletionTree::const_edge_iterator p = ind->node->begin(), p_end = ind->node->end(); p != p_end; ++p )
		{
			const DlCompletionTreeArc* edge = *p;
			if ( edge->isNeighbour(r) )
				vR = edge->getArcEnd();
			else if ( edge->isNeighbour(s) )
				vS = edge->getArcEnd();
			if ( vR && vS )
			{
				if ( fillDTReasoner ( Op1, vR ) )
					break;
				if ( fillDTReasoner ( Op2, vS ) )
					break;
				if ( checkDataRelation ( Op1, Op2, op ) )
					Result.push_back(ind);
				break;
			}
		}
	}
}
Ejemplo n.º 2
0
double FixedPointStep(const DataStructure& Mesh, const sparse& Diff, const matrix& RHS, vector& x1, vector& x2, vector& x3, 
					  vector& x4, vector& x5, double coef)
{
	int Npts = Mesh.GetNverts();

	vector  theta1 = ConstructTheta(c1,x3),
			theta2 = ConstructTheta(c2,x3),
			theta3 = ConstructTheta(c3,x3),

		RHS1 = RHS[0],
		RHS2 = RHS[1],
		RHS3 = RHS[2] + kr * x1 * x2 + alfa * c3 * theta3 + delta * c1 * theta1 * x5 + beta * (1.0 - theta2) * c2 * x4,
		RHS4 = RHS[3] + (x3 - c3) * alfa * theta3,
		RHS5 = RHS[4] + gama * (x3 - c2) * theta2 * x4;
		
	sparse Op1 = Diff * Da, Op2 = Diff * Db, Op3 = Diff * Dc;

	vector v1 = coef + kr * x2,
	       v2 = coef + kr * x1,
	       v3 = coef + alfa * theta3 + delta * theta1 * x5 + beta * (1.0 - theta2) * x4;
 
	Op1.Diag(v1);
	Op2.Diag(v2);
	Op3.Diag(v3);

	vector sol1 = Op1(RHS1,x1),
	       sol2 = Op2(RHS2,x2),
	       sol3 = Op3(RHS3,x3),
	       sol4(Npts,.0),
	       sol5(Npts,.0),

	       Op4 = coef + gama * (x3 - c2) * theta2 + beta * (1.0 - theta2) * (c2 - x3),
	       Op5 = coef - delta * (x3 - c1) * theta1;

	sol4 = RHS4 / Op4;
	sol5 = RHS5 / Op5;

	double error = max((sol1 - x1).Amax(),max((sol2 - x2).Amax(),max((sol3 - x3).Amax(),max((sol4 - x4).Amax(),(sol5 - x5).Amax()))));

	x1 = sol1; x2 = sol2; x3 = sol3; x4 = sol4; x5 = sol5;

	return error;
}
Ejemplo n.º 3
0
void parser::Exp1()
{
	int k;
	PolizElem *temp;

	Exp2();
	while ((k=Op1()))
	{
		Exp2();
		switch (k)
		{
			case '+':
				temp=new PolizFunPlus;
				break;
			case '-':
				temp=new PolizFunMinus;
				break;
			case '|':
				temp=new PolizFunOr;
		}
		addpolizelem(temp);
	}
}
Ejemplo n.º 4
0
double FPI_RD(const DataStructure& Mesh, sparse& Diff, matrix RHS, vector& x1, vector& x2, double coef, double dt)
{
	int Npts = Mesh.GetNverts();

	vector	RHS1 = RHS[0],
		RHS2 = RHS[1];

	sparse Op1 = Diff * (Da * dt), Op2 = Diff * (Db * dt);

	vector v1 = coef + (dt * kr) * x2,
	       v2 = coef + (dt * kr) * x1;
 
	Op1.Diag(v1);
	Op2.Diag(v2);

	vector sol1 = Op1(RHS1,x1),
	       sol2 = Op2(RHS2,x2);

	double error = max((sol1 - x1).Amax(),(sol2 - x2).Amax());

	x1 = sol1; x2 = sol2;

	return error;
}
Ejemplo n.º 5
0
static void reset_actlr(struct kvm_vcpu *vcpu, const struct sys_reg_desc *r)
{
	vcpu_sys_reg(vcpu, ACTLR_EL1) = read_sysreg(actlr_el1);
}

/*
 * Implementation specific sys-reg registers.
 * Important: Must be sorted ascending by Op0, Op1, CRn, CRm, Op2
 */
static const struct sys_reg_desc genericv8_sys_regs[] = {
	{ SYS_DESC(SYS_ACTLR_EL1), access_actlr, reset_actlr, ACTLR_EL1 },
};

static const struct sys_reg_desc genericv8_cp15_regs[] = {
	/* ACTLR */
	{ Op1(0b000), CRn(0b0001), CRm(0b0000), Op2(0b001),
	  access_actlr },
};

static struct kvm_sys_reg_target_table genericv8_target_table = {
	.table64 = {
		.table = genericv8_sys_regs,
		.num = ARRAY_SIZE(genericv8_sys_regs),
	},
	.table32 = {
		.table = genericv8_cp15_regs,
		.num = ARRAY_SIZE(genericv8_cp15_regs),
	},
};

static int __init sys_reg_genericv8_init(void)