# Cat::Matrix

Category of matrices

### Use only in the MuPAD Notebook Interface.

This functionality does not run in MATLAB.

## Syntax

```Cat::Matrix(`R`)
```

## Description

`Cat::Matrix(R)` represents the category of matrices over the rng `R`.

A `Cat::Matrix(R)` is a matrix of arbitrary dimension over a component ring `R`.

In the following description of the methods, we use the following notations for a matrix A from a domain of category `Cat::Matrix(R)`:

nrows(A) denotes the number of rows and ncols(A) the number of columns of A.

Further on, a row index is an integer ranges from 1 to nrows(A), and a column index is an integer ranges from 1 to ncols(A).

## Categories

`Cat::BaseCategory`

## Parameters

 `R` A domain which must be from the category `Cat::Rng` (a ring without unit).

## Entries

 "coeffRing" is set to `R`.

collapse all

## Basic Methods

### `_index` — Matrix indexing

`_index(A, i, j)`

### `matdim` — Matrix dimension

`matdim(A)`

### `new` — Matrix definition

`new(m, n)`

Of course, this method may implement further possibilites to create matrices (for example, see the method `"new"` of the domain constructor `Dom::Matrix`).

### `set_index` — Setting matrix components

`set_index(A, i, j, x)`

## Mathematical Methods

### `_negate` — Negate a matrix

`_negate(A)`

### `_plus` — Add matrices

```_plus(A1, A2, …)```

The matrices must be of the same domain type, otherwise `FAIL` is returned.

### `_subtract` — Subtract two matrices

`_subtract(A, B)`

### `equal` — Test on equality of matrices

`equal(A, B)`

### `identity` — Identity matrix

`identity(n)`

It only exists if `R` is of category `Cat::Ring`, i.e., a ring with unit.

### `iszero` — Test on zero matrices

`iszero(A)`

Note that there may be more than one representation of the zero matrix of a given dimension if `R` does not have the axiom `Ax::canonicalRep`.

### `transpose` — Transpose of a matrix

`transpose(A)`

## Access Methods

### `col` — Extracting columns

`col(A, c)`

### `concatMatrix` — Horizontal concatenation of matrices

`concatMatrix(A, B)`

An error message is issued if the two matrices do not have the same number of rows.

### `delCol` — Deleting columns

`delCol(A, c)`

If `A` only consists of one column then `NIL` is returned.

### `delRow` — Deleting rows

`delRow(A, r)`

If `A` only consists of one row then `NIL` is returned.

### `row` — Extracting rows

`row(A, r)`

### `setCol` — Replacing columns

`setCol(A, c, v)`

### `setRow` — Replacing rows

`setRow(A, r, v)`

### `stackMatrix` — Appending of matrices vertically

`stackMatrix(A, B)`

An error message is issued if the two matrices do not have the same number of columns.

### `swapCol` — Swapping matrix columns

`swapCol(A, c1, c2)`

### `swapRow` — Swapping matrix rows

`swapRow(A, r1, r2)`