A.SubMatrix(fr,lr,fc,lc)
This selects a submatrix from A. The arguments fr,lr,fc,lc
are the
first row, last row, first column, last column of the submatrix with the
numbering beginning at 1. This may be used in any matrix expression or
on the left hand side of =, << or Inject. Inject
does not check no
information loss. You can also use the construction
Real c; .... A.SubMatrix(fr,lr,fc,lc) = c;
to set a submatrix equal to a constant.
The following are variants of SubMatrix:
A.SymSubMatrix(f,l) // This assumes fr=fc and lr=lc.
A.Rows(f,l) // select rows
A.Row(f) // select single row
A.Columns(f,l) // select columns
A.Column(f) // select single column
In each case f and l mean the first and last row or column to be
selected (starting at 1).
I allow lr = fr-1, lc = fc-1 or l = f-1 to indicate that a matrix of zero rows or columns is to be returned.
If SubMatrix or its variant occurs on the right hand side of an = or << or within an expression its type is as follows
A.SubMatrix(fr,lr,fc,lc): If A is RowVector or
ColumnVector then same type
otherwise type Matrix
A.SymSubMatrix(f,l): Same type as A
A.Rows(f,l): Type Matrix
A.Row(f): Type RowVector
A.Columns(f,l): Type Matrix
A.Column(f): Type ColumnVector
If SubMatrix or its variant appears on the left hand side of = or
<< ,
think of its type being Matrix. Thus L.Row(1) where L is
LowerTriangularMatrix expects L.Ncols() elements even though it
will use only one of them. If you are using = the program will
check for no loss of data.
A SubMatrix can appear on the left-hand side of += or -= with a matrix expression on the right-hand side. It can also appear on the left-hand side of +=, -=, *= or /= with a Real on the right-hand side. In each case there must be no loss of information.
Do not use the += and -= operations with a submatrix of a SymmetricMatrix or BandSymmetricMatrix on the LHS and a Real on the RHS.
If you are are using the submatrix facility to build a matrix from a small number of components, consider instead using the concatenation operators.