precompute ambient optim