U ndiagmx,
idiag(mId,listId) = -(ndiagmx+1)
idiag(k,listId) = ndiagmx + 1
idiag(mId,listId) = ndiagmx + 1
ndiagmx = ndiagmx + kdiag(nn)*averageCycle(listId)
IF ( ndiagmx.GT.numDiags ) THEN
mdiag(mId,listId) = ndiagmx + 1
ndiagmx = ndiagmx + kdiag(mate)*averageCycle(listId)
INTEGER ndiagmx
IF (ndiagmx+kdiag(mate).GT.diagSt_size) THEN
mSdiag(mId,listId) = ndiagmx + 1
ndiagmx = ndiagmx + kdiag(mate)
IF (ndiagmx+kdiag(ndId).GT.diagSt_size) THEN
iSdiag(mId,listId) = ndiagmx + 1
ndiagmx = ndiagmx + kdiag(ndId)