Linear Algebra over Finite Fields and Generic Domains in Maple Simon Lo, Michael Monagan Department of Mathematics, Simon Fraser University Introduction.

Slides:



Advertisements
Similar presentations
Chapter 0 Review of Algebra.
Advertisements

Matrix Representation
Applied Informatics Štefan BEREŽNÝ
Chapter 28 – Part II Matrix Operations. Gaussian elimination Gaussian elimination LU factorization LU factorization Gaussian elimination with partial.
Finite Fields Rong-Jaye Chen. p2. Finite fields 1. Irreducible polynomial f(x)  K[x], f(x) has no proper divisors in K[x] Eg. f(x)=1+x+x 2 is irreducible.
BCH Codes Hsin-Lung Wu NTPU.
Mathematics of Cryptography Part II: Algebraic Structures
Cryptography and Network Security, Finite Fields From Third Edition by William Stallings Lecture slides by Mustafa Sakalli so much modified..
Cryptography and Network Security
1.5 Elementary Matrices and a Method for Finding
1.5 Elementary Matrices and a Method for Finding
Lecture 9: Introduction to Matrix Inversion Gaussian Elimination Sections 2.4, 2.5, 2.6 Sections 2.2.3, 2.3.
Refresher: Vector and Matrix Algebra Mike Kirkpatrick Department of Chemical Engineering FAMU-FSU College of Engineering.
Solving Systems of Linear Equations Part Pivot a Matrix 2. Gaussian Elimination Method 3. Infinitely Many Solutions 4. Inconsistent System 5. Geometric.
Richard Fateman CS 282 Lecture 111 Determinants Lecture 11.
Review of Matrix Algebra
Introduction Polynomials
Chapter 4 – Finite Fields Introduction  will now introduce finite fields  of increasing importance in cryptography AES, Elliptic Curve, IDEA, Public.
Mathematics of Cryptography Part I: Modular Arithmetic, Congruence,
10.1 Gaussian Elimination Method
Finite Mathematics & Its Applications, 10/e by Goldstein/Schneider/SiegelCopyright © 2010 Pearson Education, Inc. 1 of 86 Chapter 2 Matrices.
INDR 262 INTRODUCTION TO OPTIMIZATION METHODS LINEAR ALGEBRA INDR 262 Metin Türkay 1.
1 Chapter 2 Matrices Matrices provide an orderly way of arranging values or functions to enhance the analysis of systems in a systematic manner. Their.
Introduction Information in science, business, and mathematics is often organized into rows and columns to form rectangular arrays called “matrices” (plural.
SYSTEMS OF LINEAR EQUATIONS
Mathematics of Cryptography Part I: Modular Arithmetic, Congruence,
M. Khalily Dermany Islamic Azad University.  finite number of element  important in number theory, algebraic geometry, Galois theory, cryptography,
Chapter 10 Review: Matrix Algebra
3.4/3.5 The Integers and Division/ Primes and Greatest Common Divisors Let each of a and b be integers. We say that a divides b, in symbols a | b, provided.
Graphics CSE 581 – Interactive Computer Graphics Mathematics for Computer Graphics CSE 581 – Roger Crawfis (slides developed from Korea University slides)
Mathematics of Cryptography Modular Arithmetic, Congruence,
FINITE FIELDS 7/30 陳柏誠.
ECON 1150 Matrix Operations Special Matrices
Advanced Computer Graphics Spring 2014 K. H. Ko School of Mechatronics Gwangju Institute of Science and Technology.
Systems of Linear Equation and Matrices
Numerical Computation Lecture 7: Finding Inverses: Gauss-Jordan United International College.
CPSC 3730 Cryptography and Network Security
Information Security and Management 4. Finite Fields 8
By: Hector L Contreras SSGT / USMC
Matrix. REVIEW LAST LECTURE Keyword Parametric form Augmented Matrix Elementary Operation Gaussian Elimination Row Echelon form Reduced Row Echelon form.
ΑΡΙΘΜΗΤΙΚΕΣ ΜΕΘΟΔΟΙ ΜΟΝΤΕΛΟΠΟΙΗΣΗΣ 4. Αριθμητική Επίλυση Συστημάτων Γραμμικών Εξισώσεων Gaussian elimination Gauss - Jordan 1.
Matrices CHAPTER 8.1 ~ 8.8. Ch _2 Contents  8.1 Matrix Algebra 8.1 Matrix Algebra  8.2 Systems of Linear Algebra Equations 8.2 Systems of Linear.
Monoids, Groups, Rings, Fields
Basic Number Theory Divisibility Let a,b be integers with a≠0. if there exists an integer k such that b=ka, we say a divides b which is denoted by a|b.
Chapter 4 – Finite Fields
Data Security and Encryption (CSE348) 1. Lecture # 12 2.
Computing Eigen Information for Small Matrices The eigen equation can be rearranged as follows: Ax = x  Ax = I n x  Ax - I n x = 0  (A - I n )x = 0.
Great Theoretical Ideas in Computer Science.
Linear algebra: matrix Eigen-value Problems Eng. Hassan S. Migdadi Part 1.
Rational Numbers and Fields
Scott CH Huang COM5336 Cryptography Lecture 11 Euclidean Domains & Division Algorithm Scott CH Huang COM 5336 Cryptography Lecture 10.
Information Security Lab. Dept. of Computer Engineering 87/121 PART I Symmetric Ciphers CHAPTER 4 Finite Fields 4.1 Groups, Rings, and Fields 4.2 Modular.
Copyright © 2011 Pearson Education, Inc. Solving Linear Systems Using Matrices Section 6.1 Matrices and Determinants.
Cryptography and Network Security Chapter 4. Introduction  will now introduce finite fields  of increasing importance in cryptography AES, Elliptic.
BASIC MATHEMATICAL Session 2 Course: S Introduction to Finite Element Method Year: 2010.
1 Chapter 7 Numerical Methods for the Solution of Systems of Equations.
By Josh Zimmer Department of Mathematics and Computer Science The set ℤ p = {0,1,...,p-1} forms a finite field. There are p ⁴ possible 2×2 matrices in.
Multiplicative Group The multiplicative group of Z n includes every a, 0
CS480 Cryptography and Information Security Huiping Guo Department of Computer Science California State University, Los Angeles 3. Mathematics of Cryptography.
Linear Algebra Engineering Mathematics-I. Linear Systems in Two Unknowns Engineering Mathematics-I.
Graphics Graphics Korea University kucg.korea.ac.kr Mathematics for Computer Graphics 고려대학교 컴퓨터 그래픽스 연구실.
CS480 Cryptography and Information Security
Discrete Math II Howon Kim
5 Systems of Linear Equations and Matrices
Systems of First Order Linear Equations
MA5242 Wavelets Lecture 1 Numbers and Vector Spaces
Mathematical Background: Extension Finite Fields
Finite Field Arithmetic using Self-Assembly of DNA Tilings
Presentation transcript:

Linear Algebra over Finite Fields and Generic Domains in Maple Simon Lo, Michael Monagan Department of Mathematics, Simon Fraser University Introduction Most linear algebra algorithms are general algorithms that work for matrices with coefficients over any field. Therefore, it is useful to implement the algorithms in Maple such that they are independent of any particular fields and field representations. For some algorithms, it is possible to generalize them further to work for matrices over any arbitrary domains such as Euclidean domain, integral domains etc. that are more general. Here, we restrict our attention to finite fields because we want to avoid dealing with problems such as representation and numerical stability. We represent a domain in Maple as a table of procedures and constants. Special procedures like ConvertIn and ConvertOut are used to convert from Maple representation to our representation and vice versa. Rand is a procedure that generates a random element and is very useful for generating test cases. The following is a list of procedures/constants that must be additionally defined in the table for each type of domains. Integral domain (ID): 0, 1, +, , , UnitPart, NormalPart, Divide (exact division) Unique factorization domain (UFD): Gcd Euclidean domain (ED): EuclideanNorm, Quo, Rem, Gcdex Finite field (GF): Inv,  (division) Three types of base domains have been implemented. They are Z, Zp, and GF(p n ) where p is a prime. We have also included procedures for constructing univariate polynomial domains over a general coefficient domain that has already been constructed, and procedures for constructing square matrix domains over a general coefficient domain that has already been constructed. Multiplication in a given square matrix domain in general is not commutative, so we have defined operations for a ring with identity (RI), and a commutative ring with identity (CRI). We will define operations for a general ring in the future. If the coefficient domain is a GF, then the polynomial is a ED. If the coefficient domain is a ED, then the polynomial is a UFD. If the coefficient domain is any other domains, say type D, then the polynomial domain D[x] is also of type D. A matrix domain is in general is of type RI, given that the coefficients are also of type RI. Operations for polynomial domains (Poly): CoefficientDomain, ConvertInD, Variable, Coeff, Degree, Diff, Eval, Lcoeff, Ldegree, Resultant, Sqrfree, Tcoeff. Currently, Factors, Splits, and Roots are only implemented for polynomial domains over finite fields. Operations for matrix domains (Matrix): CoefficientDomain, ConvertInD, Trace, Adjoint, Inverse, Charpoly, Ffgausselim, Det, Rank, Rowspan, Colspan, Hermite, Smith, Gausselim, Gaussjord, Rowspace, Colspace, Nullspace, Backsub, Forwardsub, Hessenberg, Linsolve, LUdecomp, Eigenvalues, Eigenvectors. Examples in Maple > F := `makeGF/Zp`(2): > P := makePoly(F,x): > M := makeMatrix(P,4): > A := M['Rand'](); > M['Adjoint'](A); > M['Det'](A); > M['Ffgausselim'](A); > M['Hermite'](A); > M['Smith'](A); > alias(a=RootOf(x^3+x^2+1)): > F := `makeGF/Fq`(a,2): > M := makeMatrix(F,4): > A := M['ConvertIn']([[a^2+a, a+1, 0, 0], [a^2+a, a^2+a, a+1, 1], [a^2+a, 0, a^2+1, a+1], [a+1, 0, a, a^2+1]]); > M['Charpoly'](A); > M['Ffgausselim'](A); > M['Gausselim'](A); > F := `makeGF/Zp`(2): > M := makeMatrix(F,4): > A := M['ConvertIn']([[1,1,1,0],[1,1,1,1], [1,1,1,1],[0,0,1,1]]); > M['Eigenvalues']('F2',A); > F2['Minpoly']; > M['Eigenvectors']('F2',A); Implementation of Generic Algorithms In order to define generic algorithms for linear algebra suitable for matrices with arbitrary coefficient domains, it is necessary for the generic algorithm to take the table of operations/constants for the domain as an input parameter and do all operations using the appropriate operation from the table. This approach makes sure that the generic code will work for any domain with the appropriate operations defined. Generally, computation using this approach will be slower than the equivalent Maple code because of the increased number of table access and procedure calls. The procedure calls will generally execute slower than the equivalent builtin Maple functions. Efficient data structures such as modp1 and modp2 have been used to speed up computations for finite fields and polynomials over finite fields. Consider the example below of the simplified code for fraction-free Gaussian elimination (D is the coefficient domain, B is the input matrix). Ffgausselim := proc(D,B) A := Matrix(B); m,n := LinearAlgebra:-Dimensions(A); divisor := D[1]; r := 1; for c to n while r <= m do # find pivot for i from r to m while A[i,c] = D[0] do od; if i > n then next fi; if i <> r then # interchange row i with row r to make A[r,c] the pivot for j from c to m do t := A[i,j]; A[i,j] := A[r,j]; A[r,j] := t od fi; for i from r+1 to m do for j from c+1 to n do A[i,j] := D[`-`]( D[`*`](A[r,c],A[i,j]), D[`*`](A[i,c],A[r,j]) ); if divisor<>D[1] then D['Divide'](A[i,j],divisor,'q'); A[i,j] := q; fi; od; A[i,c] := D[0]; od; divisor := A[r,c]; r := r+1 # go to next row od; # go to next column A end: The code for fraction-free Gaussian elimination requires only the operations 0, 1, , , Divide from the coefficient domain, so the same code would work for any coefficient domain with these operations properly defined. We have parameterized the code by D, so that the code works for any domain D, not just the integers we might have had in mind when we wrote the code. This main idea of passing as a parameter a collection of functions as a single unit came from the AXIOM system, which was formerly called Scratchpad II. The same idea is also used in the Domains package in Maple. Compare the code for the fraction-free Gaussian elimination with the code for Gaussian elimination below which generally requires the coefficient domain to be a field (since we need to compute inverses). Gausselim := proc(F,B) A := Matrix(B); m,n := LinearAlgebra:-Dimensions(A); for i to m do for j to n while A[i,j] = F[0] do od; if j > n or A[i,j] = F[1] then next fi; s := F['Inv'](A[i,j]); for k from j+1 to n do A[i,k] := F[`*`](s,A[i,k]) od; A[i,j] := F[1]; od; r := 1; for c to n while r <= m do for i from r to m while A[i,c] = F[0] do od; if i > m then next fi; if i <> r then # interchange row i with row r for j from c to n do t := A[i,j]; A[i,j] := A[r,j]; A[r,j] := t od fi; for i from r+1 to m do if A[i,c] = F[0] then next fi; A[i,c] := F[0]; for j from c+1 to n do A[i,j] := F[`-`](A[i,j],A[r,j]) od; for j from c+1 to n while A[i,j] = F[0] do od; if j > n then next fi; s := F['Inv'](A[i,j]); for k from j+1 to n do A[i,k] := F[`*`](s,A[i,k]) od; A[i,j] := F[1]; od; r := r + 1# go to next row od;# go to next column A end: