def _complex_dtype(dtype):
    """Patched version of :func:`sporco.linalg.complex_dtype`."""

    dt = cp.dtype(dtype)
    if dt == cp.dtype('float128'):
        return cp.dtype('complex256')
    elif dt == cp.dtype('float64'):
        return cp.dtype('complex128')
    else:
        return cp.dtype('complex64')