Inconsistant precision?

And if you think the function might be used in many different contexts, like somebody calls it with fun(mat'), the adjoint of mat, which is of type Adjoint, you should consider using the signature fun(m::AbstractMatrix{<:Complex}). This will allow various subtypes of matrices as well, like Hermitian, Diagonal, Adjoint, Bidiagonal etc. Then it will work as now, and you can later add specializations for these with e.g. function fun(m::Diagonal{<:Complex}) ..., if needed.

Though with AbstractMatrix comes a Pandora’s box of indexing. Somebody might have a matrix with indices starting at -23 or some such stuff. There exists stuff for handling such things, it’s described in the manual.

1 Like