Documentation
¶
Overview ¶
Package op defines the operators the user should use to define his Evaluator. When used, these operators update a State. At the end of the execution the miner can get an approximation of Evaluator's complexity.
Index ¶
- type State
- func (self *State) Abs(a any) any
- func (self *State) Acos(a any) any
- func (self *State) Acosh(a any) any
- func (self *State) Add(a, b any) any
- func (self *State) And(a, b any) bool
- func (self *State) AppBool(a *[]bool, b any)
- func (self *State) AppFloat32(a *[]float32, b any)
- func (self *State) AppFloat64(a *[]float64, b any)
- func (self *State) AppInt(a *[]int, b any)
- func (self *State) AppInt16(a *[]int16, b any)
- func (self *State) AppInt32(a *[]int32, b any)
- func (self *State) AppInt64(a *[]int64, b any)
- func (self *State) AppInt8(a *[]int8, b any)
- func (self *State) AppString(a *[]string, b any)
- func (self *State) AppUint(a *[]uint, b any)
- func (self *State) AppUint16(a *[]uint16, b any)
- func (self *State) AppUint32(a *[]uint32, b any)
- func (self *State) AppUint64(a *[]uint64, b any)
- func (self *State) AppUint8(a *[]uint8, b any)
- func (self *State) Asin(a any) any
- func (self *State) Asinh(a any) any
- func (self *State) Atan(a any) any
- func (self *State) Atanh(a any) any
- func (self *State) Ceil(a any) any
- func (self *State) Cos(a any) any
- func (self *State) Cosh(a any) any
- func (self *State) Div(a, b any) any
- func (self *State) Eq(a, b any) bool
- func (self *State) Exp(a any) any
- func (self *State) Exp2(a any) any
- func (self *State) Floor(a any) any
- func (self *State) Ge(a, b any) bool
- func (self *State) Gt(a, b any) bool
- func (self *State) IncOperations(n float64)
- func (self *State) Le(a, b any) bool
- func (self *State) Log(a any) any
- func (self *State) Log10(a any) any
- func (self *State) Log2(a any) any
- func (self *State) Lt(a, b any) bool
- func (self *State) Max(a, b any) any
- func (self *State) Min(a, b any) any
- func (self *State) Mod(a, b any) any
- func (self *State) Mul(a, b any) any
- func (self *State) Neg(a any) any
- func (self *State) NumOperations() float64
- func (self *State) Or(a, b any) bool
- func (self *State) Pow(a, b any) any
- func (self *State) Prec(a any) any
- func (s *State) Reset()
- func (self *State) Round(a any) any
- func (s *State) SetBlockHash(hash []byte)
- func (self *State) SetBool(a *bool, b any)
- func (self *State) SetFloat32(a *float32, b any)
- func (self *State) SetFloat64(a *float64, b any)
- func (self *State) SetInt(a *int, b any)
- func (self *State) SetInt16(a *int16, b any)
- func (self *State) SetInt32(a *int32, b any)
- func (self *State) SetInt64(a *int64, b any)
- func (self *State) SetInt8(a *int8, b any)
- func (self *State) SetString(a *string, b any)
- func (self *State) SetUint(a *uint, b any)
- func (self *State) SetUint16(a *uint16, b any)
- func (self *State) SetUint32(a *uint32, b any)
- func (self *State) SetUint64(a *uint64, b any)
- func (self *State) SetUint8(a *uint8, b any)
- func (self *State) Sin(a any) any
- func (self *State) Sinh(a any) any
- func (self *State) Sqrt(a any) any
- func (self *State) Sub(a, b any) any
- func (self *State) Succ(a any) any
- func (self *State) Tan(a any) any
- func (self *State) Tanh(a any) any
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type State ¶
type State struct {
// contains filtered or unexported fields
}
The State struct keeps track of the number of operation performed, in order to give an approximation of the complexity of the executed algorithm.
func (*State) Abs ¶
func (self *State) Abs(a any) any
Returns the absolute value of a numner and updates the State.
func (*State) Acos ¶
func (self *State) Acos(a any) any
Returns the acos of a and updates the State.
func (*State) Acosh ¶
func (self *State) Acosh(a any) any
Returns the acosh of a and updates the State.
func (*State) Add ¶
func (self *State) Add(a, b any) any
Performs an addition and updates the State.
func (*State) And ¶
Returns a & b and updates the State. Both operands are executed even if a is false.
func (*State) AppFloat32 ¶
Append a float32 to a []float32 and update the State.
func (*State) AppFloat64 ¶
Append a float64 to a []float64 and update the State.
func (*State) Asin ¶
func (self *State) Asin(a any) any
Returns the asin of a and updates the State.
func (*State) Asinh ¶
func (self *State) Asinh(a any) any
Returns the asinh of a and updates the State.
func (*State) Atan ¶
func (self *State) Atan(a any) any
Returns the atan of a and updates the State.
func (*State) Atanh ¶
func (self *State) Atanh(a any) any
Returns the atanh of a and updates the State.
func (*State) Ceil ¶
func (self *State) Ceil(a any) any
Returns the smaller integer bigger than a and updates the State.
func (*State) Cosh ¶
func (self *State) Cosh(a any) any
Returns the cosh of a and updates the State.
func (*State) Exp2 ¶
func (self *State) Exp2(a any) any
Returns the power 2^a and updates the State.
func (*State) Floor ¶
func (self *State) Floor(a any) any
Returns the biggest integer smaller than a and updates the State.
func (*State) IncOperations ¶
Increase the count of operations.
func (*State) Log ¶
func (self *State) Log(a any) any
Returns the natural logarithm of a and updates the State.
func (*State) Log10 ¶
func (self *State) Log10(a any) any
Returns the logarithm on base 10 of a and updates the State.
func (*State) Log2 ¶
func (self *State) Log2(a any) any
Returns the logarithm on base 2 of a and updates the State.
func (*State) Max ¶
func (self *State) Max(a, b any) any
Returns the max of a and b and updates the State.
func (*State) Min ¶
func (self *State) Min(a, b any) any
Returns the min of a and b and updates the State.
func (*State) Mod ¶
func (self *State) Mod(a, b any) any
Returns the remainder a % b and updates the State.
func (*State) Mul ¶
func (self *State) Mul(a, b any) any
Performs a multiplication and updates the State.
func (*State) Neg ¶
func (self *State) Neg(a any) any
Returns -a if a is a numeric variable, or !a if a is a boolean variable; and updates the State.
func (*State) NumOperations ¶
Returns the approximation of the complexity of the executed code.
func (*State) Or ¶
Returns a | b and updates the State. Both operands are executed even if a is true.
func (*State) Pow ¶
func (self *State) Pow(a, b any) any
Returns the power a^b and updates the State.
func (*State) Prec ¶
func (self *State) Prec(a any) any
Returns a number decremented by 1 and updates the State.
func (*State) Reset ¶
func (s *State) Reset()
Reset the count of operations that approximates the complexity of the executed code.
func (*State) Round ¶
func (self *State) Round(a any) any
Rounds a to the nearest integer and updates the State.
func (*State) SetBlockHash ¶
Change the function's coefficients with the new block hash.
func (*State) SetFloat32 ¶
Assigns a float32 to a variable and updates the State.
func (*State) SetFloat64 ¶
Assigns a float64 to a variable and updates the State.
func (*State) Sinh ¶
func (self *State) Sinh(a any) any
Returns the sinh of a and updates the State.
func (*State) Sqrt ¶
func (self *State) Sqrt(a any) any
Returns the square root of a and updates the State.
func (*State) Sub ¶
func (self *State) Sub(a, b any) any
Performs a subtraction and updates the State.