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

Implements symbolic::Polynomial::Roots() #20161

Merged
merged 1 commit into from
Sep 11, 2023

Conversation

RussTedrake
Copy link
Contributor

@RussTedrake RussTedrake commented Sep 9, 2023

For finding the roots of univariate polynomials.
Towards #20159.

+@hongkai-dai for feature review, please.


This change is Reviewable

Copy link
Contributor

@hongkai-dai hongkai-dai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

Reviewed 4 of 6 files at r1.
Reviewable status: 1 unresolved discussion, needs platform reviewer assigned, needs at least two assigned reviewers, missing label for release notes (waiting on @RussTedrake)


common/symbolic/polynomial.h line 349 at r1 (raw file):

  /// Returns the roots of a _univariate_ polynomial with constant coefficients
  /// as a column vector.
  ///

nit. Maybe add a note that we don't guarantee a specific ordering of the roots in the returned value?

Copy link
Contributor Author

@RussTedrake RussTedrake left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: needs platform reviewer assigned, needs at least two assigned reviewers, missing label for release notes (waiting on @RussTedrake)


common/symbolic/polynomial.h line 349 at r1 (raw file):

Previously, hongkai-dai (Hongkai Dai) wrote…

nit. Maybe add a note that we don't guarantee a specific ordering of the roots in the returned value?

Done.

Copy link
Contributor

@hongkai-dai hongkai-dai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 3 of 3 files at r2.
Reviewable status: needs platform reviewer assigned, needs at least two assigned reviewers, missing label for release notes (waiting on @RussTedrake)

@jwnimmer-tri jwnimmer-tri added the release notes: feature This pull request contains a new feature label Sep 11, 2023
@jwnimmer-tri jwnimmer-tri self-assigned this Sep 11, 2023
Copy link
Collaborator

@jwnimmer-tri jwnimmer-tri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm: platform.

See RussTedrake#55 for some fixes.

Reviewed 3 of 6 files at r1, 3 of 3 files at r2, all commit messages.
Reviewable status: 3 unresolved discussions

a discussion (no related file):
BTW The macOS CI failure is real (tolerance failure). Be sure macOS is happy before merging this PR.



common/symbolic/polynomial.cc line 1061 at r2 (raw file):

    throw std::runtime_error(fmt::format(
        "{} is not a univariate polynomial; it has indeterminates {}.",
        ToExpression().to_string(), indeterminates().to_string()));

nit The formatting has a lot more syntax than necessary. See my PR.


common/symbolic/test/polynomial_test.cc line 1515 at r2 (raw file):

  // Note: the order of the roots is not guaranteed. Sort them here by real,
  // then imaginary.
  auto sort = [](const Eigen::VectorXcd& v) {

nit Verb vs adjective confusion. (Fixed in my PR.)

Suggestion:

sorted

Copy link
Contributor Author

@RussTedrake RussTedrake left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: :shipit: complete! all discussions resolved, LGTM from assignees jwnimmer-tri(platform),hongkai-dai

a discussion (no related file):

Previously, jwnimmer-tri (Jeremy Nimmer) wrote…

BTW The macOS CI failure is real (tolerance failure). Be sure macOS is happy before merging this PR.

Done.


For finding the roots of univariate polynomials.
Towards RobotLocomotion#20159.
Copy link
Collaborator

@jwnimmer-tri jwnimmer-tri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 3 of 3 files at r3, all commit messages.
Reviewable status: :shipit: complete! all discussions resolved, LGTM from assignees jwnimmer-tri(platform),hongkai-dai

@jwnimmer-tri jwnimmer-tri merged commit a6eebc9 into RobotLocomotion:master Sep 11, 2023
@RussTedrake RussTedrake deleted the roots branch September 17, 2023 10:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release notes: feature This pull request contains a new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants