Previous Page Next Page Contents

linalg::substitute -- replace a part of a matrix by another matrix

Introduction

linalg::substitute(B, A, m, n) returns a copy of the matrix B, where entries starting at position [m,n] are replaced by the entries of the matrix A.

Call(s)

linalg::substitute(B, A, m, n)

Parameters

A, B - matrices of a domain of category Cat::Matrix
m, n - positive integers

Returns

a matrix of the same domain type as B.

Related Functions

linalg::submatrix, linalg::concatMatrix, linalg::setCol, linalg::setRow, linalg::stackMatrix

Details

Example 1

We define the following matrix:

>> B := matrix(
     [[1, 2, 3, 4], [5, 6, 7, 8],
      [9, 10, 11, 12], [13, 14, 15, 16]]
   )
                           +-                -+
                           |   1,  2,  3,  4  |
                           |                  |
                           |   5,  6,  7,  8  |
                           |                  |
                           |   9, 10, 11, 12  |
                           |                  |
                           |  13, 14, 15, 16  |
                           +-                -+

and copy the 2 x 2 zero matrix into the matrix B, beginning at position [3,3]:

>> A := matrix(2, 2):
   linalg::substitute(B, A, 3, 3)
                            +-              -+
                            |   1,  2, 3, 4  |
                            |                |
                            |   5,  6, 7, 8  |
                            |                |
                            |   9, 10, 0, 0  |
                            |                |
                            |  13, 14, 0, 0  |
                            +-              -+

Matrix entries out of range are ignored:

>> linalg::substitute(B, A, 4, 4)
                           +-                -+
                           |   1,  2,  3,  4  |
                           |                  |
                           |   5,  6,  7,  8  |
                           |                  |
                           |   9, 10, 11, 12  |
                           |                  |
                           |  13, 14, 15,  0  |
                           +-                -+

Changes




Do you have questions or comments?


Copyright © SciFace Software GmbH & Co. KG 2000