Determines the relation between two matrix positions.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in) | :: | row1 | |||
integer, | intent(in) | :: | col1 | |||
integer, | intent(in) | :: | row2 | |||
integer, | intent(in) | :: | col2 |
Relation between positions 1 and 2. 0: same -1: pos1 < pos2 1: pos1 > pos2
ELEMENTAL FUNCTION pos_relation(row1, col1, row2, col2) RESULT(relation) !! Determines the relation between two matrix positions. INTEGER, INTENT(IN) :: row1, col1, row2, col2 INTEGER :: relation !! Relation between positions 1 and 2. 0: same -1: pos1 < pos2 1: pos1 > pos2 IF (row1 .LT. row2) THEN relation = -1 ELSEIF (row1 .GT. row2) THEN relation = 1 ELSE ! rows are equal, check column IF (col1 .LT. col2) THEN relation = -1 ELSEIF (col1 .GT. col2) THEN relation = 1 ELSE relation = 0 END IF END IF END FUNCTION pos_relation