The routines forEachVector and forEachMatrix were implemented and used to achieve this goal.
forEachVector
forEachMatrix