rank net cost and gradient implemented, gradient test ok!