General type of 2d arrays

Hi, all. I am writing a function of 2d array, in which xg and yg are designed to be any format of n x n array. But I always encounter the errors of TypeError of xg and yg. Is there any widely general type of 2d array to avoid this error?

function  Derivative(xg::Union{LazyGrids.GridSL, Matrix{Float64}},
         yg::Union{LazyGrids.GridSL, Matrix{Float64}})
AbstractMatrix

You can also generalize over the element type, by e.g. foo(AbstractMatrix{T}) where {T:<Real}, or even omitting the type parameter entiredly.

3 Likes