home *** CD-ROM | disk | FTP | other *** search
/ Crawly Crypt Collection 2 / crawlyvol2.bin / apps / math / lpsolves / tran.c < prev    next >
C/C++ Source or Header  |  1992-08-07  |  1KB  |  68 lines

  1. #include "defines.h"
  2. #include "globals.h"
  3.  
  4. #ifdef alliant
  5. #pragma global safe (Eta_rownr, Eta_value)
  6. #pragma global assoc
  7. #endif
  8.  
  9. void  ftran(int start,
  10.         int end,
  11.         double *pcol)
  12. {
  13.   int    i, j;
  14.   int    k, r;
  15.   double theta;
  16.   
  17. #ifdef alliant
  18. #pragma safe (pcol, Endetacol)
  19. #pragma routine permutation (Eta_rownr)
  20. #endif
  21.  
  22.   if (Verbose)
  23.     printf("ftran\n");
  24.   for (i = start; i <= end; i++)
  25.     {
  26.       k = Endetacol[i] - 1;
  27.       r = Eta_rownr[k];
  28.       theta = pcol[r];
  29.       if (theta != 0)
  30.     for (j = Endetacol[i - 1]; j < k; j++)
  31.       pcol[Eta_rownr[j]] += theta * Eta_value[j]; /* cpu expensive line */
  32.       pcol[r] *= Eta_value[k];
  33.     }
  34.  
  35. #ifdef alliant
  36. #pragma loop novector
  37. #endif
  38.  
  39.   for (i = 0; i <= Rows; i++)
  40.     if (abs(pcol[i]) < EPSEL)
  41.       pcol[i] = 0;
  42. } /* ftran */
  43.  
  44. void  btran(int numc,
  45.         double *row)
  46. {
  47.   int    i, j, k;
  48.   double f;
  49.   
  50. #ifdef alliant
  51. #pragma safe (row, Endetacol)
  52. #endif
  53.  
  54.   if (Verbose)
  55.     printf("btran\n");
  56.   for (i = numc; i >= 1; i--)
  57.     {
  58.       f = 0;
  59.       k = Endetacol[i];
  60.       for (j = Endetacol[i - 1]; j < k; j++)
  61.     f += row[Eta_rownr[j]] * Eta_value[j];
  62.       if (abs(f) < EPSEL)
  63.     row[Eta_rownr[k - 1]] = 0;
  64.       else
  65.     row[Eta_rownr[k - 1]] = f;
  66.     }
  67. } /* btran */
  68.