Quantum Computing Implemented via Optimal Control: Application to Spin and Pseudospin Systems