Function type declaration

You probably want to write this:

function fun3(feat1::AbstractVector, feat2::AbstractMatrix)
    feat1' * feat2
end

Or leave off the types entirely, they only act to restrict when this method will be called, and don’t affect speed.

Note that fun1 is a global variable which happens to contain an anonymous function, while fun3 is… more like a const, I’m not too sure of the right term. But I think this can lead to performance problems with fun1.

Constructing a struct should be free, if it helps organise your thoughts.

2 Likes