| 10737 | } /* icamax_ */ |
| 10738 | |
| 10739 | integer idamax_(integer *n, doublereal *dx, integer *incx) |
| 10740 | { |
| 10741 | /* System generated locals */ |
| 10742 | integer ret_val, i__1; |
| 10743 | doublereal d__1; |
| 10744 | |
| 10745 | /* Local variables */ |
| 10746 | static integer i__, ix; |
| 10747 | static doublereal dmax__; |
| 10748 | |
| 10749 | |
| 10750 | /* |
| 10751 | Purpose |
| 10752 | ======= |
| 10753 | |
| 10754 | IDAMAX finds the index of element having max. absolute value. |
| 10755 | |
| 10756 | Further Details |
| 10757 | =============== |
| 10758 | |
| 10759 | jack dongarra, linpack, 3/11/78. |
| 10760 | modified 3/93 to return if incx .le. 0. |
| 10761 | modified 12/3/93, array(1) declarations changed to array(*) |
| 10762 | |
| 10763 | ===================================================================== |
| 10764 | */ |
| 10765 | |
| 10766 | /* Parameter adjustments */ |
| 10767 | --dx; |
| 10768 | |
| 10769 | /* Function Body */ |
| 10770 | ret_val = 0; |
| 10771 | if (*n < 1 || *incx <= 0) { |
| 10772 | return ret_val; |
| 10773 | } |
| 10774 | ret_val = 1; |
| 10775 | if (*n == 1) { |
| 10776 | return ret_val; |
| 10777 | } |
| 10778 | if (*incx == 1) { |
| 10779 | goto L20; |
| 10780 | } |
| 10781 | |
| 10782 | /* code for increment not equal to 1 */ |
| 10783 | |
| 10784 | ix = 1; |
| 10785 | dmax__ = abs(dx[1]); |
| 10786 | ix += *incx; |
| 10787 | i__1 = *n; |
| 10788 | for (i__ = 2; i__ <= i__1; ++i__) { |
| 10789 | if ((d__1 = dx[ix], abs(d__1)) <= dmax__) { |
| 10790 | goto L5; |
| 10791 | } |
| 10792 | ret_val = i__; |
| 10793 | dmax__ = (d__1 = dx[ix], abs(d__1)); |
| 10794 | L5: |
| 10795 | ix += *incx; |
| 10796 | /* L10: */ |
no test coverage detected