~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Linux Cross Reference
Tina4/src/draw/plot/plot_util.c

Version: ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /**@(#)
  2 **/
  3 #include <tina/sys.h>
  4 #include <tina/sysfuncs.h>
  5 
  6 double  fvector_min(float *x, int n1, int n2)
  7 {
  8     int     i;
  9     double  xmin = x[n1];
 10 
 11     for (i = n1 + 1; i < n2; i++)
 12         xmin = MIN(xmin, x[i]);
 13     return (xmin);
 14 }
 15 
 16 double  fvector_max(float *x, int n1, int n2)
 17 {
 18     int     i;
 19     double  xmax = x[n1];
 20 
 21     for (i = n1 + 1; i < n2; i++)
 22         xmax = MAX(xmax, x[i]);
 23     return (xmax);
 24 }
 25 
 26 double  farray_min(float **x, int m1, int n1, int m2, int n2)
 27 {
 28     int     i, j;
 29     double  xmin = x[m1][n1];
 30 
 31     for (i = m1; i < m2; i++)
 32         for (j = n1; j < n2; j++)
 33             xmin = MIN(xmin, x[i][j]);
 34     return (xmin);
 35 }
 36 
 37 double  farray_max(float **x, int m1, int n1, int m2, int n2)
 38 {
 39     int     i, j;
 40     double  xmax = x[m1][n1];
 41 
 42     for (i = m1; i < m2; i++)
 43         for (j = n1; j < n2; j++)
 44             xmax = MAX(xmax, x[i][j]);
 45     return (xmax);
 46 }
 47 
 48 void    farray_bounds(float **z, int m1, int n1, int m2, int n2, double *zmin, double *zmax)
 49 {
 50     int     i, j;
 51     double  minval, maxval;
 52 
 53     minval = maxval = z[m1][n1];
 54     for (i = m1; i < m2; i++)
 55         for (j = n1; j < n2; j++)
 56         {
 57             minval = MIN(minval, z[i][j]);
 58             maxval = MAX(maxval, z[i][j]);
 59         }
 60     *zmin = minval;
 61     *zmax = maxval;
 62 }
 63 
 64 float **farray_of_func(float (*f) ( /* ??? */ ), int nx, float ax, float bx, int ny, float ay, float by)
 65 {
 66     int     i, j;
 67     float **z, dx, dy;
 68 
 69     z = farray_alloc(0, 0, nx, ny);
 70     dx = (bx - ax) / nx;
 71     dy = (by - ay) / ny;
 72     for (i = 0; i <= nx; i++)
 73     {
 74         double  xi = ax + i * dx;
 75 
 76         for (j = 0; j <= ny; j++)
 77         {
 78             double  yj = ay + j * dy;
 79 
 80             z[i][j] = (*f) (xi, yj);
 81         }
 82     }
 83     return (z);
 84 }
 85 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.