Spaces:
Running
Running
File size: 532 Bytes
e17e8cc |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
"""This code is taken from <https://github.com/alexandre01/deepsvg>
by Alexandre Carlier, Martin Danelljan, Alexandre Alahi and Radu Timofte
from the paper >https://arxiv.org/pdf/2007.11301.pdf>
"""
import math
def get_roots(a, b, c):
if a == 0:
if b == 0:
return []
return [-c / b]
r = b * b - 4 * a * c
if r < 0:
return []
elif r == 0:
x0 = -b / (2 * a)
return [x0]
x1, x2 = (-b - math.sqrt(r)) / (2 * a), (-b + math.sqrt(r)) / (2 * a)
return x1, x2
|