DI i = 1,n-1
PROGRAM GAUSS_90 REAL, allocatable :: A(:,:), X(:), Y(:), START(:) INTEGER :: i REAL TEMP REAL, allocatable :: SWAP(:) INTEGER j, n, location, location_array(1) print *, "Problem size = ? (>5)" read (*,*) n print *, "Problem size = ", n allocate(a(n,n), x(n), y(n), start(n), swap(n)) A = 0.1 !HPF$ INDEPENDENT FORALL (i=1:n) START(i) = i A(1+MODULO(i+1,n),i) = i+5 END FORALL !* Was: !* DO i=1,n !* START(i) = i !* A(1+MODULO(i+1,n),i) = i+5 !* ENDDO Y = 0 !HPF$ INDEPENDENT FORALL (i=1:n) Y(i) = SUM( A(i,:)*START ) !* Was: !* DO i = 1, n !* Y(i) = SUM( A(i,:)*START ) !* ENDDO !CALL GAUSS_ELIM_90( A, X, Y ) DO i = 1, n-1 location_array = MAXLOC( ABS(A(i:n,i)) ) ! location = location_array(1)+i-1 ! SWAP(i:n) = A(location,i:n) ! TEMP = Y(location) ! IF (location /= i) THEN ! A(location,i:n) = A(i,i:n) ! A(i,i:n) = SWAP(i:n) ! Y(location) = Y(i) ! Y(i) = TEMP ! END IF ! !HPF$ INDEPENDENT FORALL (j=i+1:n) A(j,i) = A(j, i) / swap(i) A(j, i+1:n) = A(j, i+1:n ) - a(j, i) * SWAP(i+1:n) Y(j) = Y(j) - a(j,i) * TEMP END FORALL !* DO j = i+1, n !* A(j,i) = A(j, i) / swap(i) !* A(j, i+1:n) = A(j, i+1:n ) - a(j, i) * SWAP(i+1:n) !* Y(j) = Y(j) - a(j,i) * TEMP !* ENDDO ENDDO X(n) = Y(n) / A(n,n) !* Cannot change DO i = n-1, 1, -1 Y(1:i) = Y(1:i) - X(i+1) * A(1:i, i+1) X(i) = Y(i) / A(i,i) ENDDO !* Cannot change -> contains Output DO i = 1, 5 WRITE(*,*) i, X(i) ENDDO !* Cannot change -> contains Output DO i = n - 4, n WRITE(*,*) i, X(i) ENDDO END PROGRAM GAUSS_90