Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change MathematicalProgram::x_initial_guess_ from Eigen::VectorXd to std::vector<double> #22203

Open
hongkai-dai opened this issue Nov 16, 2024 · 1 comment
Assignees
Labels
component: mathematical program Formulating and solving mathematical programs; our autodiff and symbolic libraries type: feature request

Comments

@hongkai-dai
Copy link
Contributor

When we need to push new entries to an array, using std::vector is much faster than Eigen::Vector.

Currently MathematicalProgram::x_initial_guess_ has the type of Eigen::VectorXd, and we often call conservativeResize on this vector, which is slow. I think it is better to change its type to std::vector<double>. And the return type of its getter function will be changed from Eigen::VectorXd to Eigen::Map<const Eigen::VectorXd>

Eigen::Map<const Eigen::VectorXd> MathematicalProgram::x_initial_guess() const {
}

@jwnimmer-tri WDYT?

@hongkai-dai hongkai-dai self-assigned this Nov 16, 2024
@hongkai-dai hongkai-dai added the component: mathematical program Formulating and solving mathematical programs; our autodiff and symbolic libraries label Nov 16, 2024
@jwnimmer-tri
Copy link
Collaborator

I think we should never pursue any performance improvement without first building a peer-reviewed, application-level benchmark that demonstrates the symptom.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: mathematical program Formulating and solving mathematical programs; our autodiff and symbolic libraries type: feature request
Projects
None yet
Development

No branches or pull requests

2 participants