NumericExtensions.jl icon indicating copy to clipboard operation
NumericExtensions.jl copied to clipboard

Can't Define New Functors Using Numeric Extensions 0.6.2 in Julia 0.3.3

Open mikewojnowicz opened this issue 10 years ago • 1 comments

Hi everyone, I am an R and MATLAB user who is moving to Julia. I am trying the Numeric Extensions package. In the documentation (http://numericextensionsjl.readthedocs.org/en/latest/functors.html), they show an example of how to define a new functor: type SqrDiff <: Functor{2} end

NumericExtensions.evaluate(::SqrDiff, x, y) = abs2(x - y)

However, when I try to apply this new functor, I get this result:

julia> type SqrDiff <: Functor{2} end julia> NumericExtensions.evaluate(::SqrDiff, x, y) = abs2(x - y) evaluate (generic function with 143 methods) julia> x=ones(4)_5 julia> y=ones(4)_2 julia> map(SqrDiff(),x,y) ERROR: SqrDiff not defined julia> map(NumericExtensions.SqrDiff(),x,y) ERROR: SqrDiff not defined

Any ideas about what the problem is? I have no problem with

julia> map(NumericExtensions.Multiply(),x,y)

mikewojnowicz avatar Dec 19 '14 20:12 mikewojnowicz

PS - I've asked this same question at: https://groups.google.com/forum/?fromgroups=#!topic/julia-users/uEEXwk1G89I

mikewojnowicz avatar Dec 19 '14 22:12 mikewojnowicz