compute mod m GCD from Matrix of coefficients - Maple Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Mathematics : Linear Algebra : LinearAlgebra Package : Modular Subpackage : LinearAlgebra/Modular/MatGcd

LinearAlgebra[Modular][MatGcd] - compute mod m GCD from Matrix of coefficients

Calling Sequence

MatGcd(m, A, nrow)

Parameters

m

-

modulus

A

-

mod m Matrix; each row stores the coefficients of a polynomial

nrow

-

number of rows in A containing polynomial coefficients

Description

• 

The MatGcd function computes the GCD of the nrow polynomials formed by multiplication of the input Matrix A by the Vector [1,x,x2,...]. It is capable of computing the mod m GCD of more than two polynomials simultaneously.

• 

Each polynomial must be stored in a row of the input Matrix, in order of increasing degree for the columns. For example, the polynomial x2+2x+3 is stored in a row as [3, 2, 1].

• 

On successful completion, the degree of the GCD is returned, and the coefficients of the GCD are returned in the first row of A.

  

Note: The returned GCD is not normalized to the leading coefficient 1, as the leading coefficient is required for some modular reconstruction techniques.

• 

This command is part of the LinearAlgebra[Modular] package, so it can be used in the form MatGcd(..) only after executing the command with(LinearAlgebra[Modular]).  However, it can always be used in the form LinearAlgebra[Modular][MatGcd](..).

Examples

withLinearAlgebra[Modular]:

p:=97

p:=97

(1)

An example of three polynomials with a known GCD.

G:=randpolyx,degree=2,coeffs=rand0..p1

G:=92x2+44x+95

(2)

Ac:=randpolyx,degree=2,coeffs=rand0..p1:A:=expandGAc

A:=460x4+5556x3+6983x2+7402x+4085

(3)

Bc:=randpolyx,degree=3,coeffs=rand0..p1:B:=expandGBc

B:=3404x5+7884x4+8899x3+16344x2+6650x+9025

(4)

Cc:=randpolyx,degree=1,coeffs=rand0..p1:C:=expandGCc

C:=1472x3+8892x2+5436x+8455

(5)

cfs:=seqcoeffA,x,i,i=0..degreeA,x,seqcoeffB,x,i,i=0..degreeB,x,seqcoeffC,x,i,i=0..degreeC,x

cfs:=4085,7402,6983,5556,460,9025,6650,16344,8899,7884,3404,8455,5436,8892,1472

(6)

M:=Modp,cfs,float8

M:=11.30.96.27.72.0.4.54.48.72.27.9.16.4.65.17.0.0.

(7)

gdeg:=MatGcdp,M,3:

M,gdeg

95.44.92.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.,2

(8)

g:=addtruncM1,i+1xi,i=0..gdeg

g:=92x2+44x+95

(9)

modpExpandGlcoeffg,xlcoeffG,x,p

92x2+44x+95

(10)

An example of a trivial GCD.

A:=randpolyx,degree=5

A:=62x582x4+80x344x2+71x17

(11)

B:=randpolyx,degree=4

B:=75x410x37x240x+42

(12)

cfs:=seqcoeffA,x,i,i=0..degreeA,x,seqcoeffB,x,i,i=0..degreeB,x:

M:=Modp,cfs,integer[]

M:=80715380156242579087220

(13)

MatGcdp,M,2

0

(14)

M

7500000000000

(15)

See Also

coeff, Expand, LinearAlgebra/Details, LinearAlgebra[Modular], LinearAlgebra[Modular][Mod], randpoly, seq, trunc


Download Help Document

Was this information helpful?



Please add your Comment (Optional)
E-mail Address (Optional)
What is ? This question helps us to combat spam