## `linalg::concatMatrix` -- join matrices horizontally

#### Introduction

`linalg::concatMatrix``(A, B1, <B2...>)` returns the matrix formed by joining the matrices A, B1, B2, ... horizontally.

#### Call(s)

`linalg::concatMatrix(A, B1 <, B2...>)`

#### Parameters

`A, B1, B2...` | - | matrices of a domain of category `Cat::Matrix`

#### Returns

a matrix of the domain type `Dom::Matrix(R)`, where `R` is the component ring of `A`.

#### Related Functions

`linalg::stackMatrix`

#### Details

- The matrices `B1, B2...` are converted into the matrix domain `Dom::Matrix(R)`, where `R` is the component ring of `A`.

  An error message is raised if one of these conversions fails, or if the matrices do not have the same number of rows as the matrix `A`.

- A short form of `linalg::concatMatrix` is available through the dot operator `.`, i.e., instead of `linalg::concatMatrix``(A, B)` one may use the short form `A . B`.

#### Example 1

We define the matrix:

    >> A := matrix([[sin(x), x], [-x, cos(x)]])

                               +-                -+
                               |  sin(x),    x    |
                               |                  |
                               |    -x,   cos(x)  |
                               +-                -+

and append the 2x2 identity matrix to the right of `A`:

    >> I2 := matrix::identity(2):
       linalg::concatMatrix(A, I2)

                            +-                      -+
                            |  sin(x),    x,   1, 0  |
                            |                        |
                            |    -x,   cos(x), 0, 1  |
                            +-                      -+

The short form for this operation is:

    >> A . I2

                            +-                      -+
                            |  sin(x),    x,   1, 0  |
                            |                        |
                            |    -x,   cos(x), 0, 1  |
                            +-                      -+

#### Example 2

We define a matrix from the ring of 2x2 square matrices:

    >> SqMatQ := Dom::SquareMatrix(2, Dom::Rational):
       A := SqMatQ([[1, 2], [3, 4]])

                                    +-      -+
                                    |  1, 2  |
                                    |        |
                                    |  3, 4  |
                                    +-      -+

Note the following operation:

    >> AA := A . A

                                 +-            -+
                                 |  1, 2, 1, 2  |
                                 |              |
                                 |  3, 4, 3, 4  |
                                 +-            -+

returns a matrix of a different domain type as the input matrix:

    >> domtype(AA)

                            Dom::Matrix(Dom::Rational)

Do you have questions or comments?
Copyright © SciFace Software GmbH & Co. KG 2000