about to rearrange compute_k for better memory efficiency
fixed a memory bottleneck when B screening is enabled