• R/O
  • SSH

Commit

Tags

Frequently used words (click to add to your profile)

javaandroidc++linuxc#objective-ccocoa誰得qtrubypythonwindowsphpgamebathyscapheguic翻訳omegattwitterframeworkbtronvb.net計画中(planning stage)testdomarduinodirectxpreviewerゲームエンジン

A small kernel of code for playing with Galois fields of arbitrary characteristic


Commit MetaInfo

Revisione00c7a17d072c7364b46ea1da2ad3bdd41fea797 (tree)
Time2017-12-07 04:14:44
AuthorEric Hopper <hopper@omni...>
CommiterEric Hopper

Log Message

gf.py shouldn't be executable.

Change Summary

Incremental Difference

diff -r 4d87ce9474a0 -r e00c7a17d072 lagrange.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/lagrange.py Wed Dec 06 11:14:44 2017 -0800
@@ -0,0 +1,13 @@
1+import polyops
2+import fractions
3+from functools import reduce
4+
5+xlst = [1, 2, 3, 7, 12]
6+ylst = [9, 10, 5, 4, 1]
7+
8+master_poly = reduce(polyops.polymul, ((-x, 1) for x in xlst), (1,))
9+master_poly = polyops.polyscalarmul(master_poly, fractions.Fraction(1, 1))
10+xpolys = [polyops.polydiv(master_poly, (-x, 1))[0] for x in xlst]
11+xpolys = [polyops.polyscalarmul(xp, y / polyops.evalpoly(xp, x))
12+ for xp, x, y in zip(xpolys, xlst, ylst)]
13+interp = reduce(polyops.polyadd, xpolys, ())