Skip to content

Commit

Permalink
ECIP: FIx line function case where exactly one of P or Q is Inf.
Browse files Browse the repository at this point in the history
  • Loading branch information
feltroidprime committed Jun 15, 2024
1 parent 57e82ed commit dac4311
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions tools/ecip/main.sage
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,16 @@ def init(_p, _r, _h, _A, _B):
def line(P, Q):
# [a, b, c] = Matrix([P, Q, -(P + Q)]).transpose().kernel().basis()[0]
# return a * x + b * y + c
if P == 0 and Q == 0:
return 1
if P == 0:
return 1 if Q == 0 else x - Q.xy()[0]
if Q == 0:
return x - P.xy()[0]

px, py = P.xy()

if P == Q:
m = (3 * px**2 + A) / (2 * py)
b = py - m * px
return -m * x + y - b

if P == -Q:
return x - px

Expand Down

0 comments on commit dac4311

Please sign in to comment.