Defining function that accepts both FP32 and FP64

It is best practice to make the type signature as loose as possible to have generic and reusable code.

elim(A:: Matrix{<: AbstractFloat},...) # for accepting all Floats

or even

elim(A:: Matrix,...) # for all element types

Note that Matrix is a 2-dim array, which is probably a restriction that you want (1d or 3d arrays will not work in your code/ do not make sense).

Or is there a specific reason why you want to exclude integer element types?

6 Likes