Demonstration of an optical full adder and subtractor for phase-encoded data using nonlinear wave mixing