LinearAlgebra
UnitVector
construct a unit Vector
Calling Sequence
Parameters
Description
Examples
UnitVector[o](i, d, cpt, options)
i
-
positive integer; index of the non-zero entry
d
positive integer; dimension of the resulting Vector
cpt
(optional) equation of the form compact=true or false; selects the compact form of the output
options
(optional); constructor options for the result object
[o]
(optional) use either [row] or [column] to specify the orientation of the resulting Vector
The UnitVector(i, d) function returns a d-dimensional Vector in which the ith entry is one and all other entries are zero.
The UnitVector[row](i, d) function acts like UnitVector(i, d) except that a row Vector is returned. If the orientation option is omitted or if UnitVector[column](i, 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 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).
This function is part of the LinearAlgebra package, and so it can be used in the form UnitVector(..) only after executing the command with(LinearAlgebra). However, it can always be accessed through the long form of the command by using LinearAlgebra[UnitVector](..).
with⁡LinearAlgebra:
v1≔UnitVector⁡4,5
v1≔00010
VectorOptions⁡v1,shape
unit4
v2≔UnitVectorrow⁡1,3,compact=false
v2≔100
VectorOptions⁡v2,shape
See Also
LinearAlgebra[ScalarVector]
Vector
Download Help Document