apply 'mod' to input with optional evaluation list producing a mod m Matrix or Vector as output - Maple 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

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

Mod(m, A, eval, B)







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



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



(optional) datatype of output object



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



output object (copy to), including subspec



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](..).


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








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






Evaluation of a list of polynomials to a row vector.







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

Vl:=seqVectorcolumn3,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










Extended evaluation syntax.







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







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