convert/Vector - Maple Programming Help

# Online Help

###### All Products    Maple    MapleSim

Home : Support : Online Help : Programming : Data Types : Conversion : convert/Vector

convert/Vector

convert a list, vector, array, Array, Vector, matrix or Matrix to a Vector

 Calling Sequence convert( A, Vector, ... ); convert( A, Vector[o], ... );

Parameters

 A - list, vector, array, Array, Vector, matrix, Matrix; expression to convert o - (optional) use either row or column; specifies result orientation ... - options to be passed to the Vector constructor

Description

 • The convert(A, Vector) function converts the parameter A into a Vector.
 • The orientation of the result can be specified via the parameter o. The default orientation is column.
 • If A is a 1-dimensional array or Array, a list, a vector or a Vector, it is simply passed directly to the Vector constructor, together with any additional options, and the orientation, o, if provided.
 • If A is a matrix, Matrix, 2-D array or 2-D Array, its columns or rows are concatenated to form the result.  If the orientation parameter, o, is either not provided or is given as column, the columns of A are concatenated (from left to right) and a column Vector is returned.  If the orientation parameter is given as row, the rows of A are concatenated (from top to bottom) and a row Vector is returned.  Any additional parameters are passed to the Vector constructor when building the result.
 • Alternatively, use the ArrayTools[Copy] function. The ArrayTools[Copy] function copies data from an existing Matrix, Vector, or Array (source) to another Matrix, Vector, or Array (target).

Examples

 > $L≔\left[1,0\right]$
 ${L}{≔}\left[{1}{,}{0}\right]$ (1)
 > $\mathrm{L1}≔\mathrm{convert}\left(L,\mathrm{Vector}\right)$
 ${\mathrm{L1}}{≔}\left[\begin{array}{r}{1}\\ {0}\end{array}\right]$ (2)
 > $\mathrm{type}\left(L,\mathrm{Vector}\right)$
 ${\mathrm{false}}$ (3)
 > $\mathrm{type}\left(\mathrm{L1},\mathrm{Vector}\right)$
 ${\mathrm{true}}$ (4)
 > $A≔\mathrm{array}\left(1..4\right):$
 > $\mathbf{for}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}i\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}\mathbf{to}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}3\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}\mathbf{do}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{A}_{i}≔{i}^{2}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}\mathbf{end do}:$$\mathrm{print}\left(A\right)$
 $\left[\begin{array}{cccc}{1}& {4}& {9}& {{\mathrm{?}}}_{{4}}\end{array}\right]$ (5)
 > $\mathrm{A1}≔\mathrm{convert}\left(A,\mathrm{Vector},\mathrm{datatype}=\mathrm{float}\right)$
 ${\mathrm{A1}}{≔}\left[\begin{array}{cccc}{1.}& {4.}& {9.}& {0.}\end{array}\right]$ (6)
 > $\mathrm{type}\left(A,\mathrm{Vector}\right)$
 ${\mathrm{false}}$ (7)
 > $\mathrm{type}\left(\mathrm{A1},\mathrm{Vector}\right)$
 ${\mathrm{true}}$ (8)
 > $V≔\mathrm{linalg}[\mathrm{vector}]\left(3,\left[1,x,{x}^{2}\right]\right)$
 ${V}{≔}\left[\begin{array}{ccc}{1}& {x}& {{x}}^{{2}}\end{array}\right]$ (9)
 > $\mathrm{V1}≔\mathrm{convert}\left(V,\mathrm{Vector}\right)$
 ${\mathrm{V1}}{≔}\left[\begin{array}{ccc}{1}& {x}& {{x}}^{{2}}\end{array}\right]$ (10)
 > $\mathrm{type}\left(V,\mathrm{Vector}\right)$
 ${\mathrm{false}}$ (11)
 > $\mathrm{type}\left(\mathrm{V1},\mathrm{Vector}\right)$
 ${\mathrm{true}}$ (12)
 > $M≔⟨⟨1,2,3⟩|⟨4,5,6⟩⟩$
 ${M}{≔}\left[\begin{array}{rr}{1}& {4}\\ {2}& {5}\\ {3}& {6}\end{array}\right]$ (13)
 > $\mathrm{convert}\left(M,\mathrm{Vector}\right)$
 $\left[\begin{array}{r}{1}\\ {2}\\ {3}\\ {4}\\ {5}\\ {6}\end{array}\right]$ (14)
 > $\mathrm{convert}\left(M,\mathrm{Vector}[\mathrm{row}]\right)$
 $\left[\begin{array}{cccccc}{1}& {4}& {2}& {5}& {3}& {6}\end{array}\right]$ (15)

 See Also

## Was this information helpful?

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