qlat_utils.g_mk_jk

qlat_utils.g_mk_jk(data_list, jk_idx_list, *, avg=None, jk_type, all_jk_idx, get_all_jk_idx, n_rand_sample, rng_state, jk_blocking_func, is_normalizing_rand_sample, is_apply_rand_sample_jk_idx_blocking_shift, is_use_old_rand_alg, is_hash_jk_idx, jk_idx_hash_size, eps, is_sync_node=False, **_kwargs)[source]

Create a (randomized) Super-Jackknife data set from un-jackknifed data.

jk_arr[0] is the average of the data and jk_arr[1:] are the resampled values, from which the error is estimated with g_jk_avg_err. The data set has g_jk_size() samples, i.e. 1 + n_rand_sample for jk_type == "rjk" and 1 + len(all_jk_idx) for jk_type == "super", and its dtype is the dtype of the data.

Parameters:
  • data_list – the un-jackknifed data, a list or np.ndarray of values (each value being a float, a complex or an np.ndarray); None entries are ignored. For the collective MPI variants below the data must have a dtype supported by MPI.

  • jk_idx_list – the indices that name the entries of data_list, with len(jk_idx_list) == len(data_list), usually jk_idx_list = [(job_tag, traj,) for traj in traj_list]. The indices are mapped to the jackknife blocks by jk_blocking_func (see jk_blocking_func_default, block_size and block_size_dict).

  • avg – the average of the data; when None (the default) it is computed from data_list. Pass a precomputed value to reuse it (it must be the average of the whole data set).

  • is_sync_node – when True, the operation is performed by g_mk_jk_sync_node, i.e. as a collective MPI operation in which every node holds the whole data set, every node must call this function with the same parameters, and every node obtains the complete jk_arr. Use g_mk_jk_distributed instead when the data set itself is split between the nodes. Both jk_type values are supported; the result agrees with the is_sync_node=False result up to the floating-point roundoff.

Returns:

the (randomized) Super-Jackknife data set jk_arr.

The other keyword parameters are the entries of default_g_jk_kwargs, which supplies their defaults; set them there, pass them explicitly or use the q.JkKwargs(...) context manager. The most commonly used are:

  • jk_type: "rjk" (the default) or "super".

  • eps (default 1): the overall scale of the fluctuations; when the data is already jackknifed, multiply it by len(data_list).

  • n_rand_sample (default 1024): the number of random samples of "rjk".

  • is_normalizing_rand_sample, is_apply_rand_sample_jk_idx_blocking_shift and is_use_old_rand_alg: options of the random numbers of "rjk".

  • is_hash_jk_idx, jk_idx_hash_size, all_jk_idx and get_all_jk_idx: the samples of "super".

  • block_size, block_size_dict and jk_blocking_func: the jackknife blocks.

  • rng_state: the random numbers of "rjk".

See rjackknife and sjackknife for the formulas, and docs/qlat-utils/qlat_data.md for the full documentation.

Example::

jk_arr = q.g_mk_jk(data_list, jk_idx_list) avg, err = q.g_jk_avg_err(jk_arr)