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) {
132 for(
unsigned int i=0; i<M.getRows(); i++) {
133 for(
unsigned int j=0; j<M.getCols(); j++) {
138 M.print (std::cout, 4);
141 N.
init(M, 0, 1, 2, 3);
143 N.
print (std::cout, 4);
147 std::cout <<
"------------------------" << std::endl;
148 std::cout <<
"--- TEST PRETTY PRINT---" << std::endl;
149 std::cout <<
"------------------------" << std::endl;
153 std::cout <<
"call std::cout << M;" << std::endl;
154 std::cout << M << std::endl;
156 std::cout <<
"call M.print (std::cout, 4);" << std::endl;
157 M.
print (std::cout, 4);
159 std::cout <<
"------------------------" << std::endl;
165 std::cout <<
"call std::cout << M;" << std::endl;
167 std::cout <<
"call M.print (std::cout, 6);" << std::endl;
168 M.
print (std::cout, 6);
169 std::cout << std::endl;
171 std::cout <<
"------------------------" << std::endl;
175 std::cout <<
"call std::cout << M;" << std::endl;
176 std::cout << M << std::endl;
178 std::cout <<
"call M.print (std::cout, 10);" << std::endl;
179 M.print (std::cout, 10);
180 std::cout << std::endl;
182 std::cout <<
"call M.print (std::cout, 2);" << std::endl;
183 M.print (std::cout, 2);
184 std::cout << std::endl;
186 std::cout <<
"------------------------" << std::endl;
189 M[0][2]=-0.0000000876;
190 std::cout <<
"call std::cout << M;" << std::endl;
191 std::cout << M << std::endl;
193 std::cout <<
"call M.print (std::cout, 4);" << std::endl;
194 M.print (std::cout, 4);
195 std::cout << std::endl;
196 std::cout <<
"call M.print (std::cout, 10, \"M\");" << std::endl;
197 M.print (std::cout, 10,
"M");
198 std::cout << std::endl;
199 std::cout <<
"call M.print (std::cout, 20, \"M\");" << std::endl;
200 M.print (std::cout, 20,
"M");
201 std::cout << std::endl;
204 std::cout <<
"------------------------" << std::endl;
205 std::cout <<
"--- TEST RESIZE --------" << std::endl;
206 std::cout <<
"------------------------" << std::endl;
207 std::cout <<
"5x5" << std::endl;
209 std::cout << M << std::endl;
210 std::cout <<
"3x2" << std::endl;
212 std::cout << M << std::endl;
213 std::cout <<
"2x2" << std::endl;
215 std::cout << M << std::endl;
216 std::cout <<
"------------------------" << std::endl;
225 std::cout <<
"------------------------" << std::endl;
226 std::cout <<
"--- TEST vpRowVector * vpColVector" << std::endl;
227 std::cout <<
"------------------------" << std::endl;
240 r.print(std::cout, 2,
"r");
241 c.print(std::cout, 2,
"c");
242 std::cout <<
"r * c = " << rc << std::endl;
244 std::cout <<
"------------------------" << std::endl;
245 std::cout <<
"--- TEST vpRowVector * vpMatrix" << std::endl;
246 std::cout <<
"------------------------" << std::endl;
255 r.
print(std::cout, 2,
"r");
256 M.print(std::cout, 10,
"M");
257 std::cout <<
"r * M = " << rM << std::endl;
259 std::cout <<
"------------------------" << std::endl;
260 std::cout <<
"--- TEST vpGEMM " << std::endl;
261 std::cout <<
"------------------------" << std::endl;
276 vpGEMM(M, N, 2, C, 3, D, VP_GEMM_A_T);
277 std::cout << D << std::endl;
282 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)
void init()
Initialization of the object matrix.
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...
void resize(const unsigned int i, const bool flagNullify=true)
Class that provides a data structure for the column vectors as well as a set of operations on these v...