Hey @scanon,
I have a follow up question to my previous question: Introducing Complex Numbers Update.
I have developed a prototype version of complex numbers as part of the Swift for TensorFlow project (can be found in the PR here). We have a VectorNumeric
protocol as well which defines any object that can exist in a vector space (found here). With complex number vectors, the dot product behaves differently in that it's something like this:
func dot(lhs: Vector<Complex>, rhs: Vector<Complex>) > Complex {
var result = Complex(real: 0, imaginary: 0)
for i in lhs.length {
resultVector = resultVector + (lhs[i].complexConjugate() * rhs[i])
}
return result
}
As such, we were debating on where complexConjugate
should exist, and also about whether a VectorNumeric
protocol is necessary.

In general, do you think a
VectorNumeric
protocol is necessary? Or could we use something else or maybe a different protocol. As it seems like a protocol would be needed for theSIMD
vectors we have, theTensor
type the S4TF team is adding, and any custom types users could add. 
Secondly, specifically regarding complex numbers, should
Numeric
refineVectorNumeric
? The reason why is that complex numbers can be thought of as both a scalar value and a vector:
...complex numbers with the complex plane...makes their structure as a real 2dimensional vector space evident. (wiki link)
Similarly, it could be argued that a real number is also a vector, except just a length 1 vector. Thus, could the Numeric
protocol refine VectorNumeric
? However, the biggest issue I see is ABI stability, which may prevent this.
 Lastly, also specific to complex numbers, should
VectorNumeric
definecomplexConjugate
? This follows from the second question in that complex conjugate seems to only be defined on complex numbers, and in other cases it would just returnself
. However, depending on the answer for 2, since complex numbers are like a vector of sorts, thenVectorNumeric
could define it.