construct a unit Vector
UnitVector[o](i, d, cpt, options)
positive integer; index of the non-zero entry
positive integer; dimension of the resulting Vector
(optional) BooleanOpt(compact); selects the compact form of the output
(optional); constructor options for the result object
(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](..).
v1 ≔ UnitVector⁡4,5
v1 ≔ 00010
v2 ≔ UnitVector[row]⁡1,3,compact=false
v2 ≔ 100
Download Help Document
What kind of issue would you like to report? (Optional)
Thank you for submitting feedback on this help document. Your feedback will be used
to improve Maple's help in the future.