LinearAlgebra[Modular] - Maple Programming Help

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

LinearAlgebra[Modular]

 Create
 create a new mod m Matrix or Vector

 Calling Sequence Create(m, nrow, ncol, fillv, dtype, order)

Parameters

 m - modulus nrow - number of rows in output object ncol - number of columns in output object fillv - (optional) fill value; numeric in the range $0..m-1$ or keyword dtype - datatype of output object order - (optional) ordering of output object

Description

 • The Create function creates a new mod m Matrix or Vector of the specified type and dimensions.
 A row Vector can be obtained by setting $\mathrm{nrow}=0$, and a column Vector by setting $\mathrm{ncol}=0$. If $0<\mathrm{nrow}$ and $0<\mathrm{ncol}$, a Matrix is produced. If $\mathrm{nrow}=0$ and $\mathrm{ncol}=0$, an error results.
 • The allowable datatypes are hardware integer (dtype=integer[4]/integer[8] or integer[]), hardware float (dtype=float[8]), or Maple integer (dtype=integer). If specified, order can be C_order or Fortran_order. If not specified, C_order is used.
 • By default, after creating the requested Matrix or Vector, the entries of the table are initialized to zero. Alternatively, if a fill value, fillv, is provided, it is used to initialize the table after creation.
 Two special fill types are supported:
 identity: For this fill type, the object must be a square Matrix, that is, nrow=ncol. The identity matrix of the specified type and dimension is returned.
 random: This indicates the returned object should be filled with random values in the range $0..m-1$.
 • This command is part of the LinearAlgebra[Modular] package, so it can be used in the form Create(..) only after executing the command with(LinearAlgebra[Modular]).  However, it can always be used in the form LinearAlgebra[Modular][Create](..).

Examples

 > $\mathrm{with}\left(\mathrm{LinearAlgebra}[\mathrm{Modular}]\right):$
 > $\mathrm{A1}≔\mathrm{Create}\left(31,20,30,\mathrm{integer}[]\right)$
 ${\mathrm{A1}}{:=}\left[\begin{array}{c}{\mathrm{20 x 30}}{\mathrm{Matrix}}\\ {\mathrm{Data Type:}}{{\mathrm{integer}}}_{{8}}\\ {\mathrm{Storage:}}{\mathrm{rectangular}}\\ {\mathrm{Order:}}{\mathrm{C_order}}\end{array}\right]$ (1)
 > $\mathrm{A2}≔\mathrm{Create}\left(31,20,30,\mathrm{float}[8],\mathrm{Fortran_order}\right)$
 ${\mathrm{A2}}{:=}\left[\begin{array}{c}{\mathrm{20 x 30}}{\mathrm{Matrix}}\\ {\mathrm{Data Type:}}{{\mathrm{float}}}_{{8}}\\ {\mathrm{Storage:}}{\mathrm{rectangular}}\\ {\mathrm{Order:}}{\mathrm{Fortran_order}}\end{array}\right]$ (2)
 > $\mathrm{A3}≔\mathrm{Create}\left(31,3,0,2,\mathrm{integer}[]\right)$
 ${\mathrm{A3}}{:=}\left[\begin{array}{r}{2}\\ {2}\\ {2}\end{array}\right]$ (3)
 > $\mathrm{whattype}\left(\mathrm{A3}\right)$
 ${{\mathrm{Vector}}}_{{\mathrm{column}}}$ (4)
 > $\mathrm{A4}≔\mathrm{Create}\left(31,0,5,\mathrm{float}[8]\right)$
 ${\mathrm{A4}}{:=}\left[\begin{array}{ccccc}{0.}& {0.}& {0.}& {0.}& {0.}\end{array}\right]$ (5)
 > $\mathrm{whattype}\left(\mathrm{A4}\right)$
 ${{\mathrm{Vector}}}_{{\mathrm{row}}}$ (6)
 > $\mathrm{Create}\left(13,4,4,\mathrm{identity},\mathrm{integer}\right)$
 $\left[\begin{array}{rrrr}{1}& {0}& {0}& {0}\\ {0}& {1}& {0}& {0}\\ {0}& {0}& {1}& {0}\\ {0}& {0}& {0}& {1}\end{array}\right]$ (7)
 > $\mathrm{Create}\left(411,7,3,\mathrm{random},\mathrm{float}[8]\right)$
 $\left[\begin{array}{ccc}{88.}& {298.}& {262.}\\ {322.}& {75.}& {277.}\\ {149.}& {261.}& {228.}\\ {370.}& {134.}& {305.}\\ {65.}& {94.}& {3.}\\ {260.}& {405.}& {288.}\\ {196.}& {118.}& {68.}\end{array}\right]$ (8)