Go to the documentation of this file.
41 int main( int argc, char **argv)
47 unsigned int nResults=7;
48 string resultLabel[nResults];
49 resultLabel[ MeanDstE] = "Mean_Distance_Error";
50 resultLabel[ MaxDstE] = "Max_Distance_Error";
51 resultLabel[ MinDstE] = "Min_Distance_Error";
52 resultLabel[ MeanOrtoE] = "Mean_Ortonormality_Error";
53 resultLabel[ MaxOrtoE] = "Max_Ortonormality_Error";
54 resultLabel[ MinOrtoE] = "Min_Ortonormality_Error";
55 resultLabel[ AverageT] = "Average_Execution_Time";
58 unsigned int nMethods=5;
64 string methodLabel[nMethods] = { "ExactMethod",
73 unsigned int noiseTicks=100;
74 unsigned int nRep=1000000;
76 unsigned int rs=time(0);
84 bool fixedMatrix= false;
92 IOFormat fmt(StreamPrecision, DontAlignCols, " ", " ", "", "", "", "");
97 while ((c=getopt(argc,argv, "t:mr:s:l:u:pqg"))!=-1)
102 noiseTicks=( unsigned int)atoi(optarg);
108 cerr << "Not enough inputs to define a matrix" << endl;
111 M(0,0)=( real)atof(argv[optind]);
112 M(0,1)=( real)atof(argv[optind+1]);
113 M(0,2)=( real)atof(argv[optind+2]);
114 M(1,0)=( real)atof(argv[optind+3]);
115 M(1,1)=( real)atof(argv[optind+4]);
116 M(1,2)=( real)atof(argv[optind+5]);
117 M(2,0)=( real)atof(argv[optind+6]);
118 M(2,1)=( real)atof(argv[optind+7]);
119 M(2,2)=( real)atof(argv[optind+8]);
121 E=(M.transpose()*M)-Matrix3::Identity();
122 if ((E.norm()>1e-18)||(M.determinant()!=1.0))
124 cerr << "The input matrix is not a rotation matrix" << endl;
129 nRep=( unsigned int)atoi(optarg);
132 rs=( unsigned int)atoi(optarg);
135 lowNoise=( real)atof(optarg);
138 highNoise=( real)atof(optarg);
150 cerr << "Usage: "<< argv[0] << " [-l low_error_bound] [-h high_error_bound] [-t noise_ticks] [-m m00 m01 m02 m10 m11 m12 m20 m21 m22] [-r num_repetitions] [-s random_seed] [-g] [-p] [-q]"<< endl;
158 cout << "Executing " << argv[0] << " with arguments:" << endl;
160 cout << " Precison : double" << endl;
162 cout << " Precision : single" << endl;
165 cout << " Input matrix [-m]: " << M.format(fmt) << endl;
167 cout << " Num. random matrices [-r]: " << nRep << endl;
168 cout << " Low noise [-l]: " << lowNoise << endl;
169 cout << " High noise [-h]: " << highNoise << endl;
170 cout << " Noise ticks [-t]: " << noiseTicks << endl;
171 cout << " Random seed [-s]: " << rs << endl;
172 cout << " Gaussian noise [-g]: " << gaussian << endl;
173 cout << " Print results [-p]: " << print << endl;
180 default_random_engine e(rs);
183 noise noiseLevel = Array<real,Dynamic,1>::LinSpaced(noiseTicks,lowNoise,highNoise);
190 results= new double**[nMethods];
191 for( unsigned int k=0;k<nMethods;k++)
193 results[k]= new double*[noiseTicks];
194 for ( unsigned int i=0;i<noiseTicks;i++)
195 results[k][i]= new double[nResults];
204 for ( unsigned int i=0;i<noiseTicks;i++)
207 cout << "Noise level: " << noiseLevel(i) << " (" << i+1 << "/" << noiseTicks << ")"<< endl;
214 cout << " Introducing noise the given matrix" << endl;
216 cout << " Generating " << nRep << " random noisy rotation matrices" << endl;
219 for( unsigned int j=0;j<nRep;j++)
228 if (noiseLevel(i)==0.0)
238 for( unsigned int k=0;k<nMethods;k++)
241 cout << " Testing method: " << methodLabel[k] << endl;
247 if ((!quiet)&&(print))
248 PrintResults(nMethods,methodLabel,nResults,resultLabel,noiseTicks,noiseLevel,results);
249 SaveResults(nMethods,methodLabel,nResults,resultLabel,gaussian,noiseTicks,noiseLevel,results);
251 return(EXIT_SUCCESS);
|
Follow us!