Overload the support functions for SSQ2
Because any overloaded functions must be the same as those
in the declaration of the aggregate, you must overload ssq2_iter and ssq2_combine to
extend the SSQ2 aggregate to the complex data type.
CREATE FUNCTION ssq2_iter (partial complex, c complex)
RETURNING complex;
RETURN ROW (
(partial.real + c.real*c.real - c.imag*c.imag),
(partial.imag + 2*c.real*c.imag)
)::complex;
END FUNCTION;
CREATE FUNCTION ssq2_combine(p1 complex, p2 complex)
RETURNING complex;
RETURN ROW(p1.real + p2.real,
p1.imag + p2.imag)::complex;
END FUNCTION;