ScalarMatrix - Maple Help

# Online Help

###### All Products    Maple    MapleSim

LinearAlgebra

 ScalarMatrix
 construct a scalar multiple of an identity Matrix
 ScalarVector
 construct a scalar multiple of a unit Vector

 Calling Sequence ScalarMatrix(s, r, c, cpt, options) ScalarVector[o](s, i, d, cpt, options)

Parameters

 s - algebraic expression; constant value for the Matrix or Vector i - positive integer; index of the non-zero entry in the Vector d - positive integer; dimension of the resulting Vector r - (optional) non-negative integer; row dimension of the resulting Matrix c - (optional) non-negative integer; column dimension of the resulting Matrix cpt - (optional) equation of the form compact=true or false; selects the compact form of the output [o] - (optional) use either [row] or [column] to specify the orientation of the resulting Vector options - (optional); constructor options for the result object

Description

 • The ScalarMatrix(s, r, c) function returns an r x c Matrix in which all of the entries on the diagonal have the value s and all other entries are zero.
 If the row dimension is not provided, it defaults to zero.  If the column dimension is not provided, it defaults to the row dimension.
 • The ScalarVector(s, i, d) function returns a d-dimensional Vector in which the ith entry is s and all other entries are 0.
 The ScalarVector[row](s, i, d) function acts like ScalarVector(s, i, d) except that a row Vector is returned.  If the orientation option is omitted or if ScalarVector[column](s, d) is used, a column Vector is returned.
 • If the compact option (cpt) is omitted, or, if it is included in the calling sequence as just the symbol compact or in the form compact=true, then the result is built by using a shape function designed to minimize storage. If the option is entered as compact=false, a full rectangular object is constructed.
 • The constructor options provide additional information (readonly, shape, storage, order, datatype, and attributes) to the Matrix or Vector constructor that builds the result. These options may also be provided in the form outputoptions=[...], where [...] represents a Maple list.  If a constructor option is provided in both the calling sequence directly and in an outputoptions option, the latter takes precedence (regardless of the order).
 If a shape value is not provided, then the shape of the resulting object is determined by the compact option. Otherwise, a result with the specified shape is constructed with the appropriate entries set to const.
 If readonly=false is included, it is ignored unless the default shape (scalar) is overridden by also including a mutable shape in options.
 • This function is part of the LinearAlgebra package, and so it can be used in the form ScalarMatrix(..) only after executing the command with(LinearAlgebra). However, it can always be accessed through the long form of the command by using LinearAlgebra[ScalarMatrix](..).

Examples

 > $\mathrm{with}\left(\mathrm{LinearAlgebra}\right):$
 > $S≔\mathrm{ScalarMatrix}\left(x,3,4\right)$
 ${S}{≔}\left[\begin{array}{cccc}{x}& {0}& {0}& {0}\\ {0}& {x}& {0}& {0}\\ {0}& {0}& {x}& {0}\end{array}\right]$ (1)
 > $\mathrm{MatrixOptions}\left(S,\mathrm{shape}\right)$
 $\left[{{\mathrm{scalar}}}_{{x}}\right]$ (2)
 > $R≔\mathrm{ScalarVector}\left[\mathrm{row}\right]\left(3.4,2,5\right)$
 ${R}{≔}\left[\begin{array}{ccccc}{0}& {3.4}& {0}& {0}& {0}\end{array}\right]$ (3)
 > $\mathrm{VectorOptions}\left(R,\mathrm{shape}\right)$
 $\left[{{\mathrm{scalar}}}_{{2}{,}{3.4}}\right]$ (4)
 > $T≔\mathrm{ScalarVector}\left(n,1,5,\mathrm{compact}=\mathrm{false}\right)$
 ${T}{≔}\left[\begin{array}{c}{n}\\ {0}\\ {0}\\ {0}\\ {0}\end{array}\right]$ (5)
 > $\mathrm{VectorOptions}\left(T,\mathrm{shape}\right)$
 $\left[\right]$ (6)

 See Also