def getPredictedStepAlt(hConst, hDiag, gradient, alphas):
    K = len(gradient)
    Z = 0
    for k in range(0, K):
        Z += (alphas[k] / (gradient[k] - (alphas[k] * hDiag[k])))
    Z *= hConst
    Ss = ([0] * K)
    for k in range(0, K):
        Ss[k] = ((1.0 / (gradient[k] - (alphas[k] * hDiag[k]))) / (1 + Z))
    S = sum(Ss)
    retVal = ([0] * K)
    for i in range(0, K):
        retVal[i] = ((gradient[i] / (gradient[i] - (alphas[i] * hDiag[i]))) * (1 - ((hConst * alphas[i]) * S)))
    return retVal
def getPredictedStepAlt(hConst, hDiag, gradient, alphas):
    K = len(gradient)
    Z = 0
    for k in range(0, K):
        Z += (alphas[k] / (gradient[k] - (alphas[k] * hDiag[k])))
    Z *= hConst
    Ss = ([0] * K)
    for k in range(0, K):
        Ss[k] = ((1.0 / (gradient[k] - (alphas[k] * hDiag[k]))) / (1 + Z))
    S = sum(Ss)
    retVal = ([0] * K)
    for i in range(0, K):
        retVal[i] = ((gradient[i] / (gradient[i] - (alphas[i] * hDiag[i]))) * (1 - ((hConst * alphas[i]) * S)))
    return retVal