Previous Page Next Page Contents

Dom::SquareMatrix -- the rings of square matrices

Introduction

Dom::SquareMatrix(n, R) creates the ring of n x n matrices over the component ring R.

Domain

Dom::SquareMatrix(n <, R>)

Parameters

n - a positive integer
R - a ring, i.e., a domain of category Cat::Rng; default is Dom::ExpressionField()

Details

Creating Elements

Dom::SquareMatrix(n, R)(Array)
Dom::SquareMatrix(n, R)(Matrix)
Dom::SquareMatrix(n, R)( <n, n>)
Dom::SquareMatrix(n, R)( <n, n, >ListOfRows)
Dom::SquareMatrix(n, R)( <n, n, >f)
Dom::SquareMatrix(n, R)( <n, n, >List, Diagonal)
Dom::SquareMatrix(n, R)( <n, n, >g, Diagonal)
Dom::SquareMatrix(n, R)( <n, n, >List, Banded)

Parameters

Array - an n x n array
Matrix - an n x n matrix, i.e., an element of a domain of category Cat::Matrix
List - a list of matrix components
ListOfRows - a list of at most n rows; each row is a list of at most n matrix components
f - a function or a functional expression with two parameters (the row and column index)
g - a function or a functional expression with one parameter (the row index)

Options

Diagonal - create a diagonal matrix
Banded - create a banded Toeplitz matrix

Categories

Cat::SquareMatrix(R)

Related Domains

Dom::Matrix, Dom::MatrixGroup

Details

Option: Diagonal

Option: Banded

Entries

one

is the n x n identity matrix. This entry exists if the component ring R is a domain of category Cat::Ring, i.e., a ring with unit.

randomDimen

is set to [n, n].

zero

is the n x n zero matrix.

Method evalp: evaluating matrices of polynomials at a certain point

Method identity: identity matrix

Method matdim: matrix dimension

Method random: random matrix generation

Method _concat: horizontal concatenation of matrices

Method _index: matrix indexing

Method concatMatrix: horizontal concatenation of matrices

Method col: extracting a column

Method delCol: deleting a column

Method delRow: deleting a row

Method row: extracting a row

Method stackMatrix: vertical concatenation of matrices

Method create: defining matrices without component conversions

Example 1

A lot of examples can be found on the help page of the domain constructor Dom::Matrix, and most of them are also examples for working with domains created by Dom::SquareMatrix.

These examples only concentrate on some differences with respect to working with matrices of the domain Dom::Matrix(R).

The following command defines the ring of two-dimensional matrices over the rationals:

>> SqMatQ := Dom::SquareMatrix(2, Dom::Rational)
                    Dom::SquareMatrix(2, Dom::Rational)
>> SqMatQ::hasProp(Cat::Ring)
                                   TRUE

The unit is defined by the entry "one", which is the 2 x 2 identity matrix:

>> SqMatQ::one
                                +-      -+
                                |  1, 0  |
                                |        |
                                |  0, 1  |
                                +-      -+

Note that some operations defined by the domain SqMatQ return matrices which are no longer square. They return therefore matrices of the domain Dom::Matrix(Dom::Rational), the super-domain of SqMatQ. For example, if we delete the first row of the matrix:

>> A := SqMatQ([[1, 2], [-5, 3]])
                                +-       -+
                                |   1, 2  |
                                |         |
                                |  -5, 3  |
                                +-       -+

we get the matrix:

>> SqMatQ::delRow(A, 1)
                                 +-     -+
                                 | -5, 3 |
                                 +-     -+

which is of the domain type:

>> domtype(%)
                        Dom::Matrix(Dom::Rational)

Example 2

We can convert a square matrix into or from another matrix domain, as shown next:

>> SqMatR := Dom::SquareMatrix(3, Dom::Real):
   MatC := Dom::Matrix(Dom::Complex):
>> A := SqMatR((i, j) -> sin(i*j))
                       +-                        -+
                       |  sin(1), sin(2), sin(3)  |
                       |                          |
                       |  sin(2), sin(4), sin(6)  |
                       |                          |
                       |  sin(3), sin(6), sin(9)  |
                       +-                        -+       

To convert A into a matrix of the domain MatC, enter:

>> coerce(A, MatC)
                       +-                        -+
                       |  sin(1), sin(2), sin(3)  |
                       |                          |
                       |  sin(2), sin(4), sin(6)  |
                       |                          |
                       |  sin(3), sin(6), sin(9)  |
                       +-                        -+
>> domtype(%)
                         Dom::Matrix(Dom::Complex)

The conversion is done component-wise, as the following examples shows:

>> B := MatC([[0, 1], [exp(I), 0]])
                              +-           -+
                              |     0,   1  |
                              |             |
                              |  exp(I), 0  |
                              +-           -+

The matrix B is square but has one complex component and therefore cannot be converted into the domain SqMatR:

>> coerce(B, SqMatR)
                                   FAIL

Super-Domain

Dom::Matrix

Axioms

if R has Ax::canonicalRep, then
Ax::canonicalRep

Changes




Do you have questions or comments?


Copyright © SciFace Software GmbH & Co. KG 2000