I’m new to Julia.
I want to develop code that combines broadcasting with the @macro for a 3D array like the one below. How can I solve this?
function func(a,b,c)
return sin(a+b+c)
end
func.([0.1, 0.2, 0.3, 0.4], [0.1, 0.2, 0.3, 0.4], [0.1, 0.2, 0.3, 0.4])
@. func.(sys.k_mesh, sys.k_mesh', reshape(sys.k_mesh, 1, 1, :))
By the way, when I use the following code, I get this error:
MethodError: no method matching reshape(::Float64, ::Int64, ::Int64, ::Colon)
Closest candidates are:
reshape(!Matched::OffsetArrays.OffsetArray, ::Union{Colon, Int64}...)
@ OffsetArrays ~/.julia/packages/OffsetArrays/rMTtC/src/OffsetArrays.jl:383
reshape(!Matched::AbstractArray, ::Union{Colon, Int64}...)
@ Base reshapedarray.jl:118
reshape(!Matched::AbstractArray, ::Union{Colon, Integer, AbstractUnitRange}...)
@ OffsetArrays ~/.julia/packages/OffsetArrays/rMTtC/src/OffsetArrays.jl:351
...