Bug in check_jacobian when called with input_names and input_data
Summary
check_jacobian uses different inputs for analytical and approx jacobian if called with input_data and input_names
Gemseo version
6.0.0
Platform info
Windows
Steps to reproduce
from numpy import array
from gemseo import configure_logger, create_discipline
from gemseo.problems.mdo.sellar.variables import X_1, X_SHARED, Y_2
if __name__ == "__main__":
configure_logger()
sellar_1 = create_discipline("Sellar1")
input_data = {
X_1: array([3.0]),
X_SHARED: array([3.0, 3.0]),
Y_2: array([3.0]),
}
sellar_1.check_jacobian(
input_data=input_data,
input_names=[Y_2],
)
What is the current bug behavior?
The check_jacobian fails.
What is the expected correct behavior?
It should pass.
Possible fixes
This might be because in check_jacobian, linearize is called with input_data, but the approx jacobian is called with the default values for the variables that are not in input_names.
Thus, the analytical and approximated jacobians are evaluated at different inputs.