% Basic implementation of the binding operator
% This function calculates the circular convolution 
% of two same sized real-valued vectors (x and y) and 
% returns a new same sized vector z that is normalized

% References:
%  Plate, T. A. (1994).
%  Distributed Representations and Nested Compositional Structure.
%  Ph. D. thesis, Department of Computer Science, University of Toronto,
%  Toronto, Canada.
%  http://internet.cybermesa.com/~champagne/tplate/
%
%  Plate, T. A. (2003).
%  Holographic Reduced Representation: Distributed Representation for
%  Cognitive Structures.
%  Center for the Study of Language and Information (CSLI).
%  ISBN-10: 1575864290, April 2003

% by Blerim Emruli, March 2012, eblerim@gmail.com

function z = cconv_fft(x,y)

if size(x,2) ~= size(y,2)

    error('vectors are not equally sized');

else

z = ifft(fft(x).*fft(y));
z = z/norm(z);

end
