linalg(deprecated)

 matrix or vector addition

 Calling Sequence matadd(A, B) matadd(A, B, c1, c2)

Parameters

 A, B - matrices or vectors (with consistent dimensions) c1, c2 - (optional) scalar parameters

Description

 • Important: The linalg package has been deprecated. Use the superseding commands, LinearAlgebra[MatrixAdd] and LinearAlgebra[VectorAdd], instead.
 - For information on migrating linalg code to the new packages, see examples/LinearAlgebraMigration.
 • The function  matadd(A, B) computes the matrix (vector) sum of A and B.
 • If the optional scalar parameters c1 and c2 are given, then matadd computes the matrix (vector) sum $\mathrm{c1}A+\mathrm{c2}B$.
 • The evalm command is an easy method of accessing matadd.
 • The command with(linalg,matadd) allows the use of the abbreviated form of this command.

Examples

Important: The linalg package has been deprecated. Use the superseding commands, LinearAlgebra[MatrixAdd] and LinearAlgebra[VectorAdd], instead.

 > $\mathrm{with}\left(\mathrm{linalg}\right):$
 > $A≔\mathrm{matrix}\left(3,3,\left[1,2,3,2,3,4,3,4,5\right]\right)$
 ${A}{≔}\left[\begin{array}{ccc}{1}& {2}& {3}\\ {2}& {3}& {4}\\ {3}& {4}& {5}\end{array}\right]$ (1)
 > $B≔\mathrm{array}\left(1..3,1..3,\mathrm{identity}\right)$
 ${B}{≔}\left[\begin{array}{ccc}{1}& {0}& {0}\\ {0}& {1}& {0}\\ {0}& {0}& {1}\end{array}\right]$ (2)
 > $\mathrm{matadd}\left(A,B,1,10\right)$
 $\left[\begin{array}{ccc}{11}& {2}& {3}\\ {2}& {13}& {4}\\ {3}& {4}& {15}\end{array}\right]$ (3)
 > $v≔\mathrm{vector}\left(3,\left[2,3,4\right]\right)$
 ${v}{≔}\left[\begin{array}{ccc}{2}& {3}& {4}\end{array}\right]$ (4)
 > $u≔\mathrm{vector}\left(3,\left[-3,1,-5\right]\right)$
 ${u}{≔}\left[\begin{array}{ccc}{-3}& {1}& {-5}\end{array}\right]$ (5)
 > $\mathrm{matadd}\left(u,v,-2,1\right)$
 $\left[\begin{array}{ccc}{8}& {1}& {14}\end{array}\right]$ (6)
 > $\mathrm{matadd}\left(\mathrm{transpose}\left(u\right),\mathrm{transpose}\left(v\right)\right)$
 ${\mathrm{transpose}}{}\left(\left[\begin{array}{ccc}{-1}& {4}& {-1}\end{array}\right]\right)$ (7)