mean.cpp
Go to the documentation of this file.
00001 /*
00002  * mean.cpp
00003  *
00004  * Code generation for function 'mean'
00005  *
00006  * C source code generated on: Wed Jul 24 16:11:35 2013
00007  *
00008  */
00009 
00010 /* Include files */
00011 #include "rt_nonfinite.h"
00012 #include "Optimal_affine_tracking_3d16_fast_realtime.h"
00013 #include "mean.h"
00014 
00015 /* Type Definitions */
00016 
00017 /* Named Constants */
00018 
00019 /* Variable Declarations */
00020 
00021 /* Variable Definitions */
00022 
00023 /* Function Declarations */
00024 
00025 /* Function Definitions */
00026 void b_mean(const real_T x[50], real_T y[2])
00027 {
00028   int32_T iy;
00029   int32_T ixstart;
00030   int32_T j;
00031   int32_T ix;
00032   real_T s;
00033   int32_T k;
00034   iy = -1;
00035   ixstart = -1;
00036   for (j = 0; j < 2; j++) {
00037     ixstart++;
00038     ix = ixstart;
00039     s = x[ixstart];
00040     for (k = 0; k < 24; k++) {
00041       ix += 2;
00042       s += x[ix];
00043     }
00044 
00045     iy++;
00046     y[iy] = s;
00047   }
00048 
00049   for (iy = 0; iy < 2; iy++) {
00050     y[iy] /= 25.0;
00051   }
00052 }
00053 
00054 void c_mean(const real_T x[3888], real_T y[3])
00055 {
00056   int32_T ix;
00057   int32_T iy;
00058   int32_T i;
00059   int32_T ixstart;
00060   real_T s;
00061   ix = -1;
00062   iy = -1;
00063   for (i = 0; i < 3; i++) {
00064     ixstart = ix + 1;
00065     ix++;
00066     s = x[ixstart];
00067     for (ixstart = 0; ixstart < 1295; ixstart++) {
00068       ix++;
00069       s += x[ix];
00070     }
00071 
00072     iy++;
00073     y[iy] = s;
00074   }
00075 
00076   for (ixstart = 0; ixstart < 3; ixstart++) {
00077     y[ixstart] /= 1296.0;
00078   }
00079 }
00080 
00081 void d_mean(const emxArray_real_T *x, real_T y[1296])
00082 {
00083   int32_T vlen;
00084   int32_T iy;
00085   int32_T ixstart;
00086   int32_T j;
00087   int32_T ix;
00088   real_T s;
00089   int32_T k;
00090   vlen = x->size[1];
00091   iy = -1;
00092   ixstart = -1;
00093   for (j = 0; j < 1296; j++) {
00094     ixstart++;
00095     ix = ixstart;
00096     s = x->data[ixstart];
00097     for (k = 2; k <= vlen; k++) {
00098       ix += 1296;
00099       s += x->data[ix];
00100     }
00101 
00102     iy++;
00103     y[iy] = s;
00104   }
00105 
00106   vlen = x->size[1];
00107   for (iy = 0; iy < 1296; iy++) {
00108     y[iy] /= (real_T)vlen;
00109   }
00110 }
00111 
00112 real_T mean(const real_T x_data[1296], const int32_T x_size[1])
00113 {
00114   real_T y;
00115   int32_T k;
00116   if (x_size[0] == 0) {
00117     y = 0.0;
00118   } else {
00119     y = x_data[0];
00120     for (k = 2; k <= x_size[0]; k++) {
00121       y += x_data[k - 1];
00122     }
00123   }
00124 
00125   y /= (real_T)x_size[0];
00126   return y;
00127 }
00128 
00129 /* End of code generation (mean.cpp) */


depth_tracker_ros_vr8
Author(s): shusain
autogenerated on Fri Dec 6 2013 20:45:47