Skip to content

Internal derivative helpers #8

@davepagurek

Description

@davepagurek

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
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions