UnitVector - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim


LinearAlgebra

  

UnitVector

  

construct a unit Vector

 

Calling Sequence

Parameters

Description

Examples

Calling Sequence

UnitVector[o](i, d, cpt, options)

Parameters

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

Description

• 

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](..).

Examples

withLinearAlgebra:

v1UnitVector4,5

v100010

(1)

VectorOptionsv1,shape

unit4

(2)

v2UnitVectorrow1,3,compact=false

v2100

(3)

VectorOptionsv2,shape

(4)

See Also

LinearAlgebra[ScalarVector]

Vector