Controllable Mathematical Reasoning via Self-Optimizing Thought Vectors