def directional_variance_gradient_i(x_i, w):
 projection_length = dot(x_i, direction(w))
 return [((2 * projection_length) * x_ij) for x_ij in x_i]

def directional_variance_gradient_i ( x_i , w ) : projection_length = dot ( x_i , direction ( w ) ) return [ ( ( 2 * projection_length ) * x_ij ) for x_ij in x_i ]
the contribution of row x_i to the gradient of the direction-w variance .