Structural optimization of numerical programs for high-level synthesis