Skip to content

jonbenronron/F2Matrices

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

F2Matrices

Description

Matrices and polynomials over field Z/2Z. Documentation for files will be found here.

Examples:

Example 1

a = F2Polynomial([1, 1, 1, 0])
b = F2Polynomial([0, 1, 0, 0])
c = F2Polynomial([1, 1, 1, 1])
d = F2Polynomial([1, 0, 1, 1])

f = F2Matrix([[a, b],
              [c, d]])
g = F2Matrix([[d, c],
              [b, a]])

h = f + g

print(str(f), " + \n")
print(str(g), " = \n")
print(str(h), "\n")

will print out:

|      1 + D + D^2,                 D|
|1 + D + D^2 + D^3,     1 + D^2 + D^3|  +

|    1 + D^2 + D^3, 1 + D + D^2 + D^3|
|                D,       1 + D + D^2|  =

|      D + D^3, 1 + D^2 + D^3|
|1 + D^2 + D^3,       D + D^3|

Example 2

a = F2Polynomial([1, 0, 0, 0])
b = F2Polynomial([1, 1, 0, 0])
c = F2Polynomial([1, 1, 1, 0])
d = F2Polynomial([1, 1, 1, 1])

f = F2Matrix([[a, b],
              [c, d]])

g = F2Matrix([[d, c],
              [b, a]])

h = f * g

print(str(f), " * \n")
print(str(g), " = \n")
print(str(h), "\n")

will print out:

|                1,             1 + D|
|      1 + D + D^2, 1 + D + D^2 + D^3|  *

|1 + D + D^2 + D^3,       1 + D + D^2|
|            1 + D,                 1|  =

|              D + D^3,                   D^2|
|D^2 + D^3 + D^4 + D^5,         D + D^3 + D^4|

Example 3

a = F2Polynomial([1, 0, 0, 0])
b = F2Polynomial([1, 1, 0, 0])
c = F2Polynomial([1, 1, 1, 0])
d = F2Polynomial([1, 1, 1, 1])

f = F2Matrix([[a, b],
              [c, d]])

h = f ** 2

print(str(f), " ** 2 = \n")
print(str(h), "\n")

will print out:

|                1,             1 + D|
|      1 + D + D^2, 1 + D + D^2 + D^3|  ** 2 =

|                  D^3,               D + D^4|
|        D + D^3 + D^5, D^2 + D^3 + D^4 + D^6|

State

  • F2Polynomial

    • __init__
    • __str__
    • degree
    • __add__
    • __iadd__
    • __mul__
    • __imul__
    • __pow__
    • evaluate
  • dotProduct

  • F2Matrix

    • __init__
    • __str__
    • __add__
    • __iadd__
    • transpose
    • __mul__
    • __imul__
    • __pow__
    • changeColumns
    • changeRows
    • addColumns
  • findPivot

  • smithNormalForm

About

Matrices for polynomials over field Z/2Z

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages