Gradient calculations for linear quadratic fixed-control structure problems