OVERLAY allows you to have two matrices with different "shapes" but the same number of elements share the same space. In this case, you need a stacked up vector of size nsteps*nvar for doing the actual calculations, but for the purposes of setting things up, it's much more convenient to work with an nsteps x nvar rectangular array.
Code: Select all
overlay u(1) with uover(nsteps,nvar)
"overlays" the elements of the vector u with the elements of uover. If you change one, you change the other. We should really re-code that to replace those with the safer
%vectorect and
%vec functions.
OVERLAY is a bit dangerous as if you re-dimension either matrix, you break the correspondence.
The syntax is
overlay
element of existing array WITH
dimension field
The
element of existing array would be something like u(1) or uover(1,1), though it doesn't have to be the top or top corner. The
dimension field is an array name followed by the dimensions that you want it to have.