type/Matrix - Maple Programming Help

# Online Help

###### All Products    Maple    MapleSim

Home : Support : Online Help : Programming : Data Types : Type Checking : Types : type/Matrix

type/Matrix

check for a Matrix (rtable-based)

 Calling Sequence type(expr, Matrix) type(expr, 'Matrix'(R))

Parameters

 expr - any expression R - Matrix shape, any Matrix option, the name square, or an expression sequence of these

Description

 • A Maple Matrix is an rtable with subtype option Matrix.
 • The type(expr, Matrix) function returns true if expr is a Maple Matrix.
 • The type(expr, 'Matrix'(R)) function returns true if expr is a Maple Matrix with the shapes or options given in R (see Matrix for permissible shapes and options).
 If R includes the name 'square', the Matrix dimensions are checked for equality.
 Note:  It is essential to quote the word Matrix in this form of the calling sequence in order to avoid confusion with the Matrix(..) constructor function.

Examples

 > $A≔\mathrm{Matrix}\left(3,3,\left[\left[1,2,3\right],\left[1,1,1\right],\left[5,7,9\right]\right]\right)$
 ${A}{≔}\left[\begin{array}{rrr}{1}& {2}& {3}\\ {1}& {1}& {1}\\ {5}& {7}& {9}\end{array}\right]$ (1)
 > $\mathrm{type}\left(A,\mathrm{Matrix}\right)$
 ${\mathrm{true}}$ (2)

Check the contents of the Matrix.

 > $\mathrm{type}\left(A,'\mathrm{Matrix}'\left(\mathrm{numeric}\right)\right)$
 ${\mathrm{true}}$ (3)

Check the shape or options of the Matrix.

 > $\mathrm{type}\left(A,'\mathrm{Matrix}'\left(\mathrm{square}\right)\right)$
 ${\mathrm{true}}$ (4)
 > $\mathrm{MatrixOptions}\left(A\right)$
 ${\mathrm{shape}}{=}\left[{}\right]{,}{\mathrm{datatype}}{=}{\mathrm{anything}}{,}{\mathrm{storage}}{=}{\mathrm{rectangular}}{,}{\mathrm{order}}{=}{\mathrm{Fortran_order}}$ (5)
 > $\mathrm{type}\left(A,'\mathrm{Matrix}'\left(\mathrm{datatype}=\mathrm{anything},\mathrm{order}=\mathrm{Fortran_order},\mathrm{square}\right)\right)$
 ${\mathrm{true}}$ (6)
 > $\mathrm{type}\left(A,'\mathrm{Matrix}'\left(\mathrm{datatype}=\mathrm{integer}\right)\right)$
 ${\mathrm{false}}$ (7)

 See Also

## Was this information helpful?

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