def METHOD_NAME(a, cov, fit_sam, method="chol"):
    if method == "sam":
        pf_stdev = np.std(fit_sam @ a.T, axis=0)
    elif method == "chol":
        assert(cov is not None)
        chol = np.linalg.cholesky(cov)
        mat = a @ chol
        pf_stdev = np.linalg.norm(mat, axis=1)
    elif method == "choleye":
        assert(cov is not None)
        eigvals = np.linalg.eigvalsh(cov)
        chol = np.linalg.cholesky(cov+(abs(eigvals[0]) + 1e-14) * np.eye(cov.shape[0]))
        mat = a @ chol
        pf_stdev = np.linalg.norm(mat, axis=1)
    elif method == "svd":
        assert(cov is not None)
        u, s, vh = np.linalg.svd(cov, hermitian=True)
        mat = (a @ u) @ np.sqrt(np.diag(s))
        pf_stdev = np.linalg.norm(mat, axis=1)
    elif method == "loop":
        assert(cov is not None)
        tmp = np.dot(a, cov)
        pf_stdev = np.empty(a.shape[0])
        for ipt in range(a.shape[0]):
            pf_stdev[ipt] = np.sqrt(np.dot(tmp[ipt, :], a[ipt, :]))
    elif method == "fullcov":
        assert(cov is not None)
        pf_stdev = np.sqrt(np.diag((a @ cov) @ a.T))
    else:
        pf_stdev = np.zeros(a.shape[0])
    return pf_stdev