  Symmetry is a guiding principle in physics that allows to generalize
conclusions between many physical systems. In the ongoing search for new
topological phases of matter, symmetry plays a crucial role because it protects
topological phases. We address two converse questions relevant to the symmetry
classification of systems: Is it possible to generate all possible single-body
Hamiltonians compatible with a given symmetry group? Is it possible to find all
the symmetries of a given family of Hamiltonians? We present numerically
stable, deterministic polynomial time algorithms to solve both of these
problems. Our treatment extends to all continuous or discrete symmetries of
non-interacting lattice or continuum Hamiltonians. We implement the algorithms
in the Qsymm Python package, and demonstrate their usefulness with examples
from active research areas in condensed matter physics, including Majorana
wires and Kekule graphene.
