First and second-order derivatives for CP and INDSCAL