def METHOD_NAME(q_large):
  tprs_full = dmtbx.triplet_generator(
    miller_set=q_large,
    discard_weights=True)
  tprs = dmtbx.triplet_generator(
    miller_set=q_large,
    amplitudes=q_large.data(),
    max_relations_per_reflection=0,
    discard_weights=True)
  assert tprs.n_relations().all_eq(tprs_full.n_relations())
  for n in (1,10,100,1000):
    tprs = dmtbx.triplet_generator(
      miller_set=q_large,
      amplitudes=q_large.data(),
      max_relations_per_reflection=n,
      discard_weights=True)
    assert (tprs.n_relations() >= n).all_eq(tprs.n_relations() == n)
  n = 3
  tprs = dmtbx.triplet_generator(
    miller_set=q_large,
    amplitudes=q_large.data(),
    max_relations_per_reflection=n,
    discard_weights=True)
  n_rel_full = tprs_full.n_relations()
  n_rel = tprs.n_relations()
  amp = q_large.data()
  for ih in range(q_large.indices().size()):
    if (n_rel[ih] == n_rel_full[ih]): continue
    aa_full = flex.double()
    for relation in tprs_full.relations_for(ih):
      aa_full.append(amp[relation.ik()] * amp[relation.ihmk()])
    aa = flex.double()
    for relation in tprs.relations_for(ih):
      aa.append(amp[relation.ik()] * amp[relation.ihmk()])
    aa_full = aa_full.select(flex.sort_permutation(data=aa_full, reverse=True))
    assert approx_equal(aa_full[:n], aa)