Array - Maple Help

convert/Array

convert an array, Array, vector, Vector, matrix, Matrix, list, or listlist to an Array

 Calling Sequence convert( A, Array, opts );

Parameters

 A - array, Array, vector, Vector, matrix, Matrix, list, listlist; expression to convert opts - (optional) one or more options as described below

Options

 • copy : truefalse
 Indicates whether a new rtable should be allocated when converting from other rtable types such as Matrix or Vector. The default is false, meaning that convert will attempt to provide a reference to the existing rtable instead of allocating a new one.
 • format : string
 The option behaves identically to targetformat, but is only valid when expr is not itself a string or ByteArray.
 • sourceformat : string
 A string corresponding to one of the file formats described in Formats. The input expr will be decoded using the specified format and the data returned as a Array. If the format specified is not one for which an Array is a valid output type, an error is issued.
 If the format specified is not one for which an Array is a valid output type and no target format is specified, an error is issued.
 • targetformat : string
 A string corresponding to one of the file formats described in Formats. The input expr will be encoded in the specified format and the encoded data returned as an Array.
 Note that this can be used in conjunction with sourceformat to decode data from a source to an arbitrary intermediate expression, then encode it as an Array in a different format.
 • Any other options specified will be passed to the Array constructor.

Description

 • The convert(A, Array) function converts A into an Array. This is accomplished by passing A and any additional parameters to the Array constructor. No special order is required for the additional parameters.

Examples

 > $A≔\left[\left[1,2\right],\left[3,4\right]\right]$
 ${A}{≔}\left[\left[{1}{,}{2}\right]{,}\left[{3}{,}{4}\right]\right]$ (1)
 > $\mathrm{A1}≔\mathrm{convert}\left(A,\mathrm{Array}\right)$
 ${\mathrm{A1}}{≔}\left[\begin{array}{cc}{1}& {2}\\ {3}& {4}\end{array}\right]$ (2)
 > $\mathrm{type}\left(A,\mathrm{Array}\right)$
 ${\mathrm{false}}$ (3)
 > $\mathrm{type}\left(\mathrm{A1},\mathrm{Array}\right)$
 ${\mathrm{true}}$ (4)
 > $M≔\mathrm{matrix}\left(3,3,\left[\left[1,1,1\right],\left[1,2,3\right],\left[7,8,9\right]\right]\right)$
 ${M}{≔}\left[\begin{array}{ccc}{1}& {1}& {1}\\ {1}& {2}& {3}\\ {7}& {8}& {9}\end{array}\right]$ (5)
 > $\mathrm{M1}≔\mathrm{convert}\left(M,\mathrm{Array},\mathrm{datatype}=\mathrm{float}\right)$
 ${\mathrm{M1}}{≔}\left[\begin{array}{ccc}{1.}& {1.}& {1.}\\ {1.}& {2.}& {3.}\\ {7.}& {8.}& {9.}\end{array}\right]$ (6)
 > $\mathrm{type}\left(M,\mathrm{Array}\right)$
 ${\mathrm{false}}$ (7)
 > $\mathrm{type}\left(\mathrm{M1},\mathrm{Array}\right)$
 ${\mathrm{true}}$ (8)
 > $\mathrm{LL}≔\left[\left[1,2\right],\left[-3,4\right]\right]$
 ${\mathrm{LL}}{≔}\left[\left[{1}{,}{2}\right]{,}\left[{-3}{,}{4}\right]\right]$ (9)
 > $\mathrm{LL1}≔\mathrm{convert}\left(\mathrm{LL},\mathrm{Array},\mathrm{datatype}=\mathrm{float},-3..-4,-5..-4,\mathrm{order}=\mathrm{C_order}\right)$
 > $\mathrm{type}\left(\mathrm{LL},\mathrm{Array}\right)$
 ${\mathrm{false}}$ (10)
 > $\mathrm{type}\left(\mathrm{LL1},\mathrm{Array}\right)$
 ${\mathrm{true}}$ (11)
 > $\mathrm{ArrayDims}\left(\mathrm{LL1}\right)$
 ${-3}{..}{-4}{,}{-5}{..}{-4}$ (12)
 > $\mathrm{ArrayOptions}\left(\mathrm{LL1}\right)$
 ${\mathrm{datatype}}{=}{{\mathrm{float}}}_{{8}}{,}{\mathrm{storage}}{=}{\mathrm{rectangular}}{,}{\mathrm{order}}{=}{\mathrm{C_order}}$ (13)
 > $\mathrm{AA}≔\left[\left[1,2\right],\left[-3,4\right]\right]$
 ${\mathrm{AA}}{≔}\left[\left[{1}{,}{2}\right]{,}\left[{-3}{,}{4}\right]\right]$ (14)
 > $\mathrm{AA1}≔\mathrm{convert}\left(\mathrm{AA},\mathrm{Array},\mathrm{datatype}=\mathrm{float},{\mathrm{band}}_{1,1},\mathrm{order}=\mathrm{C_order}\right)$
 ${\mathrm{AA1}}{≔}\left[\begin{array}{cc}{1.}& {2.}\\ {-3.}& {4.}\end{array}\right]$ (15)
 > $\mathrm{type}\left(\mathrm{AA},\mathrm{Array}\right)$
 ${\mathrm{false}}$ (16)
 > $\mathrm{type}\left(\mathrm{AA1},\mathrm{Array}\right)$
 ${\mathrm{true}}$ (17)
 > $\mathrm{ArrayDims}\left(\mathrm{AA1}\right)$
 ${1}{..}{2}{,}{1}{..}{2}$ (18)
 > $\mathrm{ArrayOptions}\left(\mathrm{AA1}\right)$
 ${\mathrm{datatype}}{=}{{\mathrm{float}}}_{{8}}{,}{\mathrm{storage}}{=}{{\mathrm{band}}}_{{1}{,}{1}}{,}{\mathrm{order}}{=}{\mathrm{C_order}}$ (19)
 > $\mathrm{ArrayIndFns}\left(\mathrm{AA1}\right)$
 ${{\mathrm{band}}}_{{1}{,}{1}}$ (20)
 > $\mathrm{convert}\left("1,2,3 4,5,6 7,8,9",\mathrm{Array},\mathrm{sourceformat}="CSV"\right)$
 $\left[\begin{array}{ccc}{1}& {2}& {3}\\ {4}& {5}& {6}\\ {7}& {8}& {9}\end{array}\right]$ (21)

Compatibility

 • The convert/Array command was updated in Maple 2022.
 • The copy, format, sourceformat and targetformat options were introduced in Maple 2022.