I have a doubt in this piece of code.
- Code: Select all
201: *
202: * JMAX is the column-index of the largest off-diagonal
203: * element in row IMAX, and ROWMAX is its absolute value
204: *
205: ROWMAX = ZERO
206: JMAX = IMAX
207: KX = IMAX*( IMAX+1 ) / 2 + IMAX
208: DO 20 J = IMAX + 1, K
209: IF( ABS( AP( KX ) ).GT.ROWMAX ) THEN
210: ROWMAX = ABS( AP( KX ) )
211: JMAX = J
212: END IF
213: KX = KX + J
214: 20 CONTINUE
215: KPC = ( IMAX-1 )*IMAX / 2 + 1
216: IF( IMAX.GT.1 ) THEN
217: JMAX = ISAMAX( IMAX-1, AP( KPC ), 1 )
218: ROWMAX = MAX( ROWMAX, ABS( AP( KPC+JMAX-1 ) ) )
219: END IF
Everything is clear until line 214. It is as per the comment at line 202.
The entire IMAX row is scanned (except the diagonal element) to find what is the maximum value.
Starting from line 216, the "IMAX"th COLUMN is scanned fora larger value.
At the end of 219, "JMAX" stands for a ROW# (if IMAX was > 1) and ROWMAX could EITHER be on the IMAXth row or IMAXth column.
My point of confusion is that "JMAX" is updated readily inside the IF statement without actually looking at the result of the "MAX" statement below.
Can some1 please clear my doubts?
Thank you,
Best Regards,
Sarnath

