The use of direct convolution products in profile and pattern fitting algorithms. I. Development of algorithms