Use ruffini for calculatig lagrange polinomials

This commit is contained in:
Jordi Baylina
2018-09-04 07:13:24 +02:00
parent 2910b7cf7d
commit 2cf2803019
9 changed files with 63 additions and 290 deletions

View File

@@ -141,5 +141,14 @@ describe("Polinomial field", () => {
assert(PF.F.equals(v, points[i][1]));
}
});
it("Should test ruffini", () => {
const PF = new PolField(new ZqField(r));
const a = [bigInt(1), bigInt(2), bigInt(3), bigInt(4), bigInt(5),bigInt(6), bigInt(7)];
const b = PF.mul(a, [bigInt(-7), bigInt(1)]);
const c = PF.ruffini(b, bigInt(7));
assert(PF.equals(a, c));
});
});

View File

@@ -2,11 +2,11 @@ const chai = require("chai");
const bigInt = require("../src/bigint.js");
const ZqField = require("../src/zqfield.js");
const RatZqField = require("../src/ratzqfield.js");
const RatField = require("../src/ratfield.js");
const q = bigInt("21888242871839275222246405745257275088548364400416034343698204186575808495617");
const Z = new ZqField(q);
const R = new RatZqField(Z);
const R = new RatField(Z);
const assert = chai.assert;