gh-36554: Speedup of the method to reduce ternary quadratic forms in the class TernaryQF
PR from #16965 (rebased from https://github.com/sagemath/sagetrac-
mirror/commit/091cbbdf6eed2c8bccca407addd07ff08e429c17)
Resolves #16965
Author: Gustavo Rama
### :memo: Checklist
- [x] The title is concise, informative, and self-explanatory.
- [x] The description explains in detail what this PR is about.
- [x] I have linked a relevant issue or discussion.
URL: https://github.com/sagemath/sage/pull/36554
Reported by: Gonzalo TornarĂa
Reviewer(s):
Committer
Release Manager