Matrix & gen algos