update cost function and gradient for ICA