I have an AutoVector type for which broadcast(,v,v) works but v . v doesn’t. The indexing is
more flexible than the usual type, so I don’t want it to be a subtype of AbstractVector. Here is
a drastically simplified set of code that illustrates the problem:
mutable struct AutoVector
dat::Vector{Float64}
end
import Base.broadcast
function broadcast(::typeof(*),x::AutoVector,y::AutoVector)
println("got here")
end
av = AutoVector([1.0])
println("Calling broadcast")
broadcast(*,av,av)
println("Calling .*")
av .* av
================================
This is julia 0.6.2
julia AV2.jl
Calling broadcast
got here
Calling .*
ERROR: LoadError: MethodError: no method matching *(::AutoVector, ::AutoVector)
Closest candidates are:
*(::Any, ::Any, !Matched::Any, !Matched::Any...) at operators.jl:424
Stacktrace:
[1] (::##1#2)(::AutoVector) at ./<missing>:0
[2] broadcast(::Function, ::AutoVector) at ./broadcast.jl:455
[3] include_from_node1(::String) at ./loading.jl:576
[4] include(::String) at ./sysimg.jl:14
[5] process_options(::Base.JLOptions) at ./client.jl:305
[6] _start() at ./client.jl:371
while loading /Users/srw/Dropbox/julia/Modules/AV2.jl, in expression starting on line 16