Nonholonomic Trajectory Optimization and the Existence of Twisted Matrix Logarithms