qd block algorithm