@@ -32,7 +32,7 @@ enum AccuracyOrder {
3232 * @param[in] eps Value of the finite difference step.
3333 */
3434void finite_gradient (
35- const Eigen::VectorXd& x,
35+ const Eigen::Ref< const Eigen:: VectorXd> & x,
3636 const std::function<double (const Eigen::VectorXd&)>& f,
3737 Eigen::VectorXd& grad,
3838 const AccuracyOrder accuracy = SECOND,
@@ -48,7 +48,7 @@ void finite_gradient(
4848 * @param[in] eps Value of the finite difference step.
4949 */
5050void finite_jacobian (
51- const Eigen::VectorXd& x,
51+ const Eigen::Ref< const Eigen:: VectorXd> & x,
5252 const std::function<Eigen::VectorXd(const Eigen::VectorXd&)>& f,
5353 Eigen::MatrixXd& jac,
5454 const AccuracyOrder accuracy = SECOND,
@@ -64,7 +64,7 @@ void finite_jacobian(
6464 * @param[in] eps Value of the finite difference step.
6565 */
6666void finite_hessian (
67- const Eigen::VectorXd& x,
67+ const Eigen::Ref< const Eigen:: VectorXd> & x,
6868 const std::function<double (const Eigen::VectorXd&)>& f,
6969 Eigen::MatrixXd& hess,
7070 const AccuracyOrder accuracy = SECOND,
@@ -81,8 +81,8 @@ void finite_hessian(
8181 * @return A boolean for if x and y are close to the same value.
8282 */
8383bool compare_gradient (
84- const Eigen::VectorXd& x,
85- const Eigen::VectorXd& y,
84+ const Eigen::Ref< const Eigen:: VectorXd> & x,
85+ const Eigen::Ref< const Eigen:: VectorXd> & y,
8686 const double test_eps = 1e-4 ,
8787 const std::string& msg = " compare_gradient " );
8888
@@ -97,8 +97,8 @@ bool compare_gradient(
9797 * @return A boolean for if x and y are close to the same value.
9898 */
9999bool compare_jacobian (
100- const Eigen::MatrixXd& x,
101- const Eigen::MatrixXd& y,
100+ const Eigen::Ref< const Eigen:: MatrixXd> & x,
101+ const Eigen::Ref< const Eigen:: MatrixXd> & y,
102102 const double test_eps = 1e-4 ,
103103 const std::string& msg = " compare_jacobian " );
104104
@@ -113,15 +113,15 @@ bool compare_jacobian(
113113 * @return A boolean for if x and y are close to the same value.
114114 */
115115bool compare_hessian (
116- const Eigen::MatrixXd& x,
117- const Eigen::MatrixXd& y,
116+ const Eigen::Ref< const Eigen:: MatrixXd> & x,
117+ const Eigen::Ref< const Eigen:: MatrixXd> & y,
118118 const double test_eps = 1e-4 ,
119119 const std::string& msg = " compare_hessian " );
120120
121121// / @brief Flatten the matrix rowwise
122- Eigen::VectorXd flatten (const Eigen::MatrixXd& X);
122+ Eigen::VectorXd flatten (const Eigen::Ref< const Eigen:: MatrixXd> & X);
123123
124124// / @brief Unflatten rowwise
125- Eigen::MatrixXd unflatten (const Eigen::VectorXd& x, int dim);
125+ Eigen::MatrixXd unflatten (const Eigen::Ref< const Eigen:: VectorXd> & x, int dim);
126126
127127} // namespace fd
0 commit comments