  We propose a method for classical simulation of finite-dimensional quantum
systems, based on sampling from a quasiprobability distribution, i.e., a
generalized Wigner function. Our construction applies to all finite dimensions,
with the most interesting case being that of qubits. For multiple qubits, we
find that quantum computation by Clifford gates and Pauli measurements on magic
states can be efficiently classically simulated if the quasiprobability
distribution of the magic states is non-negative. This provides the so far
missing qubit counterpart of the corresponding result [V. Veitch et al., New J.
Phys. 14, 113011 (2012)] applying only to odd dimension. Our approach is more
general than previous ones based on mixtures of stabilizer states. Namely, all
mixtures of stabilizer states can be efficiently simulated, but for any number
of qubits there also exist efficiently simulable states outside the stabilizer
polytope. Further, our simulation method extends to negative quasiprobability
distributions, where it provides amplitude estimation. The simulation cost is
then proportional to a robustness measure squared. For all quantum states, this
robustness is smaller than or equal to robustness of magic.
