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"
63 void usage(
const char *name,
const char *badparam);
64 bool getOptions(
int argc,
const char **argv);
71 void usage(
const char *name,
const char *badparam)
74 Test some vpMatrix functionalities.\n\
85 fprintf(stdout,
"\nERROR: Bad parameter [%s]\n", badparam);
94 bool getOptions(
int argc,
const char **argv)
101 case 'h': usage(argv[0], NULL);
return false;
break;
104 usage(argv[0], optarg_);
109 if ((c == 1) || (c == -1)) {
111 usage(argv[0], NULL);
112 std::cerr <<
"ERROR: " << std::endl;
113 std::cerr <<
" Bad argument " << optarg_ << std::endl << std::endl;
122 main(
int argc,
const char ** argv)
126 if (getOptions(argc, argv) ==
false) {
130 vpTRACE(
"------------------------");
131 vpTRACE(
"--- TEST PRETTY PRINT---");
132 vpTRACE(
"------------------------");
136 vpTRACE(
"call std::cout << M;");
137 std::cout << M << std::endl;
139 vpTRACE(
"call M.print (std::cout, 4);");
140 M.
print (std::cout, 4);
142 vpTRACE(
"------------------------");
148 vpTRACE(
"call std::cout << M;");
150 vpTRACE(
"call M.print (std::cout, 6);");
151 M.print (std::cout, 6);
153 vpTRACE(
"------------------------");
157 vpTRACE(
"call std::cout << M;");
160 vpTRACE(
"call M.print (std::cout, 10);");
161 M.print (std::cout, 10);
163 vpTRACE(
"call M.print (std::cout, 2);");
164 M.print (std::cout, 2);
166 vpTRACE(
"------------------------");
169 M[0][2]=-0.0000000876;
170 vpTRACE(
"call std::cout << M;");
173 vpTRACE(
"call M.print (std::cout, 4);");
174 M.print (std::cout, 4);
175 vpTRACE(
"call M.print (std::cout, 10, \"M\");");
176 M.print (std::cout, 10,
"M");
177 vpTRACE(
"call M.print (std::cout, 20, \"M\");");
178 M.print (std::cout, 20,
"M");
181 vpTRACE(
"------------------------");
182 vpTRACE(
"--- TEST RESIZE --------");
183 vpTRACE(
"------------------------");
193 vpTRACE(
"------------------------");
203 vpTRACE(
"------------------------");
204 vpTRACE(
"--- TEST vpRowVector * vpColVector");
205 vpTRACE(
"------------------------");
218 r.print(std::cout, 2,
"r");
219 c.print(std::cout, 2,
"c");
220 std::cout <<
"r * c = " << rc << std::endl;
222 vpTRACE(
"------------------------");
223 vpTRACE(
"--- TEST vpRowVector * vpMatrix");
224 vpTRACE(
"------------------------");
233 r.
print(std::cout, 2,
"r");
234 M.print(std::cout, 10,
"M");
235 std::cout <<
"r * M = " << rM << std::endl;
237 vpTRACE(
"------------------------");
239 vpTRACE(
"------------------------");
254 vpGEMM(M, N, 2, C, 3, D, VP_GEMM_A_T);
255 std::cout << D << std::endl;
259 std::cout <<
"Catch an exception: " << e << std::endl;
Definition of the vpMatrix class.
void resize(const unsigned int nrows, const unsigned int ncols, const bool nullify=true)
Definition of the row vector class.
error that can be emited by ViSP classes.
int print(std::ostream &s, unsigned int length, char const *intro=0)
static bool parse(int *argcPtr, const char **argv, vpArgvInfo *argTable, int flags)
void vpGEMM(const vpMatrix &A, const vpMatrix &B, const double &alpha, const vpMatrix &C, const double &beta, vpMatrix &D, const unsigned int &ops=0)
This function performs generalized matrix multiplication: D = alpha*op(A)*op(B) + beta*op(C)...
Class that consider the particular case of twist transformation matrix that allows to transform a vel...
Class that provides a data structure for the column vectors as well as a set of operations on these v...