Change static casts to suppress warnings.

These static casts would throw away the first value in
the pair rather than creating a complex number from them.
This is fixed by creating an explicit complex number which is
cast to the templated types
Same here
And a final one