Skip to content

Commit

Permalink
eigen_quad.sh: fix report (not a bug).
Browse files Browse the repository at this point in the history
  • Loading branch information
bradbell committed Dec 29, 2015
1 parent 0496d42 commit 7823e24
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions bug/eigen_quad.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,12 @@ echo_eval() {
}
# -----------------------------------------------
cat << EOF
Function f(x) = x^T * Q * x / 2
f'(x) = x^T * Q
Function:
f(x) = x^T * Q * x / 2
Note that the derivative of f(x) is given by:
f'(x) = [ x^T * Q + (Q * x)^T ] / 2
= x^T * (Q * Q^T) / 2
EOF
# -----------------------------------------------
if [ ! -e build ]
Expand Down Expand Up @@ -68,7 +72,7 @@ int main()
ADFun<double> f(a_x, a_y);
VectorXd jac = f.Jacobian(x);
a_MatrixXd a_check_jac = a_x.transpose() * a_Q;
a_MatrixXd a_check_jac = a_x.transpose() * (a_Q + a_Q.transpose()) / a_two;
std::cout << "True f'(x) = " << a_check_jac << std::endl;
Expand Down

0 comments on commit 7823e24

Please sign in to comment.