Matrix and Vector Construction Shortcuts - Maple Programming Help

# Online Help

###### All Products    Maple    MapleSim

Home : Support : Online Help : Programming : Data Types : Rtables, Arrays, Matrices, and Vectors : IO : LinearAlgebra/General/MVshortcut

Matrix and Vector Construction Shortcuts

Description

 • The following notational shortcuts are available for creating and joining rtable-based Matrices and Vectors.
 < a, b, c > constructs a column Vector from scalars, or a Matrix from row Vectors.
 < a | b | c > constructs a row Vector from scalars, or a Matrix from column Vectors.
 < a , b ; c , d > constructs a Matrix from rows of scalars.
 < a , b | c , d > constructs a Matrix from columns of scalars.
 • In the first two forms, if any of the values given between the matching pair of angle brackets < > are not of type scalar or string, then a Matrix is constructed. Otherwise, a Vector is constructed.
 • In the third form, a Matrix is always constructed. Each sequence of comma-separated values defines a row, and the sequence of semicolon-separated rows are assembled into a Matrix.
 • In the fourth form, a Matrix is also always constructed. Each sequence of comma-separated values defines a columns, and the sequence of semicolon-separated columns are assembled into a Matrix.
 • The third form can also be used to construct a matrix from Vectors. In that case, all Vectors, whether rows or columns, are interpreted as row Vectors.
 • The element datatype of the result is deduced from the data by choosing the most efficient Matrix or Vector datatype that is capable of representing all values representable by the datatypes of any of the input Matrices or Vectors.
 If any of the input values are scalar, then for the purposes of datatype determination, each scalar is considered as a 1x1 Matrix with a datatype of either $\mathrm{float}[8]$ if the scalar is a hardware float, or anything otherwise.
 • In all cases, the result is constructed by using default values for all construction parameters other than datatype, orientation (of Vectors), and the entries. In particular, the dimension information is deduced from the data. For more information about construction parameters, see the Matrix and Vector constructors.
 • In general, this notation is the most efficient (in terms of both time and space) method to construct and combine Vectors and Matrices that don't require special features such as indexing functions or special storage representations (for example, sparse storage).

Examples

Construct a column Vector

 > $c≔⟨1,2,3⟩$
 ${c}{:=}\left[\begin{array}{r}{1}\\ {2}\\ {3}\end{array}\right]$ (1)

Construct a row Vector

 > $r≔⟨1|2|3⟩$
 ${r}{:=}\left[\begin{array}{ccc}{1}& {2}& {3}\end{array}\right]$ (2)

Construct a Matrix from rows of scalars

 > $⟨⟨1|2|3⟩,⟨4|5|6⟩⟩$
 $\left[\begin{array}{rrr}{1}& {2}& {3}\\ {4}& {5}& {6}\end{array}\right]$ (3)

Construct a Matrix from columns of scalars

 > $⟨⟨1,2,3⟩|⟨4,5,6⟩⟩$
 $\left[\begin{array}{rr}{1}& {4}\\ {2}& {5}\\ {3}& {6}\end{array}\right]$ (4)

Construct a Matrix by juxtaposing two column Vectors

 > $M≔⟨⟨1,2,3⟩|⟨4,5,6⟩⟩$
 ${M}{:=}\left[\begin{array}{rr}{1}& {4}\\ {2}& {5}\\ {3}& {6}\end{array}\right]$ (5)

Augment this Matrix with a column Vector

 > $⟨M|⟨x,y,z⟩⟩$
 $\left[\begin{array}{ccc}{1}& {4}& {x}\\ {2}& {5}& {y}\\ {3}& {6}& {z}\end{array}\right]$ (6)

Construct a Matrix by stacking row Vectors

 > $⟨⟨1|2|3⟩,⟨4|5|6⟩⟩$
 $\left[\begin{array}{rrr}{1}& {2}& {3}\\ {4}& {5}& {6}\end{array}\right]$ (7)

Construct a 1 x n Matrix from 2 row Vectors

 > $⟨⟨1|2|3⟩|⟨4|5|6⟩⟩$
 $\left[\begin{array}{rrrrrr}{1}& {2}& {3}& {4}& {5}& {6}\end{array}\right]$ (8)

Create a Matrix and a column Vector, and join them

 > $A≔⟨⟨2|3⟩,⟨5|7⟩⟩$
 ${A}{:=}\left[\begin{array}{rr}{2}& {3}\\ {5}& {7}\end{array}\right]$ (9)
 > $b≔⟨6,-9⟩$
 ${b}{:=}\left[\begin{array}{r}{6}\\ {-}{9}\end{array}\right]$ (10)
 > $⟨A|b⟩$
 $\left[\begin{array}{rrr}{2}& {3}& {6}\\ {5}& {7}& {-}{9}\end{array}\right]$ (11)

 See Also

## Was this information helpful?

 Please add your Comment (Optional) E-mail Address (Optional) What is ? This question helps us to combat spam