  We study the implementation of one-, two-, and three-qubit quantum gates for
interacting qubits using optimal control. Different Markovian and non-Markovian
environments are compared and efficient optimisation algorithms utilising
analytic gradient expressions and quasi-Newton updates are given for both
cases. The performance of the algorithms is analysed for a large set of
problems in terms of the fidelities attained and the observed convergence
behaviour. New notions of success rate and success speed are introduced and
density plots are utilised to study the effect of key parameters, such as gate
operation times, and random variables, such as the initial fields required to
start the iterative algorithm. Core characteristics of the optimal fields are
statistically analysed. Substantial differences between Markovian and
non-Markovian environments in terms of the possibilities for control and the
control mechanisms are uncovered. In particular, in the Markovian case it is
found that the optimal fields obtained without considering the environment
cannot be improved substantially by taking the environment into account and the
fidelities attained are determined mostly by the gate operation time as well as
the overall strength of the environmental effects. Computation time is saved if
the fields are pre-optimised neglecting decoherence. In the non-Markovian case,
on the other hand, substantial improvements in the fidelities are observed when
the details of the system-bath coupling are taken into account. In that case,
field leakage is shown to be a significant issue which can make high gate
fidelities impossible to obtain unless both the system and noise qubits are
fully controlled.
