gradient computation has been implemented