def qform_q(A,X,Y):
    """
    quickest way which I find to compute for each index i quadratic form <Ax,y> for each x = X[ind,:], y = Y[ind,:]
    arguments:
        A - np.array of shape (d,d)
        X,Y - np.array of shape (n,d)
    returns:
        np.array of shape (n)
    """
    return (X.dot(A)*Y).sum(axis=1)