LinearAlgebra[Modular] - Maple Programming Help

Online Help

All Products    Maple    MapleSim


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

LinearAlgebra[Modular]

  

Mod

  

apply 'mod' to input with optional evaluation list producing a mod m Matrix or Vector as output

 

Calling Sequence

Parameters

Description

Examples

Calling Sequence

Mod(m, A, eval, dtype, order)

Mod(m, A, eval, B)

Parameters

m

-

modulus

A

-

input object; can contain Matrices, Vectors, sets or lists, and a subspec

eval

-

(optional) equation or set or list of equations for the evaluation

dtype

-

(optional) datatype of output object

order

-

(optional) ordering of output object (default is C_order)

B

-

output object (copy to), including subspec

Description

• 

The Mod function applies 'mod' with respect to the input modulus m, and optional evaluation list eval, to the input object A. This produces a new mod m Matrix or Vector with the specified datatype dtype and order order, or places the result in an existing mod m Matrix or Vector B.

• 

Allowable formats for A include Matrices or Vectors, sets or lists of Vectors, or sets or lists of sets or lists (though a set of sets format is not typically useful). Input Matrices or Vectors must be rectangular and can have datatype integer[4]/integer[8], float[8], or anything.

  

The data is interpreted in different ways based on the input, that is, what type of mod mobject is produced in each case by default.

  

In the case where the input is a Matrix or Vector, the output is the same type, with the same number of rows and columns, but with the specified datatype and ordering.

  

If the input is a set or list of Vectors, the output is a Matrix. All input Vectors must have the same number of elements and orientation. If they are column Vectors, they correspond to the columns in the output. If they are row Vectors, they correspond to the rows in the output.

  

If the input is a nested set or list, each set or list in the outer set or list corresponds to a row of the output. In this case, it is not required that all elements of the outer set or list have the same number of elements, as the output Matrix is chosen to be large enough to contain the longest of these as a row, and any rows with additional elements are zero padded.

  

If the input is a simple set or list, the output is a column Vector.

• 

Now that the default format has been described, the resulting object can be modified by using a subspec, so that only certain rows or columns are used, and the default output can be transposed.

• 

If no evaluation eval is provided, the input can contain integers or fractions only (or floats for input float[8] datatype).

  

Note: The float[8] datatype is provided primarily for conversion from a float[8] mod p Matrix or Vector to one of the other datatypes. It is assumed that the closest integer to each float in the input is what is required.

• 

If an evaluation list, eval, is specified, the inputs must be rational polynomials in terms of the indeterminates in the evaluation list.

  

Note: The left-hand sides of all elements in the evaluation list can be any nonconstant object, for example, x7 or RootofZ2+1, but the right-hand sides must all be integer values in the range 0..m1.  In addition, the provided evaluation must be sufficient to fully evaluate all elements of the input to integers mod m.

  

The input can also contain univariate modp1 polynomials, but the modulus must match the input modulus m, and the evaluation eval must contain an equation with the indeterminate of the modp1 polynomials on the left-hand side. Special evaluation rules, such as x7=2, are not applied to modp1 polynomials.

• 

The first calling sequence results in a new mod m Matrix or Vector, which is output by the call.  The second calling sequence computes the Mod into an existing object, which can also be a sub-Vector or sub-Matrix.

• 

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

Examples

Conversion of a integer Matrix to a mod m integer[] Matrix.

withLinearAlgebra[Modular]:

AMatrix4,4,i,j→rand

A:=39571886053419313981641522424170465800187484459427552056869842622684442412286285840996417214180386408307450694607189265773012980023730616292946106507053657396412723003944913350029210936428922

(1)

AmMod13,A,integer[]

Am:=10081226011921174111211

(2)

Conversion of a list of lists of rationals to a mod m float[8] Matrix.

B153933017312211754691347,235538926099196277296419,836404711117474259255346,22408504461978606118334,10295483279979957903184,5426152123930724083518,867557918169866818474138,966905297479497201520366,6951973063345453427109,988383200003735342248716

B:=153933017312211754691347,235538926099196277296419,836404711117474259255346,22408504461978606118334,10295483279979957903184,5426152123930724083518,867557918169866818474138,966905297479497201520366,6951973063345453427109,988383200003735342248716

(3)

Mod13,B,float[8]

12.0.0.0.1.11.0.0.11.0.5.0.12.6.11.3.

(4)

Evaluation of a list of polynomials to a row vector.

Cseqrandpolyx,i=1..4

C:=75x592x4+6x3+74x2+72x+37,23x5+87x4+44x3+29x2+98x23,10x561x48x329x2+95x+11,49x547x4+40x381x2+91x+68

(5)

Mod13,C,'transpose',x=2,integer

101026

(6)

Evaluation of a list of Vectors of modp1 polynomials to a new Matrix, and to an existing Matrix with sub-specification.

VlseqVector[column]3,i→randpolyx mod 13,i=1..4

Vl:=3x5+5x4+x3+12x2+4x+1 mod 13x5+3x4+11x3+3x2+4x+12 mod 1311x5+6x4+8x3+7x2+4x+8 mod 13,x5+4x4+x3+3x+4 mod 13x5+11x4+5x3+3x+9 mod 136x5+3x4+5x3+9x2+5x+8 mod 13,7x5+4x4+7x3+10x2+11x+5 mod 135x5+9x4+12x3+7 mod 13x5+12x4+x3+5x2+5x mod 13,5x5+11x4+6x3+5x2+12 mod 136x5+7x4+7x3+10x2+7x+2 mod 1312x4+x3+8x2+11x+5 mod 13

(7)

M1Mod13,Vl,x=2,integer[]

M1:=710805340109212

(8)

M2Create13,3,3,integer[]:

Mod13,Vl,1..3,2..4,x=2,M2:

M2

10803409212

(9)

Extended evaluation syntax.

Lⅇ,x7,x,RootOfZ2+1,xy,233

L:=ⅇ,x7,x,RootOf_Z2+1,xy,233

(10)

VMod13,L,ⅇ=3,x7=2,x=1,xy=2,y=0,RootOfZ2+1=10,float[8]

V:=3.2.1.10.2.12.

(11)

Floating-point input. This is not a good choice, notice the rounding.

VVector[row]5,i→iremrand,13010.0,datatype=float[8]

V:=4.1.8000000000000010.500000000000012.90000000000003.70000000000000

(12)

Mod13,V,integer[]

4110123

(13)

See Also

eval

LinearAlgebra/Details

LinearAlgebra[Modular]

LinearAlgebra[Modular][Copy]

LinearAlgebra[Modular][Create]

LinearAlgebra[Modular][subspec]

randpoly

seq

Vector

 


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