jdouble m7findMaxTBP1jdoublemT7FindMax(TBP1jdouble array){ T13tiRectDomain17domains2ti domain; int i; jint t3x_1_u1, t3x_2_u2; jdouble maxValue; T8tiPoint17domains2ti curPoint; jint stride; jint size; jint index; /* get the domain that represents this array */ domain = _ti_global_arraymethod_domain(jdouble, 1)(array); /* get the stride of the domain */ stride = domain.f10loopStrideT13tiRectDomain17domains2ti; /* find out the size of the domain in terms of number of points in the domain */ size = m4sizemT13tiRectDomain17domains2ti(domain); index = domain.f2p0T13tiRectDomain17domains2ti; mi9constructmT8tiPoint17domains2ti(curPoint, index); if (size == 0){ return -1; } else{ jdouble maxSoFar; Pjdouble ptr; TI_ARRAY_ADDR_GLOBAL(jdouble, 1)(ptr, array, curPoint, "FindMax.ti:11:7"); DEREF_GLOBAL_jdouble(maxSoFar, ptr); for (i = 1; i < size; i++){ jdouble tmp; index += stride; mi9constructmT8tiPoint17domains2ti(curPoint, index); TI_ARRAY_ADDR_GLOBAL(jdouble, 1)(ptr, array, curPoint, "FindMax.ti:11:7"); DEREF_GLOBAL_jdouble(tmp, ptr); if (tmp > maxSoFar){ maxSoFar = tmp; } } return maxSoFar; } }