Okay, one more big crazy idea.
Maybe we should have one package for complex and real matrices. This would exist at gonum/matrix (or possibly gonum/mat -- it's going to be used a lot).
If we ever want to support single precision versions, those can exist at matrix/mat32
Downside: The complex signatures are uglier. I would propose that there be an appended "C", so it would be matrix.NewCDense, matrix.CMatrix, matrix.CDet.
- Reply: Compare cmat128.Dense and matrix.CDense. They both need that extra "C" moniker anyway, we're just shifting its location. If we switch to "mat", it's actually fewer characters as well; mat.CDense.
- Reply: In the signature of CMatrix, Dims() can be the same, and instead of T() we have H(). CAt() is by far the ugliest consequence, but I'm okay with that given the alternative
Downside: It breaks everything.
- Reply: We're going to be breaking everything anyway when we move to
gonum.org. May as well follow in go's footsteps and transition into 1.0 with a bang
Upside: No conversion types
- The whole conv package is ugly and confusing. I've been thinking on and off about this, and I don't see a better way.
- As is, conv doesn't even solve the problem -- it is hard to write a function in mat64 that returns a complex matrix to then be used by cmat128. Circular imports really hurt here.
- The fact of the matter is, there are a fair number of functions that start with a matrix of real/complex and return the other. The most obvious is Eigen, which can return complex eigenvectors. In the other direction, there are operations like A^H * A that produce a real symmetric matrix. If the two are the same package, the solution is easy
CDense.Eigenvectors(eigen *Eigen)
SymDense.CSymOuterK(cmat *CMatrix)
If they are in different packages, then there has to be something like a shell type for CDense that gets passed into conv to return a cmat128.Dense. Not pretty or intuitive. These kinds of runarounds suggest to me that it really should be one package
Upside: No numbers in the signatures
Much more minor than the previous point, but mat.Dense is much nicer than mat64.Dense
Upside: No common package
- There are already a large number of items that are shared in common between the two packages, including almost all of the package documentation.
Not a downside: Static typing
One may think that a common package would increase the coding errors, but for us static typing makes that a non-issue.