Skip to content

Commit

Permalink
fix broken poly __sub__
Browse files Browse the repository at this point in the history
  • Loading branch information
feltroidprime committed Aug 11, 2024
1 parent 677da04 commit 9b01c4c
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 3 deletions.
1 change: 1 addition & 0 deletions build/frobenius_cache/frobenius_0_6_1.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"k_expressions": [" + 0x1 * f_0 + 0x12 * f_3", " + 0x242b...21a7 * f_1 + 0x3598...2536 * f_4", " + 0x2c84...048b * f_2 + 0xc33b...a7b5 * f_5", " + 0x3064...fd46 * f_3", " + 0x16c9...cba2 * f_1 + 0xc38d...dba0 * f_4", " + 0x2c14...8126 * f_2 + 0x3df9...f8bc * f_5"], "constants_list": [[[0, 1], [3, 18]], [[1, 16360020762774556598013388786114916077431217727990580677342011753074458436007], [4, 1515075255943902619915209849611390435230609634891435693592219128690297546038]], [[2, 20136284445039654443521573293420200948986700144072064670248776058768820274315], [5, 5519090358942869774631834397357627544196820822321065521472227381981946161077]], [[3, 21888242871839275222246405745257275088696311157297823662689037894645226208582]], [[1, 10307601595873709700152284273816112264069230130616436755625194854815875713954], [4, 5528222109064718624233016959142359011265093429307242985347026141570767772576]], [[2, 19937756971775647987995932169929341994314640652964949448313374472400716661030], [5, 1751958426799620778724832451837074139709611013225758992440261835876405934268]]]}
1 change: 1 addition & 0 deletions build/frobenius_cache/frobenius_0_6_2.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"k_expressions": [" + 0x1 * f_0", " + 0x3064...fd48 * f_1", " + 0x59e2...fffe * f_2", " + 0x1 * f_3", " + 0x3064...fd48 * f_4", " + 0x59e2...fffe * f_5"], "constants_list": [[[0, 1]], [[1, 21888242871839275220042445260109153167277707414472061641714758635765020556616]], [[2, 2203960485148121921418603742825762020974279258880205651966]], [[3, 1]], [[4, 21888242871839275220042445260109153167277707414472061641714758635765020556616]], [[5, 2203960485148121921418603742825762020974279258880205651966]]]}
1 change: 1 addition & 0 deletions build/frobenius_cache/frobenius_0_6_3.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"k_expressions": [" + 0x1 * f_0 + 0x12 * f_3", " + 0xc3a5...3ae6 * f_1 + 0x2ce0...77f4 * f_4", " + 0x1bfe...9cc0 * f_2 + 0x697b...2fbd * f_5", " + 0x3064...fd46 * f_3", " + 0x4f1d...86de * f_1 + 0x2429...c261 * f_4", " + 0x23d5...239f * f_2 + 0x1465...6087 * f_5"], "constants_list": [[[0, 1], [3, 18]], [[1, 5530884290053922304144789698142497171615764627662268383765069573573149473510], [4, 20297833428213404246748847976138555224655679424027567639634210889891384752116]], [[2, 12662075878685592334176167466297648270258898084773409719342381002174283488448], [5, 2981953136242954199074806921510952041507639786040776490510130360411260071869]], [[3, 21888242871839275222246405745257275088696311157297823662689037894645226208582]], [[1, 2236595495967245188281701248203181795121068902605861227855261137820944008926], [4, 16357358581785352918101616047114777917080546529635555278923968321072076735073]], [[2, 16208900380737693084919495127334387981393726419856888799917914180988844123039], [5, 9226166993153682888070238278959626818437413072524413943346656892470942720135]]]}
1 change: 1 addition & 0 deletions build/frobenius_cache/frobenius_1_6_1.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"k_expressions": [" + 0x1 * f_0 + 0x2 * f_3", " + 0x5f19...ffff * f_1", " + 0x1a01...aaad * f_2 + 0x1a01...aaaf * f_5", " + 0x1a01...aaaa * f_3", " + 0x1a01...aaac * f_1 + 0x1a01...aaac * f_4", " + 0x5f19...fffe * f_5"], "constants_list": [[[0, 1], [3, 2]], [[1, 793479390729215512621379701633421447060886740281060493010456487427281649075476305620758731620351]], [[2, 4002409555221667392624310435006688643935503118305586438271171395842971157480381377015405980053539358417135540939437], [5, 4002409555221667391830831044277473131314123416672164991210284655561910664469924889588124330978063052796376809319087]], [[3, 4002409555221667393417789825735904156556882819939007885332058136124031650490837864442687629129015664037894272559786]], [[1, 4002409555221667392624310435006688643935503118305586438271171395842971157480381377015405980053539358417135540939436], [4, 4002409555221667392624310435006688643935503118305586438271171395842971157480381377015405980053539358417135540939436]], [[5, 793479390729215512621379701633421447060886740281060493010456487427281649075476305620758731620350]]]}
1 change: 1 addition & 0 deletions build/frobenius_cache/frobenius_1_6_2.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"k_expressions": [" + 0x1 * f_0", " + 0x5f19...fffe * f_1", " + 0x1a01...aaac * f_2", " + 0x1 * f_3", " + 0x5f19...fffe * f_4", " + 0x1a01...aaac * f_5"], "constants_list": [[[0, 1]], [[1, 793479390729215512621379701633421447060886740281060493010456487427281649075476305620758731620350]], [[2, 4002409555221667392624310435006688643935503118305586438271171395842971157480381377015405980053539358417135540939436]], [[3, 1]], [[4, 793479390729215512621379701633421447060886740281060493010456487427281649075476305620758731620350]], [[5, 4002409555221667392624310435006688643935503118305586438271171395842971157480381377015405980053539358417135540939436]]]}
1 change: 1 addition & 0 deletions build/frobenius_cache/frobenius_1_6_3.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"k_expressions": [" + 0x1 * f_0 + 0x2 * f_3", " + 0x1a01...aaaa * f_1", " + 0x1a01...aaaa * f_2 + 0x1a01...aaa9 * f_5", " + 0x1a01...aaaa * f_3", " + 0x1 * f_1 + 0x1 * f_4", " + 0x1 * f_5"], "constants_list": [[[0, 1], [3, 2]], [[1, 4002409555221667393417789825735904156556882819939007885332058136124031650490837864442687629129015664037894272559786]], [[2, 4002409555221667393417789825735904156556882819939007885332058136124031650490837864442687629129015664037894272559786], [5, 4002409555221667393417789825735904156556882819939007885332058136124031650490837864442687629129015664037894272559785]], [[3, 4002409555221667393417789825735904156556882819939007885332058136124031650490837864442687629129015664037894272559786]], [[1, 1], [4, 1]], [[5, 1]]]}
7 changes: 4 additions & 3 deletions hydra/algebra.py
Original file line number Diff line number Diff line change
Expand Up @@ -592,14 +592,15 @@ def __sub__(self, other: Polynomial) -> Polynomial:
)

ns, no = len(self.coefficients), len(other.coefficients)
coeffs = self.coefficients[:]
if ns >= no:
coeffs = self.coefficients[:]
for i in range(no):
coeffs[i] -= other.coefficients[i]
else:
coeffs = other.coefficients[:]
for i in range(ns):
coeffs[i] -= self.coefficients[i]
coeffs[i] -= other.coefficients[i]
for i in range(ns, no):
coeffs.append(-other.coefficients[i])

return Polynomial(
coeffs,
Expand Down

0 comments on commit 9b01c4c

Please sign in to comment.