 Fill - Maple Help

LinearAlgebra[Modular]

 Fill
 fill mod m Matrix or Vector with specified value Calling Sequence Fill(m, fillv, A) Parameters

 m - modulus fillv - (optional) fill value; numeric in the range $0..m-1$ or keyword A - mod m Matrix or Vector, including subspec Description

 • The Fill function fills the mod m Matrix or Vector A with the specified value fillv. If a fill value, fillv, is not specified, 0 is used.  The value NULL is returned.
 If fillv is the keyword random, the mod m Matrix or Vector A is filled with random values in the range $0..m-1$.
 • The Fill function allows you to use sub-Matrix and sub-Vector specifications for the mod m Matrix or Vector. For example, the function can be used to clear specific rows of a Matrix, or part of a Vector.
 • This command is part of the LinearAlgebra[Modular] package, so it can be used in the form Fill(..) only after executing the command with(LinearAlgebra[Modular]).  However, it can always be used in the form LinearAlgebra[Modular][Fill](..). Examples

 > $\mathrm{with}\left(\mathrm{LinearAlgebra}\left[\mathrm{Modular}\right]\right):$
 > $A≔\mathrm{Mod}\left(13,\mathrm{Matrix}\left(4,4,\left(i,j\right)↦\mathrm{rand}\left(\right)\right),\mathrm{integer}\left[\right]\right)$
 ${A}{≔}\left[\begin{array}{cccc}{10}& {0}& {8}& {12}\\ {2}& {6}& {0}& {11}\\ {9}& {2}& {11}& {7}\\ {4}& {11}& {12}& {11}\end{array}\right]$ (1)

Fill entire Matrix with 0.

 > $\mathrm{Fill}\left(13,A\right):$
 > $A$
 $\left[\begin{array}{cccc}{0}& {0}& {0}& {0}\\ {0}& {0}& {0}& {0}\\ {0}& {0}& {0}& {0}\\ {0}& {0}& {0}& {0}\end{array}\right]$ (2)

Fill row 3 with value 2.

 > $\mathrm{Fill}\left(13,2,A,3\right):$
 > $A$
 $\left[\begin{array}{cccc}{0}& {0}& {0}& {0}\\ {0}& {0}& {0}& {0}\\ {2}& {2}& {2}& {2}\\ {0}& {0}& {0}& {0}\end{array}\right]$ (3)

Fill column 2 with 0.

 > $\mathrm{Fill}\left(13,A,1..-1,2\right):$
 > $A$
 $\left[\begin{array}{cccc}{0}& {0}& {0}& {0}\\ {0}& {0}& {0}& {0}\\ {2}& {0}& {2}& {2}\\ {0}& {0}& {0}& {0}\end{array}\right]$ (4)

Fill all but first and last elements of a row Vector with 5.0.

 > $B≔\mathrm{Create}\left(13,0,5,\mathrm{float}\left[8\right]\right)$
 ${B}{≔}\left[\begin{array}{ccccc}{0.}& {0.}& {0.}& {0.}& {0.}\end{array}\right]$ (5)
 > $\mathrm{Fill}\left(13,5.0,B,2..-2\right):$
 > $B$
 $\left[\begin{array}{ccccc}{0.}& {5.}& {5.}& {5.}& {0.}\end{array}\right]$ (6)

Fill Matrix with random values.

 > $A$
 $\left[\begin{array}{cccc}{0}& {0}& {0}& {0}\\ {0}& {0}& {0}& {0}\\ {2}& {0}& {2}& {2}\\ {0}& {0}& {0}& {0}\end{array}\right]$ (7)
 > $\mathrm{Fill}\left(13,'\mathrm{random}',A\right):$
 > $A$
 $\left[\begin{array}{cccc}{6}& {7}& {7}& {3}\\ {10}& {3}& {6}& {6}\\ {10}& {12}& {7}& {6}\\ {1}& {2}& {0}& {11}\end{array}\right]$ (8)