I have a custom array type, NDArray
in my own package which is templated on it element type and dimension like a normal Julia Array. The following code works totally fine if I define everything stand alone in the REPL, but fails when I place it inside of the package.
I’ve tried to define the function (as well as Base.:(*)
and LinearAlgebra.mul!
):
function mymultiply(rhs1::NDArray{A, 2}, rhs2::NDArray{B, 2}) where {A,B}
...
end
but always get a method error:
julia> mymultiply(a, b)
ERROR: MethodError: no method matching mymultiply(::NDArray{Float32, 2}, ::NDArray{Float32, 2})
Stacktrace:
[1] top-level scope
@ REPL[48]:1
This is super confusing to me because these are the inputs and the method is visible tomethods
.
julia> typeof(a)
NDArray{Float32, 2}
julia> typeof(b)
NDArray{Float32, 2}
julia> methods(mymultiply)
# 1 method for generic function "mymultiply" from Main:
[1] mymultiply(rhs1::NDArray{A, 2}, rhs2::NDArray{B, 2}) where {A, B}
@ REPL[45]:1