ENH: More general boolean comparisons for complex_ops.h. Fix gh 2603.

Changes the boolean comparisons to function template. Fixes ambiguity errors/warnings while compiling.