I am to extend the scalar case of a gradient of a function, i.e.,
foo = Vector{Function}(undef,2)
gnu = Vector{Function}(undef,2)
foo[1] = (x,y) -> x+y
foo[2] = (x,y) -> x-y
A = [1. 2.; 3. 4.]
gnu = (x,y) -> B * [foo[1](x,y),foo[2](x,y)]
to the case of a vector of gradient of functions
ndof = 3
foo = Vector{Vector}(undef,ndof)
gnu = Vector{Vector}(undef,ndof)
for i=1:ndof
foo[i] = Vector{Function}(undef,2)
gnu[i] = Vector{Function}(undef,2)
end
foo[1][1] = (x,y) -> x+y
foo[1][2] = (x,y) -> x-y
foo[2][1] = (x,y) -> 2*x+2*y
foo[2][2] = (x,y) -> 2*x-2*y
foo[3][1] = (x,y) -> 3*x+3*y
foo[3][2] = (x,y) -> 3*x-3*y
A = [1. 2.; 3. 4.]
for i=1:ndof
gnu[i][:] .= (x,y) -> A * [foo[i][1](x,y);foo[i][2](x,y)]
end
Help is appreciated.