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

refactor energy #488

Closed
7 tasks done
yunfanzhou opened this issue Nov 2, 2023 · 1 comment · Fixed by #506
Closed
7 tasks done

refactor energy #488

yunfanzhou opened this issue Nov 2, 2023 · 1 comment · Fixed by #506
Assignees

Comments

@yunfanzhou
Copy link
Collaborator

yunfanzhou commented Nov 2, 2023

  • Refactor Function class. a Function can be written as f(x) where the "x" is the input variable. In our implementations, "x" will be represented as an object of the Simplex type (a tuple + the cell type). The member function get_value(x) will return the value of f(x).

  • Refactor DifferentaibleFunction class. This is a child class of Function class. It will have the functions for differentiations: get_grad(x), get_hess(x).

  • PSF can be written as psf(pi), where pi is the domain the function is defined on. PSF is no longer a child class of Function since the domain is different

  • PSDF inherits from only PSF. The per simplex differentials take two arguments: the domain and the variable.We defineget_grad(pi, x) for example, where pi is the domain, x is the variable

  • LocalFunction has a pointer to PSF as a member variable. The member function is get_value(x), where the variable x is an object of the Simplex class that holds the information of the primitive type of the variable

  • LDF is a child class of LocalF and DiffF

  • add get_variable function. This polymorphic function has two APIs: i) have a single domain_simplex as the argument and return three coordinates of double type. ii) have domain_simplex and variable_simplex as arguments and return three coordinate of DScalar autodiff type, where the variable that the function is differentiated wrt has the gradient bit in the DScalar type flipped to 1. This function stays in AutoDiffFunction class for now

@yunfanzhou yunfanzhou self-assigned this Nov 2, 2023
@yunfanzhou
Copy link
Collaborator Author

yunfanzhou commented Nov 2, 2023

  1. In AutodiffFunction: change get_value_autodiff to get_function_autodiff, since this member function de facto encodes the Function defined over a specific domain wrt the variable using the autodiff convention. The function signature is
    get_function_autodiff(const Simplex& domain_simplex, const Simplex& variable_simplex)

@yunfanzhou yunfanzhou linked a pull request Nov 9, 2023 that will close this issue
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 a pull request may close this issue.

1 participant