Computationally-efficient quaternion-based machine-learning system