Skip to content

Commit

Permalink
addition between referenced and non-referenced values
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicole authored and Nicole committed Oct 28, 2024
1 parent fc68bea commit 0a50704
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions math/src/circle/point.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,24 @@ impl<F: IsField + HasCircleParams<F>> Add for &CirclePoint<F> {
CirclePoint { x, y }
}
}
impl<F: IsField + HasCircleParams<F>> Add<CirclePoint<F>> for CirclePoint<F> {
type Output = CirclePoint<F>;
fn add(self, rhs: CirclePoint<F>) -> Self::Output {
&self + &rhs
}
}
impl<F: IsField + HasCircleParams<F>> Add<CirclePoint<F>> for &CirclePoint<F> {
type Output = CirclePoint<F>;
fn add(self, rhs: CirclePoint<F>) -> Self::Output {
self + &rhs
}
}
impl<F: IsField + HasCircleParams<F>> Add<&CirclePoint<F>> for CirclePoint<F> {
type Output = CirclePoint<F>;
fn add(self, rhs: &CirclePoint<F>) -> Self::Output {
&self + rhs
}
}

/// Multiplication between a point and a scalar (i.e. group operation repeatedly):
/// (x, y) * n = (x ,y) + ... + (x, y) n-times.
Expand Down

0 comments on commit 0a50704

Please sign in to comment.