Skip to content

Make a numeric trait for functions on Var and f64 #2

@al-jshen

Description

@al-jshen

Something like

impl Numeric {
  fn ln(self) -> Self;
  // .. and other functions...
}

impl Numeric for f64 {
  fn ln(self) -> Self {
    self.ln()
  }
}

impl<'a> Numeric for Var<'a> {
  fn ln(self) -> Self {
    self.ln()
  }
}

Then other functions can be rewritten to take Numeric so the distinction between Var and f64 will be less clear. Most cases should pretty easy to implement since the functions for Var are already basically the same as for f64.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions