Exemplo n.º 1
0
func (PS *PgeSearch) GenInitExprAddMethod1() []expr.Expr {

	exprs := make([]expr.Expr, 0)

	// WARNING adding a single coefficient results in the same traversal but with the added extra coefficient
	cf := new(expr.Constant)
	cf.P = 1
	af := new(expr.Add)
	af.Insert(cf)
	exprs = append(exprs, af)

	for _, i := range PS.cnfg.treecfg.UsableVars {
		c := new(expr.Constant)
		c.P = -1
		v := new(expr.Var)
		v.P = i

		m := expr.NewMul()
		m.Insert(c)
		m.Insert(v)

		a := expr.NewAdd()
		a.Insert(m)
		exprs = append(exprs, a)
	}

	fmt.Println("Initial Add:  ", exprs)
	return exprs
}
Exemplo n.º 2
0
func (PS *PgeSearch) GenInitExprDivMethod1() []expr.Expr {
	exprs := make([]expr.Expr, 0)

	for _, i := range PS.cnfg.treecfg.UsableVars {
		c := new(expr.Constant)
		c.P = -1
		v := new(expr.Var)
		v.P = i

		d := new(expr.Div)
		d.Numer = c
		d.Denom = v

		exprs = append(exprs, d)
	}

	fmt.Println("Initial Div:  ", exprs)
	return exprs
}
Exemplo n.º 3
0
func (PS *PgeSearch) GenInitExprMulMethod1() []expr.Expr {
	exprs := make([]expr.Expr, 0)

	for _, i := range PS.cnfg.treecfg.UsableVars {
		c := new(expr.Constant)
		c.P = -1
		v := new(expr.Var)
		v.P = i

		m := expr.NewMul()
		m.Insert(c)
		m.Insert(v)

		exprs = append(exprs, m)
	}

	fmt.Println("Initial Mul:  ", exprs)
	return exprs
}