You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

39 lines
684 B

5 years ago
  1. class ZnField {
  2. constructor(n) {
  3. this.n = n;
  4. }
  5. add(a, b) {
  6. const maxGrade = Math.max(a.length, b.length);
  7. const res = new Array(maxGrade);
  8. for (let i=0; i<maxGrade; i++) {
  9. res[i] = this.F.add(a[i], b[i]);
  10. }
  11. return this._reduce(res);
  12. }
  13. sub(a, b) {
  14. // TODO
  15. throw new Error("Not Implementted");
  16. }
  17. mul(a, b) {
  18. // TODO
  19. throw new Error("Not Implementted");
  20. }
  21. inverse(a, b) {
  22. // TODO
  23. throw new Error("Not Implementted");
  24. }
  25. div(a, b) {
  26. // TODO
  27. throw new Error("Not Implementted");
  28. }
  29. }
  30. module.exports = ZnField;