Skip to content

Code review #9

Description

@slendidev
  • PolynomialSurface::fit can be made to take in a std::span instead of a vector reference.
  • PolynomialSurface::getCoefficients can have it's implementation put in the header for better inlining.
  • All doubles can be replaced with a templated type T, defaulted to double if you like, things like Eigen::MatrixXd can then be replaced with Eigen::Matrix<T, Dynamic, Dynamic>.
  • In implementation, numTerms can be made consteval.
  • Most functions can have their arguments be const, same as some variables in them like coeffs in fit.
  • In PolynomialSurface::evaluate you can replace the for loop and result with this:
return std::inner_product(
  mono.begin(),
  mono.end(),
  coefficients_.begin(),
  0
);
  • In the header, this:
    PolynomialSurface(int degree);  // Constructor: specify degree of polynomial

can be replaced with:

    PolynomialSurface(int degree_of_polynomial);
  • Getters can be constexpr

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingenhancementNew feature or requesthelp wantedExtra attention is needed

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions