Please post you whole code in code tags

.
I'm not sure I understood what is the logic that should apply, is it:
A matrix PxQ size
For each row < min( P,Q)
for all members of this row:
new value = old value / old value of p,q element
Is this the logic that should apply?
How often should the state of the matrix be saved?
Is there a requirement about the version of JSE ?