Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #include "rt_nonfinite.h"
00012 #include "Optimal_affine_tracking_3d16_fast_realtime.h"
00013 #include "repmat.h"
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 static int32_T div_s32(int32_T numerator, int32_T denominator);
00025
00026
00027 static int32_T div_s32(int32_T numerator, int32_T denominator)
00028 {
00029 int32_T quotient;
00030 uint32_T absNumerator;
00031 uint32_T absDenominator;
00032 int32_T quotientNeedsNegation;
00033 if (denominator == 0) {
00034 quotient = numerator >= 0 ? MAX_int32_T : MIN_int32_T;
00035 } else {
00036 absNumerator = (uint32_T)(numerator >= 0 ? numerator : -numerator);
00037 absDenominator = (uint32_T)(denominator >= 0 ? denominator : -denominator);
00038 quotientNeedsNegation = (int32_T)((int32_T)(numerator < 0) != (int32_T)
00039 (denominator < 0));
00040 absNumerator /= absDenominator;
00041 quotient = (uint32_T)quotientNeedsNegation ? -(int32_T)absNumerator :
00042 (int32_T)absNumerator;
00043 }
00044
00045 return quotient;
00046 }
00047
00048 void b_repmat(const real_T a[168021], real_T b[336042])
00049 {
00050 int32_T ib;
00051 int32_T jtilecol;
00052 int32_T iacol;
00053 int32_T jcol;
00054 int32_T k;
00055 ib = 0;
00056 for (jtilecol = 0; jtilecol < 2; jtilecol++) {
00057 iacol = 1;
00058 for (jcol = 0; jcol < 441; jcol++) {
00059 for (k = 0; k < 381; k++) {
00060 b[ib] = a[iacol - 1];
00061 iacol++;
00062 ib++;
00063 }
00064 }
00065 }
00066 }
00067
00068 void repmat(const real_T a[504063], real_T b[1008126])
00069 {
00070 int32_T db[3];
00071 int32_T da[3];
00072 int32_T ibtmp;
00073 int32_T k;
00074 static const int16_T iv2[3] = { 381, 441, 3 };
00075
00076 static const int16_T iv3[3] = { 381, 882, 3 };
00077
00078 int32_T ib;
00079 int32_T ia;
00080 int32_T vk;
00081 int32_T u1;
00082 for (ibtmp = 0; ibtmp < 3; ibtmp++) {
00083 db[ibtmp] = 1;
00084 da[ibtmp] = 1;
00085 }
00086
00087 for (k = 0; k < 2; k++) {
00088 da[k + 1] = da[k] * iv2[k];
00089 db[k + 1] = db[k] * iv3[k];
00090 }
00091
00092 for (ib = 0; ib < 1008126; ib++) {
00093 ia = 0;
00094 ibtmp = ib + 1;
00095 for (k = 2; k > -1; k += -1) {
00096 vk = ibtmp - (ibtmp - 1) / db[k] * db[k];
00097 ibtmp = (ibtmp - vk) / db[k];
00098 u1 = iv2[k];
00099 ibtmp -= u1 * div_s32(ibtmp, u1);
00100 ia += da[k] * ibtmp;
00101 ibtmp = vk;
00102 }
00103
00104 b[ib] = a[ia];
00105 }
00106 }
00107
00108