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

Chebyshev2 Improvements #1660

Merged
merged 14 commits into from
Dec 6, 2023
Merged

Chebyshev2 Improvements #1660

merged 14 commits into from
Dec 6, 2023

Conversation

varunagrawal
Copy link
Collaborator

According to Trefethen, given N, we should form a polynomial with N+1 nodes, but we form a polynomial with N nodes (which is mathematically a N-1 degree polynomial).

Hence one of the bigger changes of this PR is to form a polynomial over N+1 nodes. This makes our code correspond directly to the math and makes comparison to Chebfun much easier.

Additionally, I've tightened some bounds checks and improved the overall API.

@varunagrawal varunagrawal requested a review from dellaert October 23, 2023 22:17
@varunagrawal varunagrawal self-assigned this Oct 23, 2023
@dellaert
Copy link
Member

I wish you had done a design review with me first. I don’t support the change in the meaning of N without extensive discussion…

Copy link
Member

@dellaert dellaert left a comment

Choose a reason for hiding this comment

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

Let’s talk first

@varunagrawal
Copy link
Collaborator Author

I don’t support the change in the meaning of N without extensive discussion…

I've been using Chebfun and the mental gymnastics of relating that to our implementation was getting to me. I believe we were wrong to have polynomials of degree N (instead of N+1) for the specified degree N.

@varunagrawal varunagrawal requested a review from dellaert November 6, 2023 13:29
@varunagrawal
Copy link
Collaborator Author

@dellaert as discussed offline, I have reverted the change to go back to using order N polynomials (degree N-1) instead of order N+1 (degree N).

Copy link
Member

@dellaert dellaert left a comment

Choose a reason for hiding this comment

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

Some questions. I don't see ParameterMatrix as an added value, just more code to maintain?

@@ -83,6 +86,11 @@ class GTSAM_EXPORT Chebyshev2 : public Basis<Chebyshev2> {
return points;
}

/// Return a zero initialized Parameter matrix.
static Parameters ParameterMatrix(size_t N) {
Copy link
Member

Choose a reason for hiding this comment

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

I don't see why we can't just say Zero(N) ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes this needs to be removed since it was added for the previous change of N to N+1. Removing.

*
* Overriden for Chebyshev2.
*/
static Matrix WeightMatrix(size_t N, const Vector& X, double a = -1,
Copy link
Member

Choose a reason for hiding this comment

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

Where is this used? Just being worried about this MxN matrix being confused with the other MxN matrix that is used for VectorEvaluators. But I remember we talked about this as a speedup in some scenarios?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This needs to be removed too.

@varunagrawal
Copy link
Collaborator Author

@dellaert okay addressed all comments. :)

@varunagrawal varunagrawal requested a review from dellaert December 5, 2023 19:14
@dellaert dellaert merged commit 36f7736 into develop Dec 6, 2023
30 checks passed
@varunagrawal varunagrawal deleted the chebyshev-improvements branch December 7, 2023 22:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants