qlat_utils.rjackknife

qlat_utils.rjackknife(data_list, jk_idx_list, *, avg=None, rng_state=None, n_rand_sample=None, jk_blocking_func=None, is_normalizing_rand_sample=False, is_apply_rand_sample_jk_idx_blocking_shift=True, is_use_old_rand_alg=False, eps=1, is_sync_node=False)[source]

Jackknife-bootstrap hybrid resampling. Return jk_arr. len(jk_arr) == 1 + n_rand_sample distribution of jk_arr should be similar as the distribution of avg. r_{i,j} ~ N(0, 1)n ::n

if is_normalizing_rand_sample:

n_j = sum_i r_{i,j}^2 r_{i,j} <- sqrt{n_rand_sample / n_j} r_{i,j}

data_list_real = [d for d in data_list if d is not None] data_arr = np.array(data_list_real, dtype=dtype) avg = average(data_arr) len(data_list_real) = n jk_arr[0] = avg jk_arr[i] = avg + sum_{j=1}^{n} (-eps/sqrt{n (n - b(i,j))}) r_{i,j} (data_list_real[j] - avg)n

where b(i,j) represent the block_size.n if jk_blocking_func is provided::n

jk_blocking_func(i, jk_idx) => blocked jk_idxn

::n

jk_arr[i] = avg + sum_{j=1}^{n} r_{i,jk_block_func(j)} (jk_arr[j] - avg)n

If is_sync_node is True:n

Assume this is a collective operation in a MPI program where every node have the same input. The operation is performed by rjackknife_sync_node, which splits the input between the nodes and calls rjackknife_distributed; every node obtains the complete jk_arr, which agrees with the one obtained with is_sync_node=False up to the floating-point roundoff (not bit-for-bit, because the average and the sums over the data set are reduced across the nodes). qlat (used for q.get_comm()) and mpi4py are imported only when is_sync_node is True.