casadi/casadi — pull request #980 by jgillis (2014-02-08 23:01:33+00:00)
Title: Adding a relay/schmitt tigger operation

Possibly a controversial contribution; an operation with side-effects (state).
The state is managed by the work vector of the XFunctionInternal.

Idea:
A relay (schmitt-trigger) operation

A relay will introduce memory into an algorithm.
The output of the relay (1 or -1) depends on the history (state) and the current input.

If state==true: output = state = (input>-1)
If state==false: output = state = (input<1)

````
^ output
____|___________ 1 (true)
| | |
--------+----|-----+------------> input
-1 ____|____|_____|
(false) -1 1
```
The initial state is always true (high)