48 #include <visp/vpConfig.h>
49 #include <visp/vpDebug.h>
50 #include <visp/vpMath.h>
51 #include <visp/vpHomogeneousMatrix.h>
52 #include <visp/vpVelocityTwistMatrix.h>
53 #include <visp/vpParseArgv.h>
54 #include <visp/vpGEMM.h>
61 #define GETOPTARGS "h"
68 void usage(
const char *name,
const char *badparam)
71 Test some vpMatrix functionalities.\n\
82 fprintf(stdout,
"\nERROR: Bad parameter [%s]\n", badparam);
91 bool getOptions(
int argc,
const char **argv)
98 case 'h': usage(argv[0], NULL);
return false;
break;
101 usage(argv[0], optarg);
106 if ((c == 1) || (c == -1)) {
108 usage(argv[0], NULL);
109 std::cerr <<
"ERROR: " << std::endl;
110 std::cerr <<
" Bad argument " << optarg << std::endl << std::endl;
119 main(
int argc,
const char ** argv)
122 if (getOptions(argc, argv) ==
false) {
126 vpTRACE(
"------------------------");
127 vpTRACE(
"--- TEST PRETTY PRINT---");
128 vpTRACE(
"------------------------");
132 vpTRACE(
"call std::cout << M;");
133 std::cout << M << std::endl;
135 vpTRACE(
"call M.print (std::cout, 4);");
136 M.
print (std::cout, 4);
138 vpTRACE(
"------------------------");
144 vpTRACE(
"call std::cout << M;");
146 vpTRACE(
"call M.print (std::cout, 6);");
147 M.print (std::cout, 6);
149 vpTRACE(
"------------------------");
153 vpTRACE(
"call std::cout << M;");
156 vpTRACE(
"call M.print (std::cout, 10);");
157 M.print (std::cout, 10);
159 vpTRACE(
"call M.print (std::cout, 2);");
160 M.print (std::cout, 2);
162 vpTRACE(
"------------------------");
165 M[0][2]=-0.0000000876;
166 vpTRACE(
"call std::cout << M;");
169 vpTRACE(
"call M.print (std::cout, 4);");
170 M.print (std::cout, 4);
171 vpTRACE(
"call M.print (std::cout, 10, \"M\");");
172 M.print (std::cout, 10,
"M");
173 vpTRACE(
"call M.print (std::cout, 20, \"M\");");
174 M.print (std::cout, 20,
"M");
177 vpTRACE(
"------------------------");
178 vpTRACE(
"--- TEST RESIZE --------");
179 vpTRACE(
"------------------------");
189 vpTRACE(
"------------------------");
199 vpTRACE(
"------------------------");
200 vpTRACE(
"--- TEST vpRowVector * vpColVector");
201 vpTRACE(
"------------------------");
214 r.print(std::cout, 2,
"r");
215 c.print(std::cout, 2,
"c");
216 std::cout <<
"r * c = " << rc << std::endl;
218 vpTRACE(
"------------------------");
219 vpTRACE(
"--- TEST vpRowVector * vpMatrix");
220 vpTRACE(
"------------------------");
229 r.
print(std::cout, 2,
"r");
230 M.print(std::cout, 10,
"M");
231 std::cout <<
"r * M = " << rM << std::endl;
233 vpTRACE(
"------------------------");
235 vpTRACE(
"------------------------");
250 vpGEMM(M, N, 2, C, 3, D, VP_GEMM_A_T);
251 std::cout << D << std::endl;