libquantum provides an efficient model to simulate the effects of decoherence. The effects are simulated by a random rotation about the z axis, where the angle of the rotation is a normal distributed value with the variance $2 \lambda$. $\lambda$ is the decoherence parameter, which depends on the experimental realization of the quantum computer. A list of values for $\lambda$ is given in [DiVincenzo, 1995].


extern void quantum_set_decoherence(float lambda);

This function sets the decoherence parameter $\lambda$ which affects all following quantum operations.


extern void quantum_decohere(quantum_reg *reg);

Perform a decoherence step on a quantum register. Note that this function gets called automatically by all elementary gates provided by libquantum.