HomerReid / meep_adjoint

Adjoint-solver module for MEEP.
GNU General Public License v2.0
11 stars 4 forks source link

Multiply by basis partial #3

Open smartalecH opened 4 years ago

smartalecH commented 4 years ago

By the chain rule, shouldn't we also multiply the objective function derivative by the partial of the basis expansion functions?

For example, if our cost function is a function of the fields and the permittivity:

J(E_x,E_y, ...,ϵ)

usually, the permittivity is also a function of our basis functions (and maybe some other normalizing functions):

ϵ = f(g(h(p)))

where f, g, and h are all functions that relate our design vector p to the permittivity.

To go from ∂J / ∂ϵ to ∂J / ∂p, we need to apply the chain rule:

∂J / ∂p = (∂J / ∂ϵ) (∂ϵ / ∂p) = (∂J / ∂ϵ) (∂J / ∂ϵ) (∂f / ∂g) (∂g / ∂h) * (∂h / ∂p)

Note we can right multiply or left multiply (backpropagate) and get the same result. We would still need to project, but after we've backpropagated through the full chain.