Matrix Add - Maple Help

LinearAlgebra[Generic]

Parameters

 R - the domain of computation A,B - Matrices of values in $R$ c,d - (optional) scalar values in $R$ (default values: $1$) v,w - Vectors of values in $R$ lA - non-empty list of Matrices over $R$ lc - (optional) non-empty list of scalar values in $R$ lv - non-empty list of vectors over $R$

Description

 • The (indexed) parameter $R$, which specifies the domain of computation, a commutative ring, must be a Maple table/module which has the following values/exports:
 R[0] : a constant for the zero of the ring R
 R[1] : a constant for the (multiplicative) identity of R
 R[+] : a procedure for adding elements of R (nary)
 R[-] : a procedure for negating and subtracting elements of R (unary and binary)
 R[*] : a procedure for multiplying elements of R (binary and commutative)
 R[=] : a boolean procedure for testing if two elements of R are equal
 • The parameters $A,B$, and $v,w$ must have compatible dimensions for the addition. Similarly, all Matrices in $\mathrm{lA}$, and all Vectors in $\mathrm{lv}$, must have compatible dimensions, and the number of elements of $\mathrm{lc}$, if given, must match the number of element of $\mathrm{lA}$ or $\mathrm{lv}$, respectively.
 • If $c,d,\mathrm{lc}$ are omitted, then MatrixAdd and VectorAdd just compute the sum of the matrices or vectors, respectively.

Examples

 > $\mathrm{with}\left(\mathrm{LinearAlgebra}\left[\mathrm{Generic}\right]\right):$
 > $\mathrm{F8}≔\mathrm{GF}\left(2,3,{a}^{3}+a+1\right)$
 ${\mathrm{F8}}{≔}{{𝔽}}_{{8}}$ (1)
 > $A≔\mathrm{map}\left(\mathrm{F8},\mathrm{Matrix}\left(\left[\left[a,a+1,0\right],\left[{a}^{2},0,{a}^{2}+a\right]\right]\right)\right)$
 ${A}{≔}\left[\begin{array}{ccc}{a}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{\mathbf{mod}}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{2}& \left({a}{+}{1}\right)\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{\mathbf{mod}}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{2}& {0}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{\mathbf{mod}}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{2}\\ {{a}}^{{2}}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{\mathbf{mod}}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{2}& {0}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{\mathbf{mod}}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{2}& \left({{a}}^{{2}}{+}{a}\right)\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{\mathbf{mod}}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{2}\end{array}\right]$ (2)
 > $B≔\mathrm{map}\left(\mathrm{F8},\mathrm{Matrix}\left(\left[\left[1,{a}^{2}+a,a\right],\left[{a}^{2}+1,a,a\right]\right]\right)\right)$
 ${B}{≔}\left[\begin{array}{ccc}{1}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{\mathbf{mod}}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{2}& \left({{a}}^{{2}}{+}{a}\right)\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{\mathbf{mod}}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{2}& {a}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{\mathbf{mod}}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{2}\\ \left({{a}}^{{2}}{+}{1}\right)\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{\mathbf{mod}}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{2}& {a}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{\mathbf{mod}}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{2}& {a}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{\mathbf{mod}}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{2}\end{array}\right]$ (3)
 > $\mathrm{MatrixAdd}\left[\mathrm{F8}\right]\left(A,B\right)=\mathrm{MatrixAdd}\left[\mathrm{F8}\right]\left(\left[A,B\right]\right)$
 $\left[\begin{array}{ccc}\left({a}{+}{1}\right)\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{\mathbf{mod}}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{2}& \left({{a}}^{{2}}{+}{1}\right)\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{\mathbf{mod}}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{2}& {a}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{\mathbf{mod}}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{2}\\ {1}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{\mathbf{mod}}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{2}& {a}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{\mathbf{mod}}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{2}& {{a}}^{{2}}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{\mathbf{mod}}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{2}\end{array}\right]{=}\left[\begin{array}{ccc}\left({a}{+}{1}\right)\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{\mathbf{mod}}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{2}& \left({{a}}^{{2}}{+}{1}\right)\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{\mathbf{mod}}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{2}& {a}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{\mathbf{mod}}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{2}\\ {1}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{\mathbf{mod}}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{2}& {a}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{\mathbf{mod}}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{2}& {{a}}^{{2}}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{\mathbf{mod}}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{2}\end{array}\right]$ (4)
 > $c≔\mathrm{F8}\left(a\right)$
 ${c}{≔}{a}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{\mathbf{mod}}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{2}$ (5)
 > $d≔\mathrm{F8}\left(a+1\right)$
 ${d}{≔}\left({a}{+}{1}\right)\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{\mathbf{mod}}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{2}$ (6)
 > $\mathrm{MatrixAdd}\left[\mathrm{F8}\right]\left(A,B,c,d\right)=\mathrm{MatrixAdd}\left[\mathrm{F8}\right]\left(\left[A,B\right],\left[c,d\right]\right)$
 $\left[\begin{array}{ccc}\left({{a}}^{{2}}{+}{a}{+}{1}\right)\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{\mathbf{mod}}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{2}& \left({{a}}^{{2}}{+}{a}{+}{1}\right)\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{\mathbf{mod}}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{2}& \left({{a}}^{{2}}{+}{a}\right)\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{\mathbf{mod}}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{2}\\ \left({{a}}^{{2}}{+}{a}{+}{1}\right)\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{\mathbf{mod}}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{2}& \left({{a}}^{{2}}{+}{a}\right)\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{\mathbf{mod}}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{2}& {1}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{\mathbf{mod}}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{2}\end{array}\right]{=}\left[\begin{array}{ccc}\left({{a}}^{{2}}{+}{a}{+}{1}\right)\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{\mathbf{mod}}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{2}& \left({{a}}^{{2}}{+}{a}{+}{1}\right)\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{\mathbf{mod}}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{2}& \left({{a}}^{{2}}{+}{a}\right)\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{\mathbf{mod}}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{2}\\ \left({{a}}^{{2}}{+}{a}{+}{1}\right)\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{\mathbf{mod}}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{2}& \left({{a}}^{{2}}{+}{a}\right)\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{\mathbf{mod}}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{2}& {1}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{\mathbf{mod}}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{2}\end{array}\right]$ (7)
 > $v≔\mathrm{map}\left(\mathrm{F8},\mathrm{Vector}\left(\left[{a}^{2}+a+1,a,a+1\right]\right)\right)$
 ${v}{≔}\left[\begin{array}{c}\left({{a}}^{{2}}{+}{a}{+}{1}\right)\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{\mathbf{mod}}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{2}\\ {a}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{\mathbf{mod}}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{2}\\ \left({a}{+}{1}\right)\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{\mathbf{mod}}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{2}\end{array}\right]$ (8)
 > $w≔\mathrm{map}\left(\mathrm{F8},\mathrm{Vector}\left(\left[a+1,{a}^{2},{a}^{2}+a\right]\right)\right)$
 ${w}{≔}\left[\begin{array}{c}\left({a}{+}{1}\right)\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{\mathbf{mod}}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{2}\\ {{a}}^{{2}}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{\mathbf{mod}}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{2}\\ \left({{a}}^{{2}}{+}{a}\right)\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{\mathbf{mod}}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{2}\end{array}\right]$ (9)
 > $\mathrm{VectorAdd}\left[\mathrm{F8}\right]\left(v,w\right)=\mathrm{VectorAdd}\left[\mathrm{F8}\right]\left(\left[v,w\right]\right)$
 $\left[\begin{array}{c}{{a}}^{{2}}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{\mathbf{mod}}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{2}\\ \left({{a}}^{{2}}{+}{a}\right)\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{\mathbf{mod}}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{2}\\ \left({{a}}^{{2}}{+}{1}\right)\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{\mathbf{mod}}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{2}\end{array}\right]{=}\left[\begin{array}{c}{{a}}^{{2}}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{\mathbf{mod}}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{2}\\ \left({{a}}^{{2}}{+}{a}\right)\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{\mathbf{mod}}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{2}\\ \left({{a}}^{{2}}{+}{1}\right)\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{\mathbf{mod}}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{2}\end{array}\right]$ (10)
 > $\mathrm{VectorAdd}\left[\mathrm{F8}\right]\left(v,w,c,d\right)=\mathrm{VectorAdd}\left[\mathrm{F8}\right]\left(\left[v,w\right],\left[c,d\right]\right)$
 $\left[\begin{array}{c}{0}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{\mathbf{mod}}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{2}\\ \left({a}{+}{1}\right)\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{\mathbf{mod}}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{2}\\ \left({{a}}^{{2}}{+}{a}{+}{1}\right)\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{\mathbf{mod}}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{2}\end{array}\right]{=}\left[\begin{array}{c}{0}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{\mathbf{mod}}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{2}\\ \left({a}{+}{1}\right)\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{\mathbf{mod}}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{2}\\ \left({{a}}^{{2}}{+}{a}{+}{1}\right)\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{\mathbf{mod}}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{2}\end{array}\right]$ (11)

Compatibility

 • The LinearAlgebra[Generic][MatrixAdd] and LinearAlgebra[Generic][VectorAdd] commands were introduced in Maple 2021.
 • For more information on Maple 2021 changes, see Updates in Maple 2021.