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

Internal derivative helpers #8

Open
davepagurek opened this issue Jul 9, 2021 · 0 comments
Open

Internal derivative helpers #8

davepagurek opened this issue Jul 9, 2021 · 0 comments
Labels
enhancement New feature or request

Comments

@davepagurek
Copy link
Owner

Some functions (e.g. mix or even tan) can define their derivatives based on the derivatives of other existing ops. We don't want to fully define these using existing ops, though, because we still want our outputted GLSL to use more optimized functions where available (the tan op should use tan(x) instead of sin(x)/cos(x) for its definition even if the derivative is defined using other ops.) To accommodate this, we could have an internal derivative creator system:

class Tan extends Op {
  derivative(param: Param) {
    return createDerivative((d) => d.sin().div(d.cos())).gen(param)
  }
  // ...etc
}
@davepagurek davepagurek added the enhancement New feature or request label Jul 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant