## `linalg::multCol` -- multiply columns with a scalar

#### Introduction

`linalg::multCol``(A, c, s)` returns a copy of the matrix A resulting from A by multiplying the c-th column of A with the scalar s.

#### Call(s)

`linalg::multCol(A, c, s)`
`linalg::multCol(A, c1..c2, s)`
`linalg::multCol(A, list, s)`

#### Parameters

`A` | - | an m x n matrix of a domain of category `Cat::Matrix`
`c` | - | the column index: a positive integer <= n
`c1..c2` | - | a range of column indices (positive integers <= n)
`list` | - | a list of column indices (positive integers <= n)

#### Returns

a matrix of the same domain type as `A`.

#### Related Functions

`linalg::addCol`, `linalg::addRow`, `linalg::multRow`

#### Details

- `linalg::multCol``(A, c1..c2, s)` returns a copy of the matrix `A` obtained from `A` by multiplying those columns whose indices are in the range `c1..c2` with the scalar `s`.
- `linalg::multCol``(A, list, s)` returns a copy of the matrix `A` obtained from matrix `A` by multiplying those columns whose indices are contained in `list` with the scalar `s`.
- The scalar `s` is converted into an element of the component ring of the matrix `A`. An error message is returned if the conversion fails.

#### Example 1

We define the following matrix:

    >> A := matrix([[1, 2, 3], [4, 5, 6], [7, 8, 9]])

                                   +-         -+
                                   |  1, 2, 3  |
                                   |           |
                                   |  4, 5, 6  |
                                   |           |
                                   |  7, 8, 9  |
                                   +-         -+

and illustrate the three different input formats for `linalg::multCol`:

    >> linalg::multCol(A, 2, -1)

                                  +-          -+
                                  |  1, -2, 3  |
                                  |            |
                                  |  4, -5, 6  |
                                  |            |
                                  |  7, -8, 9  |
                                  +-          -+

    >> linalg::multCol(A, 1..2, 2)

                                  +-           -+
                                  |   2,  4, 3  |
                                  |             |
                                  |   8, 10, 6  |
                                  |             |
                                  |  14, 16, 9  |
                                  +-           -+

    >> linalg::multCol(A, [3, 1], 0)

                                   +-         -+
                                   |  0, 2, 0  |
                                   |           |
                                   |  0, 5, 0  |
                                   |           |
                                   |  0, 8, 0  |
                                   +-         -+

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