Logic Computation in Phase Change Materials by Threshold and Memory Switching