1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499
|
diff --git a/python/src/mrpt/math/CMatrixDynamic.cpp b/python/src/mrpt/math/CMatrixDynamic.cpp
index 43b379213..1b600737a 100644
--- a/python/src/mrpt/math/CMatrixDynamic.cpp
+++ b/python/src/mrpt/math/CMatrixDynamic.cpp
@@ -42,12 +42,24 @@ void bind_mrpt_math_CMatrixDynamic(std::function< pybind11::module &(std::string
cl.def("derived", (class mrpt::math::CMatrixDynamic<float> & (mrpt::math::CMatrixDynamic<float>::*)()) &mrpt::math::CMatrixDynamic<float>::derived, "C++: mrpt::math::CMatrixDynamic<float>::derived() --> class mrpt::math::CMatrixDynamic<float> &", pybind11::return_value_policy::automatic);
cl.def("conservativeResize", (void (mrpt::math::CMatrixDynamic<float>::*)(size_t, size_t)) &mrpt::math::CMatrixDynamic<float>::conservativeResize, "C++: mrpt::math::CMatrixDynamic<float>::conservativeResize(size_t, size_t) --> void", pybind11::arg("row"), pybind11::arg("col"));
cl.def("data", (float * (mrpt::math::CMatrixDynamic<float>::*)()) &mrpt::math::CMatrixDynamic<float>::data, "C++: mrpt::math::CMatrixDynamic<float>::data() --> float *", pybind11::return_value_policy::automatic);
- cl.def("__call__", (float & (mrpt::math::CMatrixDynamic<float>::*)(size_t, size_t)) &mrpt::math::CMatrixDynamic<float>::operator(), "C++: mrpt::math::CMatrixDynamic<float>::operator()(size_t, size_t) --> float &", pybind11::return_value_policy::automatic, pybind11::arg("row"), pybind11::arg("col"));
- cl.def("__getitem__", (float & (mrpt::math::CMatrixDynamic<float>::*)(size_t)) &mrpt::math::CMatrixDynamic<float>::operator[], "C++: mrpt::math::CMatrixDynamic<float>::operator[](size_t) --> float &", pybind11::return_value_policy::automatic, pybind11::arg("ith"));
+ cl.def("__call__", (float & (mrpt::math::CMatrixDynamic<float>::*)(size_t, size_t)) &mrpt::math::CMatrixDynamic<float>::operator(), "C++: mrpt::math::CMatrixDynamic<float>::operator()(size_t, size_t) --> float &", pybind11::return_value_policy::reference, pybind11::arg("row"), pybind11::arg("col"));
cl.def("cast_float", (class mrpt::math::CMatrixDynamic<float> (mrpt::math::CMatrixDynamic<float>::*)() const) &mrpt::math::CMatrixDynamic<float>::cast_float, "C++: mrpt::math::CMatrixDynamic<float>::cast_float() const --> class mrpt::math::CMatrixDynamic<float>");
cl.def("cast_double", (class mrpt::math::CMatrixDynamic<double> (mrpt::math::CMatrixDynamic<float>::*)() const) &mrpt::math::CMatrixDynamic<float>::cast_double, "C++: mrpt::math::CMatrixDynamic<float>::cast_double() const --> class mrpt::math::CMatrixDynamic<double>");
cl.def("llt_solve", (class mrpt::math::CVectorDynamic<float> (mrpt::math::CMatrixDynamic<float>::*)(const class mrpt::math::CVectorDynamic<float> &) const) &mrpt::math::CMatrixDynamic<float>::llt_solve, "C++: mrpt::math::CMatrixDynamic<float>::llt_solve(const class mrpt::math::CVectorDynamic<float> &) const --> class mrpt::math::CVectorDynamic<float>", pybind11::arg("b"));
cl.def("lu_solve", (class mrpt::math::CVectorDynamic<float> (mrpt::math::CMatrixDynamic<float>::*)(const class mrpt::math::CVectorDynamic<float> &) const) &mrpt::math::CMatrixDynamic<float>::lu_solve, "C++: mrpt::math::CMatrixDynamic<float>::lu_solve(const class mrpt::math::CVectorDynamic<float> &) const --> class mrpt::math::CVectorDynamic<float>", pybind11::arg("b"));
+
+ // Manually-added matrix methods:
+ using dat_t = float;
+ using mat_t = mrpt::math::CMatrixDynamic<dat_t>;
+ cl.def("__getitem__", [](const mat_t&self, pybind11::tuple coord) -> dat_t { if (coord.size()==2) return self.coeff(coord[0].cast<size_t>(), coord[1].cast<size_t>()); else if (coord.size()==1) return self[coord[0].cast<size_t>()]; else throw std::invalid_argument("Access with [idx] or [row,col]"); });
+ cl.def("__setitem__", [](mat_t&self, pybind11::tuple coord, dat_t val) { if (coord.size()==2) self.coeffRef(coord[0].cast<size_t>(), coord[1].cast<size_t>())=val; else if (coord.size()==1) self[coord[0].cast<size_t>()]=val; else throw std::invalid_argument("Access with [idx] or [row,col]"); });
+ cl.def("__str__", [](const mat_t& o) -> std::string { return o.asString(); } );
+ cl.def("inMatlabFormat", [](const mat_t& o) -> std::string { return o.inMatlabFormat(); } );
+ cl.def("size", [](const mat_t&self) -> pybind11::tuple { return pybind11::make_tuple(self.cols(),self.rows()); });
+ cl.def_static("Identity", [](const size_t N) -> mat_t { return mat_t::Identity(N); }, "Returns the NxN identity matrix");
+ cl.def_static("Zero", [](const size_t nRows, const size_t nCols) -> mat_t { return mat_t::Zero(nRows,nCols); }, "Returns a matrix with zeroes");
+ cl.def(pybind11::init( [](pybind11::list vals){ auto m = new mat_t(); const auto nR = vals.size(); if (!nR) return m; const auto nC = vals[0].cast<pybind11::list>().size(); m->setSize(nR,nC); for (size_t r=0;r<nR;r++) { const auto row = vals[r].cast<pybind11::list>(); for (size_t c=0;c<nC;c++) m->coeffRef(r,c) = row[c].cast<dat_t>(); } return m; }));
+ cl.def("to_list", [](const mat_t&self) -> pybind11::list { auto l = pybind11::list(); const auto nR = self.rows(), nC = self.cols(); for (int r=0;r<nR;r++) { auto row = pybind11::list(); l.append(row); for (int c=0;c<nC;c++) row.append(self.coeff(r,c)); } return l; });
}
{ // mrpt::math::CMatrixDynamic file:mrpt/math/CMatrixDynamic.h line:41
pybind11::class_<mrpt::math::CMatrixDynamic<unsigned char>, std::shared_ptr<mrpt::math::CMatrixDynamic<unsigned char>>> cl(M("mrpt::math"), "CMatrixDynamic_unsigned_char_t", "");
@@ -70,8 +82,8 @@ void bind_mrpt_math_CMatrixDynamic(std::function< pybind11::module &(std::string
cl.def("derived", (class mrpt::math::CMatrixDynamic<unsigned char> & (mrpt::math::CMatrixDynamic<unsigned char>::*)()) &mrpt::math::CMatrixDynamic<unsigned char>::derived, "C++: mrpt::math::CMatrixDynamic<unsigned char>::derived() --> class mrpt::math::CMatrixDynamic<unsigned char> &", pybind11::return_value_policy::automatic);
cl.def("conservativeResize", (void (mrpt::math::CMatrixDynamic<unsigned char>::*)(size_t, size_t)) &mrpt::math::CMatrixDynamic<unsigned char>::conservativeResize, "C++: mrpt::math::CMatrixDynamic<unsigned char>::conservativeResize(size_t, size_t) --> void", pybind11::arg("row"), pybind11::arg("col"));
cl.def("data", (unsigned char * (mrpt::math::CMatrixDynamic<unsigned char>::*)()) &mrpt::math::CMatrixDynamic<unsigned char>::data, "C++: mrpt::math::CMatrixDynamic<unsigned char>::data() --> unsigned char *", pybind11::return_value_policy::automatic);
- cl.def("__call__", (unsigned char & (mrpt::math::CMatrixDynamic<unsigned char>::*)(size_t, size_t)) &mrpt::math::CMatrixDynamic<unsigned char>::operator(), "C++: mrpt::math::CMatrixDynamic<unsigned char>::operator()(size_t, size_t) --> unsigned char &", pybind11::return_value_policy::automatic, pybind11::arg("row"), pybind11::arg("col"));
- cl.def("__getitem__", (unsigned char & (mrpt::math::CMatrixDynamic<unsigned char>::*)(size_t)) &mrpt::math::CMatrixDynamic<unsigned char>::operator[], "C++: mrpt::math::CMatrixDynamic<unsigned char>::operator[](size_t) --> unsigned char &", pybind11::return_value_policy::automatic, pybind11::arg("ith"));
+ cl.def("__call__", (unsigned char & (mrpt::math::CMatrixDynamic<unsigned char>::*)(size_t, size_t)) &mrpt::math::CMatrixDynamic<unsigned char>::operator(), "C++: mrpt::math::CMatrixDynamic<unsigned char>::operator()(size_t, size_t) --> unsigned char &", pybind11::return_value_policy::reference, pybind11::arg("row"), pybind11::arg("col"));
+ cl.def("__getitem__", (unsigned char & (mrpt::math::CMatrixDynamic<unsigned char>::*)(size_t)) &mrpt::math::CMatrixDynamic<unsigned char>::operator[], "C++: mrpt::math::CMatrixDynamic<unsigned char>::operator[](size_t) --> unsigned char &", pybind11::return_value_policy::reference, pybind11::arg("ith"));
}
{ // mrpt::math::CMatrixDynamic file:mrpt/math/CMatrixDynamic.h line:41
pybind11::class_<mrpt::math::CMatrixDynamic<unsigned short>, std::shared_ptr<mrpt::math::CMatrixDynamic<unsigned short>>> cl(M("mrpt::math"), "CMatrixDynamic_unsigned_short_t", "");
@@ -94,7 +106,7 @@ void bind_mrpt_math_CMatrixDynamic(std::function< pybind11::module &(std::string
cl.def("derived", (class mrpt::math::CMatrixDynamic<unsigned short> & (mrpt::math::CMatrixDynamic<unsigned short>::*)()) &mrpt::math::CMatrixDynamic<unsigned short>::derived, "C++: mrpt::math::CMatrixDynamic<unsigned short>::derived() --> class mrpt::math::CMatrixDynamic<unsigned short> &", pybind11::return_value_policy::automatic);
cl.def("conservativeResize", (void (mrpt::math::CMatrixDynamic<unsigned short>::*)(size_t, size_t)) &mrpt::math::CMatrixDynamic<unsigned short>::conservativeResize, "C++: mrpt::math::CMatrixDynamic<unsigned short>::conservativeResize(size_t, size_t) --> void", pybind11::arg("row"), pybind11::arg("col"));
cl.def("data", (unsigned short * (mrpt::math::CMatrixDynamic<unsigned short>::*)()) &mrpt::math::CMatrixDynamic<unsigned short>::data, "C++: mrpt::math::CMatrixDynamic<unsigned short>::data() --> unsigned short *", pybind11::return_value_policy::automatic);
- cl.def("__call__", (unsigned short & (mrpt::math::CMatrixDynamic<unsigned short>::*)(size_t, size_t)) &mrpt::math::CMatrixDynamic<unsigned short>::operator(), "C++: mrpt::math::CMatrixDynamic<unsigned short>::operator()(size_t, size_t) --> unsigned short &", pybind11::return_value_policy::automatic, pybind11::arg("row"), pybind11::arg("col"));
- cl.def("__getitem__", (unsigned short & (mrpt::math::CMatrixDynamic<unsigned short>::*)(size_t)) &mrpt::math::CMatrixDynamic<unsigned short>::operator[], "C++: mrpt::math::CMatrixDynamic<unsigned short>::operator[](size_t) --> unsigned short &", pybind11::return_value_policy::automatic, pybind11::arg("ith"));
+ cl.def("__call__", (unsigned short & (mrpt::math::CMatrixDynamic<unsigned short>::*)(size_t, size_t)) &mrpt::math::CMatrixDynamic<unsigned short>::operator(), "C++: mrpt::math::CMatrixDynamic<unsigned short>::operator()(size_t, size_t) --> unsigned short &", pybind11::return_value_policy::reference, pybind11::arg("row"), pybind11::arg("col"));
+ cl.def("__getitem__", (unsigned short & (mrpt::math::CMatrixDynamic<unsigned short>::*)(size_t)) &mrpt::math::CMatrixDynamic<unsigned short>::operator[], "C++: mrpt::math::CMatrixDynamic<unsigned short>::operator[](size_t) --> unsigned short &", pybind11::return_value_policy::reference, pybind11::arg("ith"));
}
}
diff --git a/python/src/mrpt/math/CMatrixDynamic_1.cpp b/python/src/mrpt/math/CMatrixDynamic_1.cpp
index 5e303af0c..be42731ed 100644
--- a/python/src/mrpt/math/CMatrixDynamic_1.cpp
+++ b/python/src/mrpt/math/CMatrixDynamic_1.cpp
@@ -48,8 +48,8 @@ void bind_mrpt_math_CMatrixDynamic_1(std::function< pybind11::module &(std::stri
cl.def("derived", (class mrpt::math::CMatrixDynamic<struct mrpt::math::TPoint3D_<float> > & (mrpt::math::CMatrixDynamic<mrpt::math::TPoint3D_<float>>::*)()) &mrpt::math::CMatrixDynamic<mrpt::math::TPoint3D_<float>>::derived, "C++: mrpt::math::CMatrixDynamic<mrpt::math::TPoint3D_<float>>::derived() --> class mrpt::math::CMatrixDynamic<struct mrpt::math::TPoint3D_<float> > &", pybind11::return_value_policy::automatic);
cl.def("conservativeResize", (void (mrpt::math::CMatrixDynamic<mrpt::math::TPoint3D_<float>>::*)(size_t, size_t)) &mrpt::math::CMatrixDynamic<mrpt::math::TPoint3D_<float>>::conservativeResize, "C++: mrpt::math::CMatrixDynamic<mrpt::math::TPoint3D_<float>>::conservativeResize(size_t, size_t) --> void", pybind11::arg("row"), pybind11::arg("col"));
cl.def("data", (struct mrpt::math::TPoint3D_<float> * (mrpt::math::CMatrixDynamic<mrpt::math::TPoint3D_<float>>::*)()) &mrpt::math::CMatrixDynamic<mrpt::math::TPoint3D_<float>>::data, "C++: mrpt::math::CMatrixDynamic<mrpt::math::TPoint3D_<float>>::data() --> struct mrpt::math::TPoint3D_<float> *", pybind11::return_value_policy::automatic);
- cl.def("__call__", (struct mrpt::math::TPoint3D_<float> & (mrpt::math::CMatrixDynamic<mrpt::math::TPoint3D_<float>>::*)(size_t, size_t)) &mrpt::math::CMatrixDynamic<mrpt::math::TPoint3D_<float>>::operator(), "C++: mrpt::math::CMatrixDynamic<mrpt::math::TPoint3D_<float>>::operator()(size_t, size_t) --> struct mrpt::math::TPoint3D_<float> &", pybind11::return_value_policy::automatic, pybind11::arg("row"), pybind11::arg("col"));
- cl.def("__getitem__", (struct mrpt::math::TPoint3D_<float> & (mrpt::math::CMatrixDynamic<mrpt::math::TPoint3D_<float>>::*)(size_t)) &mrpt::math::CMatrixDynamic<mrpt::math::TPoint3D_<float>>::operator[], "C++: mrpt::math::CMatrixDynamic<mrpt::math::TPoint3D_<float>>::operator[](size_t) --> struct mrpt::math::TPoint3D_<float> &", pybind11::return_value_policy::automatic, pybind11::arg("ith"));
+ cl.def("__call__", (struct mrpt::math::TPoint3D_<float> & (mrpt::math::CMatrixDynamic<mrpt::math::TPoint3D_<float>>::*)(size_t, size_t)) &mrpt::math::CMatrixDynamic<mrpt::math::TPoint3D_<float>>::operator(), "C++: mrpt::math::CMatrixDynamic<mrpt::math::TPoint3D_<float>>::operator()(size_t, size_t) --> struct mrpt::math::TPoint3D_<float> &", pybind11::return_value_policy::reference, pybind11::arg("row"), pybind11::arg("col"));
+ cl.def("__getitem__", (struct mrpt::math::TPoint3D_<float> & (mrpt::math::CMatrixDynamic<mrpt::math::TPoint3D_<float>>::*)(size_t)) &mrpt::math::CMatrixDynamic<mrpt::math::TPoint3D_<float>>::operator[], "C++: mrpt::math::CMatrixDynamic<mrpt::math::TPoint3D_<float>>::operator[](size_t) --> struct mrpt::math::TPoint3D_<float> &", pybind11::return_value_policy::reference, pybind11::arg("ith"));
cl.def("cast_float", (class mrpt::math::CMatrixDynamic<float> (mrpt::math::CMatrixDynamic<mrpt::math::TPoint3D_<float>>::*)() const) &mrpt::math::CMatrixDynamic<mrpt::math::TPoint3D_<float>>::cast_float, "C++: mrpt::math::CMatrixDynamic<mrpt::math::TPoint3D_<float>>::cast_float() const --> class mrpt::math::CMatrixDynamic<float>");
cl.def("cast_double", (class mrpt::math::CMatrixDynamic<double> (mrpt::math::CMatrixDynamic<mrpt::math::TPoint3D_<float>>::*)() const) &mrpt::math::CMatrixDynamic<mrpt::math::TPoint3D_<float>>::cast_double, "C++: mrpt::math::CMatrixDynamic<mrpt::math::TPoint3D_<float>>::cast_double() const --> class mrpt::math::CMatrixDynamic<double>");
}
@@ -73,9 +73,9 @@ void bind_mrpt_math_CMatrixDynamic_1(std::function< pybind11::module &(std::stri
cl.def("rows", (int (mrpt::math::CMatrixFixed<double,2UL,2UL>::*)() const) &mrpt::math::CMatrixFixed<double, 2, 2>::rows, "C++: mrpt::math::CMatrixFixed<double, 2, 2>::rows() const --> int");
cl.def("cols", (int (mrpt::math::CMatrixFixed<double,2UL,2UL>::*)() const) &mrpt::math::CMatrixFixed<double, 2, 2>::cols, "C++: mrpt::math::CMatrixFixed<double, 2, 2>::cols() const --> int");
cl.def("data", (double * (mrpt::math::CMatrixFixed<double,2UL,2UL>::*)()) &mrpt::math::CMatrixFixed<double, 2, 2>::data, "C++: mrpt::math::CMatrixFixed<double, 2, 2>::data() --> double *", pybind11::return_value_policy::automatic);
- cl.def("__call__", (double & (mrpt::math::CMatrixFixed<double,2UL,2UL>::*)(int, int)) &mrpt::math::CMatrixFixed<double, 2, 2>::operator(), "C++: mrpt::math::CMatrixFixed<double, 2, 2>::operator()(int, int) --> double &", pybind11::return_value_policy::automatic, pybind11::arg("row"), pybind11::arg("col"));
- cl.def("__call__", (double & (mrpt::math::CMatrixFixed<double,2UL,2UL>::*)(int)) &mrpt::math::CMatrixFixed<double, 2, 2>::operator(), "C++: mrpt::math::CMatrixFixed<double, 2, 2>::operator()(int) --> double &", pybind11::return_value_policy::automatic, pybind11::arg("i"));
- cl.def("__getitem__", (double & (mrpt::math::CMatrixFixed<double,2UL,2UL>::*)(int)) &mrpt::math::CMatrixFixed<double, 2, 2>::operator[], "C++: mrpt::math::CMatrixFixed<double, 2, 2>::operator[](int) --> double &", pybind11::return_value_policy::automatic, pybind11::arg("i"));
+ cl.def("__call__", (double & (mrpt::math::CMatrixFixed<double,2UL,2UL>::*)(int, int)) &mrpt::math::CMatrixFixed<double, 2, 2>::operator(), "C++: mrpt::math::CMatrixFixed<double, 2, 2>::operator()(int, int) --> double &", pybind11::return_value_policy::reference, pybind11::arg("row"), pybind11::arg("col"));
+ cl.def("__call__", (double & (mrpt::math::CMatrixFixed<double,2UL,2UL>::*)(int)) &mrpt::math::CMatrixFixed<double, 2, 2>::operator(), "C++: mrpt::math::CMatrixFixed<double, 2, 2>::operator()(int) --> double &", pybind11::return_value_policy::reference, pybind11::arg("i"));
+ cl.def("__getitem__", (double & (mrpt::math::CMatrixFixed<double,2UL,2UL>::*)(int)) &mrpt::math::CMatrixFixed<double, 2, 2>::operator[], "C++: mrpt::math::CMatrixFixed<double, 2, 2>::operator[](int) --> double &", pybind11::return_value_policy::reference, pybind11::arg("i"));
cl.def("sum_At", (void (mrpt::math::CMatrixFixed<double,2UL,2UL>::*)(const class mrpt::math::CMatrixFixed<double, 2, 2> &)) &mrpt::math::CMatrixFixed<double, 2, 2>::sum_At, "C++: mrpt::math::CMatrixFixed<double, 2, 2>::sum_At(const class mrpt::math::CMatrixFixed<double, 2, 2> &) --> void", pybind11::arg("A"));
cl.def("assign", (class mrpt::math::CMatrixFixed<double, 2, 2> & (mrpt::math::CMatrixFixed<double,2UL,2UL>::*)(const class mrpt::math::CMatrixFixed<double, 2, 2> &)) &mrpt::math::CMatrixFixed<double, 2, 2>::operator=, "C++: mrpt::math::CMatrixFixed<double, 2, 2>::operator=(const class mrpt::math::CMatrixFixed<double, 2, 2> &) --> class mrpt::math::CMatrixFixed<double, 2, 2> &", pybind11::return_value_policy::automatic, pybind11::arg(""));
}
@@ -99,11 +99,23 @@ void bind_mrpt_math_CMatrixDynamic_1(std::function< pybind11::module &(std::stri
cl.def("rows", (int (mrpt::math::CMatrixFixed<double,3UL,3UL>::*)() const) &mrpt::math::CMatrixFixed<double, 3, 3>::rows, "C++: mrpt::math::CMatrixFixed<double, 3, 3>::rows() const --> int");
cl.def("cols", (int (mrpt::math::CMatrixFixed<double,3UL,3UL>::*)() const) &mrpt::math::CMatrixFixed<double, 3, 3>::cols, "C++: mrpt::math::CMatrixFixed<double, 3, 3>::cols() const --> int");
cl.def("data", (double * (mrpt::math::CMatrixFixed<double,3UL,3UL>::*)()) &mrpt::math::CMatrixFixed<double, 3, 3>::data, "C++: mrpt::math::CMatrixFixed<double, 3, 3>::data() --> double *", pybind11::return_value_policy::automatic);
- cl.def("__call__", (double & (mrpt::math::CMatrixFixed<double,3UL,3UL>::*)(int, int)) &mrpt::math::CMatrixFixed<double, 3, 3>::operator(), "C++: mrpt::math::CMatrixFixed<double, 3, 3>::operator()(int, int) --> double &", pybind11::return_value_policy::automatic, pybind11::arg("row"), pybind11::arg("col"));
- cl.def("__call__", (double & (mrpt::math::CMatrixFixed<double,3UL,3UL>::*)(int)) &mrpt::math::CMatrixFixed<double, 3, 3>::operator(), "C++: mrpt::math::CMatrixFixed<double, 3, 3>::operator()(int) --> double &", pybind11::return_value_policy::automatic, pybind11::arg("i"));
- cl.def("__getitem__", (double & (mrpt::math::CMatrixFixed<double,3UL,3UL>::*)(int)) &mrpt::math::CMatrixFixed<double, 3, 3>::operator[], "C++: mrpt::math::CMatrixFixed<double, 3, 3>::operator[](int) --> double &", pybind11::return_value_policy::automatic, pybind11::arg("i"));
+ cl.def("__call__", (double & (mrpt::math::CMatrixFixed<double,3UL,3UL>::*)(int, int)) &mrpt::math::CMatrixFixed<double, 3, 3>::operator(), "C++: mrpt::math::CMatrixFixed<double, 3, 3>::operator()(int, int) --> double &", pybind11::return_value_policy::reference, pybind11::arg("row"), pybind11::arg("col"));
+ cl.def("__call__", (double & (mrpt::math::CMatrixFixed<double,3UL,3UL>::*)(int)) &mrpt::math::CMatrixFixed<double, 3, 3>::operator(), "C++: mrpt::math::CMatrixFixed<double, 3, 3>::operator()(int) --> double &", pybind11::return_value_policy::reference, pybind11::arg("i"));
cl.def("cast_float", (class mrpt::math::CMatrixFixed<float, 3, 3> (mrpt::math::CMatrixFixed<double,3UL,3UL>::*)() const) &mrpt::math::CMatrixFixed<double, 3, 3>::cast_float, "C++: mrpt::math::CMatrixFixed<double, 3, 3>::cast_float() const --> class mrpt::math::CMatrixFixed<float, 3, 3>");
cl.def("sum_At", (void (mrpt::math::CMatrixFixed<double,3UL,3UL>::*)(const class mrpt::math::CMatrixFixed<double, 3, 3> &)) &mrpt::math::CMatrixFixed<double, 3, 3>::sum_At, "C++: mrpt::math::CMatrixFixed<double, 3, 3>::sum_At(const class mrpt::math::CMatrixFixed<double, 3, 3> &) --> void", pybind11::arg("A"));
cl.def("assign", (class mrpt::math::CMatrixFixed<double, 3, 3> & (mrpt::math::CMatrixFixed<double,3UL,3UL>::*)(const class mrpt::math::CMatrixFixed<double, 3, 3> &)) &mrpt::math::CMatrixFixed<double, 3, 3>::operator=, "C++: mrpt::math::CMatrixFixed<double, 3, 3>::operator=(const class mrpt::math::CMatrixFixed<double, 3, 3> &) --> class mrpt::math::CMatrixFixed<double, 3, 3> &", pybind11::return_value_policy::automatic, pybind11::arg(""));
+
+ // Manually-added matrix methods:
+ using dat_t = double;
+ using mat_t = mrpt::math::CMatrixFixed<dat_t,3,3>;
+ cl.def("__getitem__", [](const mat_t&self, pybind11::tuple coord) -> dat_t { if (coord.size()==2) return self.coeff(coord[0].cast<size_t>(), coord[1].cast<size_t>()); else if (coord.size()==1) return self[coord[0].cast<size_t>()]; else throw std::invalid_argument("Access with [idx] or [row,col]"); });
+ cl.def("__setitem__", [](mat_t&self, pybind11::tuple coord, dat_t val) { if (coord.size()==2) self.coeffRef(coord[0].cast<size_t>(), coord[1].cast<size_t>())=val; else if (coord.size()==1) self[coord[0].cast<size_t>()]=val; else throw std::invalid_argument("Access with [idx] or [row,col]"); });
+ cl.def("__str__", [](const mat_t& o) -> std::string { return o.asString(); } );
+ cl.def("inMatlabFormat", [](const mat_t& o) -> std::string { return o.inMatlabFormat(); } );
+ cl.def("size", [](const mat_t&self) -> pybind11::tuple { return pybind11::make_tuple(self.cols(),self.rows()); });
+ cl.def_static("Identity", []() -> mat_t { return mat_t::Identity(); }, "Returns the NxN identity matrix");
+ cl.def_static("Zero", []() -> mat_t { return mat_t::Zero(); }, "Returns a matrix with zeroes");
+ cl.def(pybind11::init( [](pybind11::list vals){ auto m = new mat_t(); const auto nR = vals.size(); if (!nR) return m; const auto nC = vals[0].cast<pybind11::list>().size(); m->setSize(nR,nC); for (size_t r=0;r<nR;r++) { const auto row = vals[r].cast<pybind11::list>(); for (size_t c=0;c<nC;c++) m->coeffRef(r,c) = row[c].cast<dat_t>(); } return m; }));
+ cl.def("to_list", [](const mat_t&self) -> pybind11::list { auto l = pybind11::list(); const auto nR = self.rows(), nC = self.cols(); for (int r=0;r<nR;r++) { auto row = pybind11::list(); l.append(row); for (int c=0;c<nC;c++) row.append(self.coeff(r,c)); } return l; });
}
}
diff --git a/python/src/mrpt/math/CMatrixDynamic_2.cpp b/python/src/mrpt/math/CMatrixDynamic_2.cpp
index ff79a4a0a..4865de614 100644
--- a/python/src/mrpt/math/CMatrixDynamic_2.cpp
+++ b/python/src/mrpt/math/CMatrixDynamic_2.cpp
@@ -127,12 +127,24 @@ void bind_mrpt_math_CMatrixDynamic_2(std::function< pybind11::module &(std::stri
cl.def("derived", (class mrpt::math::CMatrixDynamic<double> & (mrpt::math::CMatrixDynamic<double>::*)()) &mrpt::math::CMatrixDynamic<double>::derived, "C++: mrpt::math::CMatrixDynamic<double>::derived() --> class mrpt::math::CMatrixDynamic<double> &", pybind11::return_value_policy::automatic);
cl.def("conservativeResize", (void (mrpt::math::CMatrixDynamic<double>::*)(size_t, size_t)) &mrpt::math::CMatrixDynamic<double>::conservativeResize, "C++: mrpt::math::CMatrixDynamic<double>::conservativeResize(size_t, size_t) --> void", pybind11::arg("row"), pybind11::arg("col"));
cl.def("data", (double * (mrpt::math::CMatrixDynamic<double>::*)()) &mrpt::math::CMatrixDynamic<double>::data, "C++: mrpt::math::CMatrixDynamic<double>::data() --> double *", pybind11::return_value_policy::automatic);
- cl.def("__call__", (double & (mrpt::math::CMatrixDynamic<double>::*)(size_t, size_t)) &mrpt::math::CMatrixDynamic<double>::operator(), "C++: mrpt::math::CMatrixDynamic<double>::operator()(size_t, size_t) --> double &", pybind11::return_value_policy::automatic, pybind11::arg("row"), pybind11::arg("col"));
- cl.def("__getitem__", (double & (mrpt::math::CMatrixDynamic<double>::*)(size_t)) &mrpt::math::CMatrixDynamic<double>::operator[], "C++: mrpt::math::CMatrixDynamic<double>::operator[](size_t) --> double &", pybind11::return_value_policy::automatic, pybind11::arg("ith"));
+ cl.def("__call__", (double & (mrpt::math::CMatrixDynamic<double>::*)(size_t, size_t)) &mrpt::math::CMatrixDynamic<double>::operator(), "C++: mrpt::math::CMatrixDynamic<double>::operator()(size_t, size_t) --> double &", pybind11::return_value_policy::reference, pybind11::arg("row"), pybind11::arg("col"));
cl.def("cast_float", (class mrpt::math::CMatrixDynamic<float> (mrpt::math::CMatrixDynamic<double>::*)() const) &mrpt::math::CMatrixDynamic<double>::cast_float, "C++: mrpt::math::CMatrixDynamic<double>::cast_float() const --> class mrpt::math::CMatrixDynamic<float>");
cl.def("cast_double", (class mrpt::math::CMatrixDynamic<double> (mrpt::math::CMatrixDynamic<double>::*)() const) &mrpt::math::CMatrixDynamic<double>::cast_double, "C++: mrpt::math::CMatrixDynamic<double>::cast_double() const --> class mrpt::math::CMatrixDynamic<double>");
cl.def("llt_solve", (class mrpt::math::CVectorDynamic<double> (mrpt::math::CMatrixDynamic<double>::*)(const class mrpt::math::CVectorDynamic<double> &) const) &mrpt::math::CMatrixDynamic<double>::llt_solve, "C++: mrpt::math::CMatrixDynamic<double>::llt_solve(const class mrpt::math::CVectorDynamic<double> &) const --> class mrpt::math::CVectorDynamic<double>", pybind11::arg("b"));
cl.def("lu_solve", (class mrpt::math::CVectorDynamic<double> (mrpt::math::CMatrixDynamic<double>::*)(const class mrpt::math::CVectorDynamic<double> &) const) &mrpt::math::CMatrixDynamic<double>::lu_solve, "C++: mrpt::math::CMatrixDynamic<double>::lu_solve(const class mrpt::math::CVectorDynamic<double> &) const --> class mrpt::math::CVectorDynamic<double>", pybind11::arg("b"));
+
+ // Manually-added matrix methods:
+ using dat_t = double;
+ using mat_t = mrpt::math::CMatrixDynamic<dat_t>;
+ cl.def("__getitem__", [](const mat_t&self, pybind11::tuple coord) -> dat_t { if (coord.size()==2) return self.coeff(coord[0].cast<size_t>(), coord[1].cast<size_t>()); else if (coord.size()==1) return self[coord[0].cast<size_t>()]; else throw std::invalid_argument("Access with [idx] or [row,col]"); });
+ cl.def("__setitem__", [](mat_t&self, pybind11::tuple coord, dat_t val) { if (coord.size()==2) self.coeffRef(coord[0].cast<size_t>(), coord[1].cast<size_t>())=val; else if (coord.size()==1) self[coord[0].cast<size_t>()]=val; else throw std::invalid_argument("Access with [idx] or [row,col]"); });
+ cl.def("__str__", [](const mat_t& o) -> std::string { return o.asString(); } );
+ cl.def("inMatlabFormat", [](const mat_t& o) -> std::string { return o.inMatlabFormat(); } );
+ cl.def("size", [](const mat_t&self) -> pybind11::tuple { return pybind11::make_tuple(self.cols(),self.rows()); });
+ cl.def_static("Identity", [](const size_t N) -> mat_t { return mat_t::Identity(N); }, "Returns the NxN identity matrix");
+ cl.def_static("Zero", [](const size_t nRows, const size_t nCols) -> mat_t { return mat_t::Zero(nRows,nCols); }, "Returns a matrix with zeroes");
+ cl.def(pybind11::init( [](pybind11::list vals){ auto m = new mat_t(); const auto nR = vals.size(); if (!nR) return m; const auto nC = vals[0].cast<pybind11::list>().size(); m->setSize(nR,nC); for (size_t r=0;r<nR;r++) { const auto row = vals[r].cast<pybind11::list>(); for (size_t c=0;c<nC;c++) m->coeffRef(r,c) = row[c].cast<dat_t>(); } return m; }));
+ cl.def("to_list", [](const mat_t&self) -> pybind11::list { auto l = pybind11::list(); const auto nR = self.rows(), nC = self.cols(); for (int r=0;r<nR;r++) { auto row = pybind11::list(); l.append(row); for (int c=0;c<nC;c++) row.append(self.coeff(r,c)); } return l; });
}
{ // mrpt::math::CMatrixD file:mrpt/math/CMatrixD.h line:23
pybind11::class_<mrpt::math::CMatrixD, std::shared_ptr<mrpt::math::CMatrixD>, PyCallBack_mrpt_math_CMatrixD, mrpt::serialization::CSerializable, mrpt::math::CMatrixDynamic<double>> cl(M("mrpt::math"), "CMatrixD", "This class is a \"CSerializable\" wrapper for\n \"CMatrixDynamic<double>\".\n \n\n For a complete introduction to Matrices and vectors in MRPT, see:\n https://www.mrpt.org/Matrices_vectors_arrays_and_Linear_Algebra_MRPT_and_Eigen_classes\n \n\n\n ");
diff --git a/python/src/mrpt/math/CMatrixFixed.cpp b/python/src/mrpt/math/CMatrixFixed.cpp
index a9ec794ef..2168c4bf9 100644
--- a/python/src/mrpt/math/CMatrixFixed.cpp
+++ b/python/src/mrpt/math/CMatrixFixed.cpp
@@ -38,12 +38,24 @@ void bind_mrpt_math_CMatrixFixed(std::function< pybind11::module &(std::string c
cl.def("rows", (int (mrpt::math::CMatrixFixed<double,4UL,4UL>::*)() const) &mrpt::math::CMatrixFixed<double, 4, 4>::rows, "C++: mrpt::math::CMatrixFixed<double, 4, 4>::rows() const --> int");
cl.def("cols", (int (mrpt::math::CMatrixFixed<double,4UL,4UL>::*)() const) &mrpt::math::CMatrixFixed<double, 4, 4>::cols, "C++: mrpt::math::CMatrixFixed<double, 4, 4>::cols() const --> int");
cl.def("data", (double * (mrpt::math::CMatrixFixed<double,4UL,4UL>::*)()) &mrpt::math::CMatrixFixed<double, 4, 4>::data, "C++: mrpt::math::CMatrixFixed<double, 4, 4>::data() --> double *", pybind11::return_value_policy::automatic);
- cl.def("__call__", (double & (mrpt::math::CMatrixFixed<double,4UL,4UL>::*)(int, int)) &mrpt::math::CMatrixFixed<double, 4, 4>::operator(), "C++: mrpt::math::CMatrixFixed<double, 4, 4>::operator()(int, int) --> double &", pybind11::return_value_policy::automatic, pybind11::arg("row"), pybind11::arg("col"));
- cl.def("__call__", (double & (mrpt::math::CMatrixFixed<double,4UL,4UL>::*)(int)) &mrpt::math::CMatrixFixed<double, 4, 4>::operator(), "C++: mrpt::math::CMatrixFixed<double, 4, 4>::operator()(int) --> double &", pybind11::return_value_policy::automatic, pybind11::arg("i"));
- cl.def("__getitem__", (double & (mrpt::math::CMatrixFixed<double,4UL,4UL>::*)(int)) &mrpt::math::CMatrixFixed<double, 4, 4>::operator[], "C++: mrpt::math::CMatrixFixed<double, 4, 4>::operator[](int) --> double &", pybind11::return_value_policy::automatic, pybind11::arg("i"));
+ cl.def("__call__", (double & (mrpt::math::CMatrixFixed<double,4UL,4UL>::*)(int, int)) &mrpt::math::CMatrixFixed<double, 4, 4>::operator(), "C++: mrpt::math::CMatrixFixed<double, 4, 4>::operator()(int, int) --> double &", pybind11::return_value_policy::reference, pybind11::arg("row"), pybind11::arg("col"));
+ cl.def("__call__", (double & (mrpt::math::CMatrixFixed<double,4UL,4UL>::*)(int)) &mrpt::math::CMatrixFixed<double, 4, 4>::operator(), "C++: mrpt::math::CMatrixFixed<double, 4, 4>::operator()(int) --> double &", pybind11::return_value_policy::reference, pybind11::arg("i"));
cl.def("cast_float", (class mrpt::math::CMatrixFixed<float, 4, 4> (mrpt::math::CMatrixFixed<double,4UL,4UL>::*)() const) &mrpt::math::CMatrixFixed<double, 4, 4>::cast_float, "C++: mrpt::math::CMatrixFixed<double, 4, 4>::cast_float() const --> class mrpt::math::CMatrixFixed<float, 4, 4>");
cl.def("sum_At", (void (mrpt::math::CMatrixFixed<double,4UL,4UL>::*)(const class mrpt::math::CMatrixFixed<double, 4, 4> &)) &mrpt::math::CMatrixFixed<double, 4, 4>::sum_At, "C++: mrpt::math::CMatrixFixed<double, 4, 4>::sum_At(const class mrpt::math::CMatrixFixed<double, 4, 4> &) --> void", pybind11::arg("A"));
cl.def("assign", (class mrpt::math::CMatrixFixed<double, 4, 4> & (mrpt::math::CMatrixFixed<double,4UL,4UL>::*)(const class mrpt::math::CMatrixFixed<double, 4, 4> &)) &mrpt::math::CMatrixFixed<double, 4, 4>::operator=, "C++: mrpt::math::CMatrixFixed<double, 4, 4>::operator=(const class mrpt::math::CMatrixFixed<double, 4, 4> &) --> class mrpt::math::CMatrixFixed<double, 4, 4> &", pybind11::return_value_policy::automatic, pybind11::arg(""));
+
+ // Manually-added matrix methods:
+ using dat_t = double;
+ using mat_t = mrpt::math::CMatrixFixed<dat_t,4,4>;
+ cl.def("__getitem__", [](const mat_t&self, pybind11::tuple coord) -> dat_t { if (coord.size()==2) return self.coeff(coord[0].cast<size_t>(), coord[1].cast<size_t>()); else if (coord.size()==1) return self[coord[0].cast<size_t>()]; else throw std::invalid_argument("Access with [idx] or [row,col]"); });
+ cl.def("__setitem__", [](mat_t&self, pybind11::tuple coord, dat_t val) { if (coord.size()==2) self.coeffRef(coord[0].cast<size_t>(), coord[1].cast<size_t>())=val; else if (coord.size()==1) self[coord[0].cast<size_t>()]=val; else throw std::invalid_argument("Access with [idx] or [row,col]"); });
+ cl.def("__str__", [](const mat_t& o) -> std::string { return o.asString(); } );
+ cl.def("inMatlabFormat", [](const mat_t& o) -> std::string { return o.inMatlabFormat(); } );
+ cl.def("size", [](const mat_t&self) -> pybind11::tuple { return pybind11::make_tuple(self.cols(),self.rows()); });
+ cl.def_static("Identity", []() -> mat_t { return mat_t::Identity(); }, "Returns the NxN identity matrix");
+ cl.def_static("Zero", []() -> mat_t { return mat_t::Zero(); }, "Returns a matrix with zeroes");
+ cl.def(pybind11::init( [](pybind11::list vals){ auto m = new mat_t(); const auto nR = vals.size(); if (!nR) return m; const auto nC = vals[0].cast<pybind11::list>().size(); m->setSize(nR,nC); for (size_t r=0;r<nR;r++) { const auto row = vals[r].cast<pybind11::list>(); for (size_t c=0;c<nC;c++) m->coeffRef(r,c) = row[c].cast<dat_t>(); } return m; }));
+ cl.def("to_list", [](const mat_t&self) -> pybind11::list { auto l = pybind11::list(); const auto nR = self.rows(), nC = self.cols(); for (int r=0;r<nR;r++) { auto row = pybind11::list(); l.append(row); for (int c=0;c<nC;c++) row.append(self.coeff(r,c)); } return l; });
}
{ // mrpt::math::CMatrixFixed file:mrpt/math/CMatrixFixed.h line:34
pybind11::class_<mrpt::math::CMatrixFixed<double,6UL,6UL>, std::shared_ptr<mrpt::math::CMatrixFixed<double,6UL,6UL>>> cl(M("mrpt::math"), "CMatrixFixed_double_6UL_6UL_t", "");
@@ -65,11 +77,23 @@ void bind_mrpt_math_CMatrixFixed(std::function< pybind11::module &(std::string c
cl.def("rows", (int (mrpt::math::CMatrixFixed<double,6UL,6UL>::*)() const) &mrpt::math::CMatrixFixed<double, 6, 6>::rows, "C++: mrpt::math::CMatrixFixed<double, 6, 6>::rows() const --> int");
cl.def("cols", (int (mrpt::math::CMatrixFixed<double,6UL,6UL>::*)() const) &mrpt::math::CMatrixFixed<double, 6, 6>::cols, "C++: mrpt::math::CMatrixFixed<double, 6, 6>::cols() const --> int");
cl.def("data", (double * (mrpt::math::CMatrixFixed<double,6UL,6UL>::*)()) &mrpt::math::CMatrixFixed<double, 6, 6>::data, "C++: mrpt::math::CMatrixFixed<double, 6, 6>::data() --> double *", pybind11::return_value_policy::automatic);
- cl.def("__call__", (double & (mrpt::math::CMatrixFixed<double,6UL,6UL>::*)(int, int)) &mrpt::math::CMatrixFixed<double, 6, 6>::operator(), "C++: mrpt::math::CMatrixFixed<double, 6, 6>::operator()(int, int) --> double &", pybind11::return_value_policy::automatic, pybind11::arg("row"), pybind11::arg("col"));
- cl.def("__call__", (double & (mrpt::math::CMatrixFixed<double,6UL,6UL>::*)(int)) &mrpt::math::CMatrixFixed<double, 6, 6>::operator(), "C++: mrpt::math::CMatrixFixed<double, 6, 6>::operator()(int) --> double &", pybind11::return_value_policy::automatic, pybind11::arg("i"));
- cl.def("__getitem__", (double & (mrpt::math::CMatrixFixed<double,6UL,6UL>::*)(int)) &mrpt::math::CMatrixFixed<double, 6, 6>::operator[], "C++: mrpt::math::CMatrixFixed<double, 6, 6>::operator[](int) --> double &", pybind11::return_value_policy::automatic, pybind11::arg("i"));
+ cl.def("__call__", (double & (mrpt::math::CMatrixFixed<double,6UL,6UL>::*)(int, int)) &mrpt::math::CMatrixFixed<double, 6, 6>::operator(), "C++: mrpt::math::CMatrixFixed<double, 6, 6>::operator()(int, int) --> double &", pybind11::return_value_policy::reference, pybind11::arg("row"), pybind11::arg("col"));
+ cl.def("__call__", (double & (mrpt::math::CMatrixFixed<double,6UL,6UL>::*)(int)) &mrpt::math::CMatrixFixed<double, 6, 6>::operator(), "C++: mrpt::math::CMatrixFixed<double, 6, 6>::operator()(int) --> double &", pybind11::return_value_policy::reference, pybind11::arg("i"));
cl.def("sum_At", (void (mrpt::math::CMatrixFixed<double,6UL,6UL>::*)(const class mrpt::math::CMatrixFixed<double, 6, 6> &)) &mrpt::math::CMatrixFixed<double, 6, 6>::sum_At, "C++: mrpt::math::CMatrixFixed<double, 6, 6>::sum_At(const class mrpt::math::CMatrixFixed<double, 6, 6> &) --> void", pybind11::arg("A"));
cl.def("assign", (class mrpt::math::CMatrixFixed<double, 6, 6> & (mrpt::math::CMatrixFixed<double,6UL,6UL>::*)(const class mrpt::math::CMatrixFixed<double, 6, 6> &)) &mrpt::math::CMatrixFixed<double, 6, 6>::operator=, "C++: mrpt::math::CMatrixFixed<double, 6, 6>::operator=(const class mrpt::math::CMatrixFixed<double, 6, 6> &) --> class mrpt::math::CMatrixFixed<double, 6, 6> &", pybind11::return_value_policy::automatic, pybind11::arg(""));
+
+ // Manually-added matrix methods:
+ using dat_t = double;
+ using mat_t = mrpt::math::CMatrixFixed<dat_t,6,6>;
+ cl.def("__getitem__", [](const mat_t&self, pybind11::tuple coord) -> dat_t { if (coord.size()==2) return self.coeff(coord[0].cast<size_t>(), coord[1].cast<size_t>()); else if (coord.size()==1) return self[coord[0].cast<size_t>()]; else throw std::invalid_argument("Access with [idx] or [row,col]"); });
+ cl.def("__setitem__", [](mat_t&self, pybind11::tuple coord, dat_t val) { if (coord.size()==2) self.coeffRef(coord[0].cast<size_t>(), coord[1].cast<size_t>())=val; else if (coord.size()==1) self[coord[0].cast<size_t>()]=val; else throw std::invalid_argument("Access with [idx] or [row,col]"); });
+ cl.def("__str__", [](const mat_t& o) -> std::string { return o.asString(); } );
+ cl.def("inMatlabFormat", [](const mat_t& o) -> std::string { return o.inMatlabFormat(); } );
+ cl.def("size", [](const mat_t&self) -> pybind11::tuple { return pybind11::make_tuple(self.cols(),self.rows()); });
+ cl.def_static("Identity", []() -> mat_t { return mat_t::Identity(); }, "Returns the NxN identity matrix");
+ cl.def_static("Zero", []() -> mat_t { return mat_t::Zero(); }, "Returns a matrix with zeroes");
+ cl.def(pybind11::init( [](pybind11::list vals){ auto m = new mat_t(); const auto nR = vals.size(); if (!nR) return m; const auto nC = vals[0].cast<pybind11::list>().size(); m->setSize(nR,nC); for (size_t r=0;r<nR;r++) { const auto row = vals[r].cast<pybind11::list>(); for (size_t c=0;c<nC;c++) m->coeffRef(r,c) = row[c].cast<dat_t>(); } return m; }));
+ cl.def("to_list", [](const mat_t&self) -> pybind11::list { auto l = pybind11::list(); const auto nR = self.rows(), nC = self.cols(); for (int r=0;r<nR;r++) { auto row = pybind11::list(); l.append(row); for (int c=0;c<nC;c++) row.append(self.coeff(r,c)); } return l; });
}
{ // mrpt::math::CMatrixFixed file:mrpt/math/CMatrixFixed.h line:34
pybind11::class_<mrpt::math::CMatrixFixed<double,7UL,7UL>, std::shared_ptr<mrpt::math::CMatrixFixed<double,7UL,7UL>>> cl(M("mrpt::math"), "CMatrixFixed_double_7UL_7UL_t", "");
@@ -91,9 +115,9 @@ void bind_mrpt_math_CMatrixFixed(std::function< pybind11::module &(std::string c
cl.def("rows", (int (mrpt::math::CMatrixFixed<double,7UL,7UL>::*)() const) &mrpt::math::CMatrixFixed<double, 7, 7>::rows, "C++: mrpt::math::CMatrixFixed<double, 7, 7>::rows() const --> int");
cl.def("cols", (int (mrpt::math::CMatrixFixed<double,7UL,7UL>::*)() const) &mrpt::math::CMatrixFixed<double, 7, 7>::cols, "C++: mrpt::math::CMatrixFixed<double, 7, 7>::cols() const --> int");
cl.def("data", (double * (mrpt::math::CMatrixFixed<double,7UL,7UL>::*)()) &mrpt::math::CMatrixFixed<double, 7, 7>::data, "C++: mrpt::math::CMatrixFixed<double, 7, 7>::data() --> double *", pybind11::return_value_policy::automatic);
- cl.def("__call__", (double & (mrpt::math::CMatrixFixed<double,7UL,7UL>::*)(int, int)) &mrpt::math::CMatrixFixed<double, 7, 7>::operator(), "C++: mrpt::math::CMatrixFixed<double, 7, 7>::operator()(int, int) --> double &", pybind11::return_value_policy::automatic, pybind11::arg("row"), pybind11::arg("col"));
- cl.def("__call__", (double & (mrpt::math::CMatrixFixed<double,7UL,7UL>::*)(int)) &mrpt::math::CMatrixFixed<double, 7, 7>::operator(), "C++: mrpt::math::CMatrixFixed<double, 7, 7>::operator()(int) --> double &", pybind11::return_value_policy::automatic, pybind11::arg("i"));
- cl.def("__getitem__", (double & (mrpt::math::CMatrixFixed<double,7UL,7UL>::*)(int)) &mrpt::math::CMatrixFixed<double, 7, 7>::operator[], "C++: mrpt::math::CMatrixFixed<double, 7, 7>::operator[](int) --> double &", pybind11::return_value_policy::automatic, pybind11::arg("i"));
+ cl.def("__call__", (double & (mrpt::math::CMatrixFixed<double,7UL,7UL>::*)(int, int)) &mrpt::math::CMatrixFixed<double, 7, 7>::operator(), "C++: mrpt::math::CMatrixFixed<double, 7, 7>::operator()(int, int) --> double &", pybind11::return_value_policy::reference, pybind11::arg("row"), pybind11::arg("col"));
+ cl.def("__call__", (double & (mrpt::math::CMatrixFixed<double,7UL,7UL>::*)(int)) &mrpt::math::CMatrixFixed<double, 7, 7>::operator(), "C++: mrpt::math::CMatrixFixed<double, 7, 7>::operator()(int) --> double &", pybind11::return_value_policy::reference, pybind11::arg("i"));
+ cl.def("__getitem__", (double & (mrpt::math::CMatrixFixed<double,7UL,7UL>::*)(int)) &mrpt::math::CMatrixFixed<double, 7, 7>::operator[], "C++: mrpt::math::CMatrixFixed<double, 7, 7>::operator[](int) --> double &", pybind11::return_value_policy::reference, pybind11::arg("i"));
cl.def("sum_At", (void (mrpt::math::CMatrixFixed<double,7UL,7UL>::*)(const class mrpt::math::CMatrixFixed<double, 7, 7> &)) &mrpt::math::CMatrixFixed<double, 7, 7>::sum_At, "C++: mrpt::math::CMatrixFixed<double, 7, 7>::sum_At(const class mrpt::math::CMatrixFixed<double, 7, 7> &) --> void", pybind11::arg("A"));
cl.def("assign", (class mrpt::math::CMatrixFixed<double, 7, 7> & (mrpt::math::CMatrixFixed<double,7UL,7UL>::*)(const class mrpt::math::CMatrixFixed<double, 7, 7> &)) &mrpt::math::CMatrixFixed<double, 7, 7>::operator=, "C++: mrpt::math::CMatrixFixed<double, 7, 7>::operator=(const class mrpt::math::CMatrixFixed<double, 7, 7> &) --> class mrpt::math::CMatrixFixed<double, 7, 7> &", pybind11::return_value_policy::automatic, pybind11::arg(""));
}
@@ -117,11 +141,22 @@ void bind_mrpt_math_CMatrixFixed(std::function< pybind11::module &(std::string c
cl.def("rows", (int (mrpt::math::CMatrixFixed<double,3UL,1UL>::*)() const) &mrpt::math::CMatrixFixed<double, 3, 1>::rows, "C++: mrpt::math::CMatrixFixed<double, 3, 1>::rows() const --> int");
cl.def("cols", (int (mrpt::math::CMatrixFixed<double,3UL,1UL>::*)() const) &mrpt::math::CMatrixFixed<double, 3, 1>::cols, "C++: mrpt::math::CMatrixFixed<double, 3, 1>::cols() const --> int");
cl.def("data", (double * (mrpt::math::CMatrixFixed<double,3UL,1UL>::*)()) &mrpt::math::CMatrixFixed<double, 3, 1>::data, "C++: mrpt::math::CMatrixFixed<double, 3, 1>::data() --> double *", pybind11::return_value_policy::automatic);
- cl.def("__call__", (double & (mrpt::math::CMatrixFixed<double,3UL,1UL>::*)(int, int)) &mrpt::math::CMatrixFixed<double, 3, 1>::operator(), "C++: mrpt::math::CMatrixFixed<double, 3, 1>::operator()(int, int) --> double &", pybind11::return_value_policy::automatic, pybind11::arg("row"), pybind11::arg("col"));
- cl.def("__call__", (double & (mrpt::math::CMatrixFixed<double,3UL,1UL>::*)(int)) &mrpt::math::CMatrixFixed<double, 3, 1>::operator(), "C++: mrpt::math::CMatrixFixed<double, 3, 1>::operator()(int) --> double &", pybind11::return_value_policy::automatic, pybind11::arg("i"));
- cl.def("__getitem__", (double & (mrpt::math::CMatrixFixed<double,3UL,1UL>::*)(int)) &mrpt::math::CMatrixFixed<double, 3, 1>::operator[], "C++: mrpt::math::CMatrixFixed<double, 3, 1>::operator[](int) --> double &", pybind11::return_value_policy::automatic, pybind11::arg("i"));
+ cl.def("__call__", (double & (mrpt::math::CMatrixFixed<double,3UL,1UL>::*)(int, int)) &mrpt::math::CMatrixFixed<double, 3, 1>::operator(), "C++: mrpt::math::CMatrixFixed<double, 3, 1>::operator()(int, int) --> double &", pybind11::return_value_policy::reference, pybind11::arg("row"), pybind11::arg("col"));
+ cl.def("__call__", (double & (mrpt::math::CMatrixFixed<double,3UL,1UL>::*)(int)) &mrpt::math::CMatrixFixed<double, 3, 1>::operator(), "C++: mrpt::math::CMatrixFixed<double, 3, 1>::operator()(int) --> double &", pybind11::return_value_policy::reference, pybind11::arg("i"));
cl.def("cast_float", (class mrpt::math::CMatrixFixed<float, 3, 1> (mrpt::math::CMatrixFixed<double,3UL,1UL>::*)() const) &mrpt::math::CMatrixFixed<double, 3, 1>::cast_float, "C++: mrpt::math::CMatrixFixed<double, 3, 1>::cast_float() const --> class mrpt::math::CMatrixFixed<float, 3, 1>");
cl.def("sum_At", (void (mrpt::math::CMatrixFixed<double,3UL,1UL>::*)(const class mrpt::math::CMatrixFixed<double, 3, 1> &)) &mrpt::math::CMatrixFixed<double, 3, 1>::sum_At, "C++: mrpt::math::CMatrixFixed<double, 3, 1>::sum_At(const class mrpt::math::CMatrixFixed<double, 3, 1> &) --> void", pybind11::arg("A"));
cl.def("assign", (class mrpt::math::CMatrixFixed<double, 3, 1> & (mrpt::math::CMatrixFixed<double,3UL,1UL>::*)(const class mrpt::math::CMatrixFixed<double, 3, 1> &)) &mrpt::math::CMatrixFixed<double, 3, 1>::operator=, "C++: mrpt::math::CMatrixFixed<double, 3, 1>::operator=(const class mrpt::math::CMatrixFixed<double, 3, 1> &) --> class mrpt::math::CMatrixFixed<double, 3, 1> &", pybind11::return_value_policy::automatic, pybind11::arg(""));
+
+ // Manually-added matrix methods:
+ using dat_t = double;
+ using mat_t = mrpt::math::CMatrixFixed<dat_t,3,1>;
+ cl.def("__getitem__", [](const mat_t&self, pybind11::tuple coord) -> dat_t { if (coord.size()==2) return self.coeff(coord[0].cast<size_t>(), coord[1].cast<size_t>()); else if (coord.size()==1) return self[coord[0].cast<size_t>()]; else throw std::invalid_argument("Access with [idx] or [row,col]"); });
+ cl.def("__setitem__", [](mat_t&self, pybind11::tuple coord, dat_t val) { if (coord.size()==2) self.coeffRef(coord[0].cast<size_t>(), coord[1].cast<size_t>())=val; else if (coord.size()==1) self[coord[0].cast<size_t>()]=val; else throw std::invalid_argument("Access with [idx] or [row,col]"); });
+ cl.def("__str__", [](const mat_t& o) -> std::string { return o.asString(); } );
+ cl.def("inMatlabFormat", [](const mat_t& o) -> std::string { return o.inMatlabFormat(); } );
+ cl.def("size", [](const mat_t&self) -> pybind11::tuple { return pybind11::make_tuple(self.cols(),self.rows()); });
+ cl.def_static("Zero", []() -> mat_t { return mat_t::Zero(); }, "Returns a matrix with zeroes");
+ cl.def(pybind11::init( [](pybind11::list vals){ auto m = new mat_t(); const auto nR = vals.size(); if (!nR) return m; const auto nC = vals[0].cast<pybind11::list>().size(); m->setSize(nR,nC); for (size_t r=0;r<nR;r++) { const auto row = vals[r].cast<pybind11::list>(); for (size_t c=0;c<nC;c++) m->coeffRef(r,c) = row[c].cast<dat_t>(); } return m; }));
+ cl.def("to_list", [](const mat_t&self) -> pybind11::list { auto l = pybind11::list(); const auto nR = self.rows(), nC = self.cols(); for (int r=0;r<nR;r++) { auto row = pybind11::list(); l.append(row); for (int c=0;c<nC;c++) row.append(self.coeff(r,c)); } return l; });
}
}
diff --git a/python/src/mrpt/math/CMatrixFixed_1.cpp b/python/src/mrpt/math/CMatrixFixed_1.cpp
index 0c09358f1..e182c663a 100644
--- a/python/src/mrpt/math/CMatrixFixed_1.cpp
+++ b/python/src/mrpt/math/CMatrixFixed_1.cpp
@@ -38,9 +38,9 @@ void bind_mrpt_math_CMatrixFixed_1(std::function< pybind11::module &(std::string
cl.def("rows", (int (mrpt::math::CMatrixFixed<double,3UL,4UL>::*)() const) &mrpt::math::CMatrixFixed<double, 3, 4>::rows, "C++: mrpt::math::CMatrixFixed<double, 3, 4>::rows() const --> int");
cl.def("cols", (int (mrpt::math::CMatrixFixed<double,3UL,4UL>::*)() const) &mrpt::math::CMatrixFixed<double, 3, 4>::cols, "C++: mrpt::math::CMatrixFixed<double, 3, 4>::cols() const --> int");
cl.def("data", (double * (mrpt::math::CMatrixFixed<double,3UL,4UL>::*)()) &mrpt::math::CMatrixFixed<double, 3, 4>::data, "C++: mrpt::math::CMatrixFixed<double, 3, 4>::data() --> double *", pybind11::return_value_policy::automatic);
- cl.def("__call__", (double & (mrpt::math::CMatrixFixed<double,3UL,4UL>::*)(int, int)) &mrpt::math::CMatrixFixed<double, 3, 4>::operator(), "C++: mrpt::math::CMatrixFixed<double, 3, 4>::operator()(int, int) --> double &", pybind11::return_value_policy::automatic, pybind11::arg("row"), pybind11::arg("col"));
- cl.def("__call__", (double & (mrpt::math::CMatrixFixed<double,3UL,4UL>::*)(int)) &mrpt::math::CMatrixFixed<double, 3, 4>::operator(), "C++: mrpt::math::CMatrixFixed<double, 3, 4>::operator()(int) --> double &", pybind11::return_value_policy::automatic, pybind11::arg("i"));
- cl.def("__getitem__", (double & (mrpt::math::CMatrixFixed<double,3UL,4UL>::*)(int)) &mrpt::math::CMatrixFixed<double, 3, 4>::operator[], "C++: mrpt::math::CMatrixFixed<double, 3, 4>::operator[](int) --> double &", pybind11::return_value_policy::automatic, pybind11::arg("i"));
+ cl.def("__call__", (double & (mrpt::math::CMatrixFixed<double,3UL,4UL>::*)(int, int)) &mrpt::math::CMatrixFixed<double, 3, 4>::operator(), "C++: mrpt::math::CMatrixFixed<double, 3, 4>::operator()(int, int) --> double &", pybind11::return_value_policy::reference, pybind11::arg("row"), pybind11::arg("col"));
+ cl.def("__call__", (double & (mrpt::math::CMatrixFixed<double,3UL,4UL>::*)(int)) &mrpt::math::CMatrixFixed<double, 3, 4>::operator(), "C++: mrpt::math::CMatrixFixed<double, 3, 4>::operator()(int) --> double &", pybind11::return_value_policy::reference, pybind11::arg("i"));
+ cl.def("__getitem__", (double & (mrpt::math::CMatrixFixed<double,3UL,4UL>::*)(int)) &mrpt::math::CMatrixFixed<double, 3, 4>::operator[], "C++: mrpt::math::CMatrixFixed<double, 3, 4>::operator[](int) --> double &", pybind11::return_value_policy::reference, pybind11::arg("i"));
cl.def("sum_At", (void (mrpt::math::CMatrixFixed<double,3UL,4UL>::*)(const class mrpt::math::CMatrixFixed<double, 3, 4> &)) &mrpt::math::CMatrixFixed<double, 3, 4>::sum_At, "C++: mrpt::math::CMatrixFixed<double, 3, 4>::sum_At(const class mrpt::math::CMatrixFixed<double, 3, 4> &) --> void", pybind11::arg("A"));
}
{ // mrpt::math::CMatrixFixed file:mrpt/math/CMatrixFixed.h line:34
@@ -63,9 +63,9 @@ void bind_mrpt_math_CMatrixFixed_1(std::function< pybind11::module &(std::string
cl.def("rows", (int (mrpt::math::CMatrixFixed<double,3UL,6UL>::*)() const) &mrpt::math::CMatrixFixed<double, 3, 6>::rows, "C++: mrpt::math::CMatrixFixed<double, 3, 6>::rows() const --> int");
cl.def("cols", (int (mrpt::math::CMatrixFixed<double,3UL,6UL>::*)() const) &mrpt::math::CMatrixFixed<double, 3, 6>::cols, "C++: mrpt::math::CMatrixFixed<double, 3, 6>::cols() const --> int");
cl.def("data", (double * (mrpt::math::CMatrixFixed<double,3UL,6UL>::*)()) &mrpt::math::CMatrixFixed<double, 3, 6>::data, "C++: mrpt::math::CMatrixFixed<double, 3, 6>::data() --> double *", pybind11::return_value_policy::automatic);
- cl.def("__call__", (double & (mrpt::math::CMatrixFixed<double,3UL,6UL>::*)(int, int)) &mrpt::math::CMatrixFixed<double, 3, 6>::operator(), "C++: mrpt::math::CMatrixFixed<double, 3, 6>::operator()(int, int) --> double &", pybind11::return_value_policy::automatic, pybind11::arg("row"), pybind11::arg("col"));
- cl.def("__call__", (double & (mrpt::math::CMatrixFixed<double,3UL,6UL>::*)(int)) &mrpt::math::CMatrixFixed<double, 3, 6>::operator(), "C++: mrpt::math::CMatrixFixed<double, 3, 6>::operator()(int) --> double &", pybind11::return_value_policy::automatic, pybind11::arg("i"));
- cl.def("__getitem__", (double & (mrpt::math::CMatrixFixed<double,3UL,6UL>::*)(int)) &mrpt::math::CMatrixFixed<double, 3, 6>::operator[], "C++: mrpt::math::CMatrixFixed<double, 3, 6>::operator[](int) --> double &", pybind11::return_value_policy::automatic, pybind11::arg("i"));
+ cl.def("__call__", (double & (mrpt::math::CMatrixFixed<double,3UL,6UL>::*)(int, int)) &mrpt::math::CMatrixFixed<double, 3, 6>::operator(), "C++: mrpt::math::CMatrixFixed<double, 3, 6>::operator()(int, int) --> double &", pybind11::return_value_policy::reference, pybind11::arg("row"), pybind11::arg("col"));
+ cl.def("__call__", (double & (mrpt::math::CMatrixFixed<double,3UL,6UL>::*)(int)) &mrpt::math::CMatrixFixed<double, 3, 6>::operator(), "C++: mrpt::math::CMatrixFixed<double, 3, 6>::operator()(int) --> double &", pybind11::return_value_policy::reference, pybind11::arg("i"));
+ cl.def("__getitem__", (double & (mrpt::math::CMatrixFixed<double,3UL,6UL>::*)(int)) &mrpt::math::CMatrixFixed<double, 3, 6>::operator[], "C++: mrpt::math::CMatrixFixed<double, 3, 6>::operator[](int) --> double &", pybind11::return_value_policy::reference, pybind11::arg("i"));
cl.def("sum_At", (void (mrpt::math::CMatrixFixed<double,3UL,6UL>::*)(const class mrpt::math::CMatrixFixed<double, 3, 6> &)) &mrpt::math::CMatrixFixed<double, 3, 6>::sum_At, "C++: mrpt::math::CMatrixFixed<double, 3, 6>::sum_At(const class mrpt::math::CMatrixFixed<double, 3, 6> &) --> void", pybind11::arg("A"));
}
{ // mrpt::math::CMatrixFixed file:mrpt/math/CMatrixFixed.h line:34
@@ -88,9 +88,9 @@ void bind_mrpt_math_CMatrixFixed_1(std::function< pybind11::module &(std::string
cl.def("rows", (int (mrpt::math::CMatrixFixed<double,2UL,1UL>::*)() const) &mrpt::math::CMatrixFixed<double, 2, 1>::rows, "C++: mrpt::math::CMatrixFixed<double, 2, 1>::rows() const --> int");
cl.def("cols", (int (mrpt::math::CMatrixFixed<double,2UL,1UL>::*)() const) &mrpt::math::CMatrixFixed<double, 2, 1>::cols, "C++: mrpt::math::CMatrixFixed<double, 2, 1>::cols() const --> int");
cl.def("data", (double * (mrpt::math::CMatrixFixed<double,2UL,1UL>::*)()) &mrpt::math::CMatrixFixed<double, 2, 1>::data, "C++: mrpt::math::CMatrixFixed<double, 2, 1>::data() --> double *", pybind11::return_value_policy::automatic);
- cl.def("__call__", (double & (mrpt::math::CMatrixFixed<double,2UL,1UL>::*)(int, int)) &mrpt::math::CMatrixFixed<double, 2, 1>::operator(), "C++: mrpt::math::CMatrixFixed<double, 2, 1>::operator()(int, int) --> double &", pybind11::return_value_policy::automatic, pybind11::arg("row"), pybind11::arg("col"));
- cl.def("__call__", (double & (mrpt::math::CMatrixFixed<double,2UL,1UL>::*)(int)) &mrpt::math::CMatrixFixed<double, 2, 1>::operator(), "C++: mrpt::math::CMatrixFixed<double, 2, 1>::operator()(int) --> double &", pybind11::return_value_policy::automatic, pybind11::arg("i"));
- cl.def("__getitem__", (double & (mrpt::math::CMatrixFixed<double,2UL,1UL>::*)(int)) &mrpt::math::CMatrixFixed<double, 2, 1>::operator[], "C++: mrpt::math::CMatrixFixed<double, 2, 1>::operator[](int) --> double &", pybind11::return_value_policy::automatic, pybind11::arg("i"));
+ cl.def("__call__", (double & (mrpt::math::CMatrixFixed<double,2UL,1UL>::*)(int, int)) &mrpt::math::CMatrixFixed<double, 2, 1>::operator(), "C++: mrpt::math::CMatrixFixed<double, 2, 1>::operator()(int, int) --> double &", pybind11::return_value_policy::reference, pybind11::arg("row"), pybind11::arg("col"));
+ cl.def("__call__", (double & (mrpt::math::CMatrixFixed<double,2UL,1UL>::*)(int)) &mrpt::math::CMatrixFixed<double, 2, 1>::operator(), "C++: mrpt::math::CMatrixFixed<double, 2, 1>::operator()(int) --> double &", pybind11::return_value_policy::reference, pybind11::arg("i"));
+ cl.def("__getitem__", (double & (mrpt::math::CMatrixFixed<double,2UL,1UL>::*)(int)) &mrpt::math::CMatrixFixed<double, 2, 1>::operator[], "C++: mrpt::math::CMatrixFixed<double, 2, 1>::operator[](int) --> double &", pybind11::return_value_policy::reference, pybind11::arg("i"));
cl.def("sum_At", (void (mrpt::math::CMatrixFixed<double,2UL,1UL>::*)(const class mrpt::math::CMatrixFixed<double, 2, 1> &)) &mrpt::math::CMatrixFixed<double, 2, 1>::sum_At, "C++: mrpt::math::CMatrixFixed<double, 2, 1>::sum_At(const class mrpt::math::CMatrixFixed<double, 2, 1> &) --> void", pybind11::arg("A"));
cl.def("assign", (class mrpt::math::CMatrixFixed<double, 2, 1> & (mrpt::math::CMatrixFixed<double,2UL,1UL>::*)(const class mrpt::math::CMatrixFixed<double, 2, 1> &)) &mrpt::math::CMatrixFixed<double, 2, 1>::operator=, "C++: mrpt::math::CMatrixFixed<double, 2, 1>::operator=(const class mrpt::math::CMatrixFixed<double, 2, 1> &) --> class mrpt::math::CMatrixFixed<double, 2, 1> &", pybind11::return_value_policy::automatic, pybind11::arg(""));
}
@@ -114,9 +114,9 @@ void bind_mrpt_math_CMatrixFixed_1(std::function< pybind11::module &(std::string
cl.def("rows", (int (mrpt::math::CMatrixFixed<double,6UL,1UL>::*)() const) &mrpt::math::CMatrixFixed<double, 6, 1>::rows, "C++: mrpt::math::CMatrixFixed<double, 6, 1>::rows() const --> int");
cl.def("cols", (int (mrpt::math::CMatrixFixed<double,6UL,1UL>::*)() const) &mrpt::math::CMatrixFixed<double, 6, 1>::cols, "C++: mrpt::math::CMatrixFixed<double, 6, 1>::cols() const --> int");
cl.def("data", (double * (mrpt::math::CMatrixFixed<double,6UL,1UL>::*)()) &mrpt::math::CMatrixFixed<double, 6, 1>::data, "C++: mrpt::math::CMatrixFixed<double, 6, 1>::data() --> double *", pybind11::return_value_policy::automatic);
- cl.def("__call__", (double & (mrpt::math::CMatrixFixed<double,6UL,1UL>::*)(int, int)) &mrpt::math::CMatrixFixed<double, 6, 1>::operator(), "C++: mrpt::math::CMatrixFixed<double, 6, 1>::operator()(int, int) --> double &", pybind11::return_value_policy::automatic, pybind11::arg("row"), pybind11::arg("col"));
- cl.def("__call__", (double & (mrpt::math::CMatrixFixed<double,6UL,1UL>::*)(int)) &mrpt::math::CMatrixFixed<double, 6, 1>::operator(), "C++: mrpt::math::CMatrixFixed<double, 6, 1>::operator()(int) --> double &", pybind11::return_value_policy::automatic, pybind11::arg("i"));
- cl.def("__getitem__", (double & (mrpt::math::CMatrixFixed<double,6UL,1UL>::*)(int)) &mrpt::math::CMatrixFixed<double, 6, 1>::operator[], "C++: mrpt::math::CMatrixFixed<double, 6, 1>::operator[](int) --> double &", pybind11::return_value_policy::automatic, pybind11::arg("i"));
+ cl.def("__call__", (double & (mrpt::math::CMatrixFixed<double,6UL,1UL>::*)(int, int)) &mrpt::math::CMatrixFixed<double, 6, 1>::operator(), "C++: mrpt::math::CMatrixFixed<double, 6, 1>::operator()(int, int) --> double &", pybind11::return_value_policy::reference, pybind11::arg("row"), pybind11::arg("col"));
+ cl.def("__call__", (double & (mrpt::math::CMatrixFixed<double,6UL,1UL>::*)(int)) &mrpt::math::CMatrixFixed<double, 6, 1>::operator(), "C++: mrpt::math::CMatrixFixed<double, 6, 1>::operator()(int) --> double &", pybind11::return_value_policy::reference, pybind11::arg("i"));
+ cl.def("__getitem__", (double & (mrpt::math::CMatrixFixed<double,6UL,1UL>::*)(int)) &mrpt::math::CMatrixFixed<double, 6, 1>::operator[], "C++: mrpt::math::CMatrixFixed<double, 6, 1>::operator[](int) --> double &", pybind11::return_value_policy::reference, pybind11::arg("i"));
cl.def("sum_At", (void (mrpt::math::CMatrixFixed<double,6UL,1UL>::*)(const class mrpt::math::CMatrixFixed<double, 6, 1> &)) &mrpt::math::CMatrixFixed<double, 6, 1>::sum_At, "C++: mrpt::math::CMatrixFixed<double, 6, 1>::sum_At(const class mrpt::math::CMatrixFixed<double, 6, 1> &) --> void", pybind11::arg("A"));
}
}
diff --git a/python/src/mrpt/math/CMatrixFixed_2.cpp b/python/src/mrpt/math/CMatrixFixed_2.cpp
index 4cfc7c55d..2f75fb4ea 100644
--- a/python/src/mrpt/math/CMatrixFixed_2.cpp
+++ b/python/src/mrpt/math/CMatrixFixed_2.cpp
@@ -38,9 +38,9 @@ void bind_mrpt_math_CMatrixFixed_2(std::function< pybind11::module &(std::string
cl.def("rows", (int (mrpt::math::CMatrixFixed<double,7UL,1UL>::*)() const) &mrpt::math::CMatrixFixed<double, 7, 1>::rows, "C++: mrpt::math::CMatrixFixed<double, 7, 1>::rows() const --> int");
cl.def("cols", (int (mrpt::math::CMatrixFixed<double,7UL,1UL>::*)() const) &mrpt::math::CMatrixFixed<double, 7, 1>::cols, "C++: mrpt::math::CMatrixFixed<double, 7, 1>::cols() const --> int");
cl.def("data", (double * (mrpt::math::CMatrixFixed<double,7UL,1UL>::*)()) &mrpt::math::CMatrixFixed<double, 7, 1>::data, "C++: mrpt::math::CMatrixFixed<double, 7, 1>::data() --> double *", pybind11::return_value_policy::automatic);
- cl.def("__call__", (double & (mrpt::math::CMatrixFixed<double,7UL,1UL>::*)(int, int)) &mrpt::math::CMatrixFixed<double, 7, 1>::operator(), "C++: mrpt::math::CMatrixFixed<double, 7, 1>::operator()(int, int) --> double &", pybind11::return_value_policy::automatic, pybind11::arg("row"), pybind11::arg("col"));
- cl.def("__call__", (double & (mrpt::math::CMatrixFixed<double,7UL,1UL>::*)(int)) &mrpt::math::CMatrixFixed<double, 7, 1>::operator(), "C++: mrpt::math::CMatrixFixed<double, 7, 1>::operator()(int) --> double &", pybind11::return_value_policy::automatic, pybind11::arg("i"));
- cl.def("__getitem__", (double & (mrpt::math::CMatrixFixed<double,7UL,1UL>::*)(int)) &mrpt::math::CMatrixFixed<double, 7, 1>::operator[], "C++: mrpt::math::CMatrixFixed<double, 7, 1>::operator[](int) --> double &", pybind11::return_value_policy::automatic, pybind11::arg("i"));
+ cl.def("__call__", (double & (mrpt::math::CMatrixFixed<double,7UL,1UL>::*)(int, int)) &mrpt::math::CMatrixFixed<double, 7, 1>::operator(), "C++: mrpt::math::CMatrixFixed<double, 7, 1>::operator()(int, int) --> double &", pybind11::return_value_policy::reference, pybind11::arg("row"), pybind11::arg("col"));
+ cl.def("__call__", (double & (mrpt::math::CMatrixFixed<double,7UL,1UL>::*)(int)) &mrpt::math::CMatrixFixed<double, 7, 1>::operator(), "C++: mrpt::math::CMatrixFixed<double, 7, 1>::operator()(int) --> double &", pybind11::return_value_policy::reference, pybind11::arg("i"));
+ cl.def("__getitem__", (double & (mrpt::math::CMatrixFixed<double,7UL,1UL>::*)(int)) &mrpt::math::CMatrixFixed<double, 7, 1>::operator[], "C++: mrpt::math::CMatrixFixed<double, 7, 1>::operator[](int) --> double &", pybind11::return_value_policy::reference, pybind11::arg("i"));
cl.def("sum_At", (void (mrpt::math::CMatrixFixed<double,7UL,1UL>::*)(const class mrpt::math::CMatrixFixed<double, 7, 1> &)) &mrpt::math::CMatrixFixed<double, 7, 1>::sum_At, "C++: mrpt::math::CMatrixFixed<double, 7, 1>::sum_At(const class mrpt::math::CMatrixFixed<double, 7, 1> &) --> void", pybind11::arg("A"));
}
{ // mrpt::math::CMatrixFixed file:mrpt/math/CMatrixFixed.h line:34
@@ -63,12 +63,23 @@ void bind_mrpt_math_CMatrixFixed_2(std::function< pybind11::module &(std::string
cl.def("rows", (int (mrpt::math::CMatrixFixed<double,4UL,1UL>::*)() const) &mrpt::math::CMatrixFixed<double, 4, 1>::rows, "C++: mrpt::math::CMatrixFixed<double, 4, 1>::rows() const --> int");
cl.def("cols", (int (mrpt::math::CMatrixFixed<double,4UL,1UL>::*)() const) &mrpt::math::CMatrixFixed<double, 4, 1>::cols, "C++: mrpt::math::CMatrixFixed<double, 4, 1>::cols() const --> int");
cl.def("data", (double * (mrpt::math::CMatrixFixed<double,4UL,1UL>::*)()) &mrpt::math::CMatrixFixed<double, 4, 1>::data, "C++: mrpt::math::CMatrixFixed<double, 4, 1>::data() --> double *", pybind11::return_value_policy::automatic);
- cl.def("__call__", (double & (mrpt::math::CMatrixFixed<double,4UL,1UL>::*)(int, int)) &mrpt::math::CMatrixFixed<double, 4, 1>::operator(), "C++: mrpt::math::CMatrixFixed<double, 4, 1>::operator()(int, int) --> double &", pybind11::return_value_policy::automatic, pybind11::arg("row"), pybind11::arg("col"));
- cl.def("__call__", (double & (mrpt::math::CMatrixFixed<double,4UL,1UL>::*)(int)) &mrpt::math::CMatrixFixed<double, 4, 1>::operator(), "C++: mrpt::math::CMatrixFixed<double, 4, 1>::operator()(int) --> double &", pybind11::return_value_policy::automatic, pybind11::arg("i"));
- cl.def("__getitem__", (double & (mrpt::math::CMatrixFixed<double,4UL,1UL>::*)(int)) &mrpt::math::CMatrixFixed<double, 4, 1>::operator[], "C++: mrpt::math::CMatrixFixed<double, 4, 1>::operator[](int) --> double &", pybind11::return_value_policy::automatic, pybind11::arg("i"));
+ cl.def("__call__", (double & (mrpt::math::CMatrixFixed<double,4UL,1UL>::*)(int, int)) &mrpt::math::CMatrixFixed<double, 4, 1>::operator(), "C++: mrpt::math::CMatrixFixed<double, 4, 1>::operator()(int, int) --> double &", pybind11::return_value_policy::reference, pybind11::arg("row"), pybind11::arg("col"));
+ cl.def("__call__", (double & (mrpt::math::CMatrixFixed<double,4UL,1UL>::*)(int)) &mrpt::math::CMatrixFixed<double, 4, 1>::operator(), "C++: mrpt::math::CMatrixFixed<double, 4, 1>::operator()(int) --> double &", pybind11::return_value_policy::reference, pybind11::arg("i"));
cl.def("cast_float", (class mrpt::math::CMatrixFixed<float, 4, 1> (mrpt::math::CMatrixFixed<double,4UL,1UL>::*)() const) &mrpt::math::CMatrixFixed<double, 4, 1>::cast_float, "C++: mrpt::math::CMatrixFixed<double, 4, 1>::cast_float() const --> class mrpt::math::CMatrixFixed<float, 4, 1>");
cl.def("sum_At", (void (mrpt::math::CMatrixFixed<double,4UL,1UL>::*)(const class mrpt::math::CMatrixFixed<double, 4, 1> &)) &mrpt::math::CMatrixFixed<double, 4, 1>::sum_At, "C++: mrpt::math::CMatrixFixed<double, 4, 1>::sum_At(const class mrpt::math::CMatrixFixed<double, 4, 1> &) --> void", pybind11::arg("A"));
cl.def("assign", (class mrpt::math::CMatrixFixed<double, 4, 1> & (mrpt::math::CMatrixFixed<double,4UL,1UL>::*)(const class mrpt::math::CMatrixFixed<double, 4, 1> &)) &mrpt::math::CMatrixFixed<double, 4, 1>::operator=, "C++: mrpt::math::CMatrixFixed<double, 4, 1>::operator=(const class mrpt::math::CMatrixFixed<double, 4, 1> &) --> class mrpt::math::CMatrixFixed<double, 4, 1> &", pybind11::return_value_policy::automatic, pybind11::arg(""));
+
+ // Manually-added matrix methods:
+ using dat_t = double;
+ using mat_t = mrpt::math::CMatrixFixed<dat_t,4,1>;
+ cl.def("__getitem__", [](const mat_t&self, pybind11::tuple coord) -> dat_t { if (coord.size()==2) return self.coeff(coord[0].cast<size_t>(), coord[1].cast<size_t>()); else if (coord.size()==1) return self[coord[0].cast<size_t>()]; else throw std::invalid_argument("Access with [idx] or [row,col]"); });
+ cl.def("__setitem__", [](mat_t&self, pybind11::tuple coord, dat_t val) { if (coord.size()==2) self.coeffRef(coord[0].cast<size_t>(), coord[1].cast<size_t>())=val; else if (coord.size()==1) self[coord[0].cast<size_t>()]=val; else throw std::invalid_argument("Access with [idx] or [row,col]"); });
+ cl.def("__str__", [](const mat_t& o) -> std::string { return o.asString(); } );
+ cl.def("inMatlabFormat", [](const mat_t& o) -> std::string { return o.inMatlabFormat(); } );
+ cl.def("size", [](const mat_t&self) -> pybind11::tuple { return pybind11::make_tuple(self.cols(),self.rows()); });
+ cl.def_static("Zero", []() -> mat_t { return mat_t::Zero(); }, "Returns a matrix with zeroes");
+ cl.def(pybind11::init( [](pybind11::list vals){ auto m = new mat_t(); const auto nR = vals.size(); if (!nR) return m; const auto nC = vals[0].cast<pybind11::list>().size(); m->setSize(nR,nC); for (size_t r=0;r<nR;r++) { const auto row = vals[r].cast<pybind11::list>(); for (size_t c=0;c<nC;c++) m->coeffRef(r,c) = row[c].cast<dat_t>(); } return m; }));
+ cl.def("to_list", [](const mat_t&self) -> pybind11::list { auto l = pybind11::list(); const auto nR = self.rows(), nC = self.cols(); for (int r=0;r<nR;r++) { auto row = pybind11::list(); l.append(row); for (int c=0;c<nC;c++) row.append(self.coeff(r,c)); } return l; });
}
{ // mrpt::math::CMatrixFixed file:mrpt/math/CMatrixFixed.h line:34
pybind11::class_<mrpt::math::CMatrixFixed<double,4UL,3UL>, std::shared_ptr<mrpt::math::CMatrixFixed<double,4UL,3UL>>> cl(M("mrpt::math"), "CMatrixFixed_double_4UL_3UL_t", "");
@@ -90,9 +101,9 @@ void bind_mrpt_math_CMatrixFixed_2(std::function< pybind11::module &(std::string
cl.def("rows", (int (mrpt::math::CMatrixFixed<double,4UL,3UL>::*)() const) &mrpt::math::CMatrixFixed<double, 4, 3>::rows, "C++: mrpt::math::CMatrixFixed<double, 4, 3>::rows() const --> int");
cl.def("cols", (int (mrpt::math::CMatrixFixed<double,4UL,3UL>::*)() const) &mrpt::math::CMatrixFixed<double, 4, 3>::cols, "C++: mrpt::math::CMatrixFixed<double, 4, 3>::cols() const --> int");
cl.def("data", (double * (mrpt::math::CMatrixFixed<double,4UL,3UL>::*)()) &mrpt::math::CMatrixFixed<double, 4, 3>::data, "C++: mrpt::math::CMatrixFixed<double, 4, 3>::data() --> double *", pybind11::return_value_policy::automatic);
- cl.def("__call__", (double & (mrpt::math::CMatrixFixed<double,4UL,3UL>::*)(int, int)) &mrpt::math::CMatrixFixed<double, 4, 3>::operator(), "C++: mrpt::math::CMatrixFixed<double, 4, 3>::operator()(int, int) --> double &", pybind11::return_value_policy::automatic, pybind11::arg("row"), pybind11::arg("col"));
- cl.def("__call__", (double & (mrpt::math::CMatrixFixed<double,4UL,3UL>::*)(int)) &mrpt::math::CMatrixFixed<double, 4, 3>::operator(), "C++: mrpt::math::CMatrixFixed<double, 4, 3>::operator()(int) --> double &", pybind11::return_value_policy::automatic, pybind11::arg("i"));
- cl.def("__getitem__", (double & (mrpt::math::CMatrixFixed<double,4UL,3UL>::*)(int)) &mrpt::math::CMatrixFixed<double, 4, 3>::operator[], "C++: mrpt::math::CMatrixFixed<double, 4, 3>::operator[](int) --> double &", pybind11::return_value_policy::automatic, pybind11::arg("i"));
+ cl.def("__call__", (double & (mrpt::math::CMatrixFixed<double,4UL,3UL>::*)(int, int)) &mrpt::math::CMatrixFixed<double, 4, 3>::operator(), "C++: mrpt::math::CMatrixFixed<double, 4, 3>::operator()(int, int) --> double &", pybind11::return_value_policy::reference, pybind11::arg("row"), pybind11::arg("col"));
+ cl.def("__call__", (double & (mrpt::math::CMatrixFixed<double,4UL,3UL>::*)(int)) &mrpt::math::CMatrixFixed<double, 4, 3>::operator(), "C++: mrpt::math::CMatrixFixed<double, 4, 3>::operator()(int) --> double &", pybind11::return_value_policy::reference, pybind11::arg("i"));
+ cl.def("__getitem__", (double & (mrpt::math::CMatrixFixed<double,4UL,3UL>::*)(int)) &mrpt::math::CMatrixFixed<double, 4, 3>::operator[], "C++: mrpt::math::CMatrixFixed<double, 4, 3>::operator[](int) --> double &", pybind11::return_value_policy::reference, pybind11::arg("i"));
cl.def("sum_At", (void (mrpt::math::CMatrixFixed<double,4UL,3UL>::*)(const class mrpt::math::CMatrixFixed<double, 4, 3> &)) &mrpt::math::CMatrixFixed<double, 4, 3>::sum_At, "C++: mrpt::math::CMatrixFixed<double, 4, 3>::sum_At(const class mrpt::math::CMatrixFixed<double, 4, 3> &) --> void", pybind11::arg("A"));
}
{ // mrpt::math::CMatrixFixed file:mrpt/math/CMatrixFixed.h line:34
@@ -114,10 +125,22 @@ void bind_mrpt_math_CMatrixFixed_2(std::function< pybind11::module &(std::string
cl.def("rows", (int (mrpt::math::CMatrixFixed<float,3UL,3UL>::*)() const) &mrpt::math::CMatrixFixed<float, 3, 3>::rows, "C++: mrpt::math::CMatrixFixed<float, 3, 3>::rows() const --> int");
cl.def("cols", (int (mrpt::math::CMatrixFixed<float,3UL,3UL>::*)() const) &mrpt::math::CMatrixFixed<float, 3, 3>::cols, "C++: mrpt::math::CMatrixFixed<float, 3, 3>::cols() const --> int");
cl.def("data", (float * (mrpt::math::CMatrixFixed<float,3UL,3UL>::*)()) &mrpt::math::CMatrixFixed<float, 3, 3>::data, "C++: mrpt::math::CMatrixFixed<float, 3, 3>::data() --> float *", pybind11::return_value_policy::automatic);
- cl.def("__call__", (float & (mrpt::math::CMatrixFixed<float,3UL,3UL>::*)(int, int)) &mrpt::math::CMatrixFixed<float, 3, 3>::operator(), "C++: mrpt::math::CMatrixFixed<float, 3, 3>::operator()(int, int) --> float &", pybind11::return_value_policy::automatic, pybind11::arg("row"), pybind11::arg("col"));
- cl.def("__call__", (float & (mrpt::math::CMatrixFixed<float,3UL,3UL>::*)(int)) &mrpt::math::CMatrixFixed<float, 3, 3>::operator(), "C++: mrpt::math::CMatrixFixed<float, 3, 3>::operator()(int) --> float &", pybind11::return_value_policy::automatic, pybind11::arg("i"));
- cl.def("__getitem__", (float & (mrpt::math::CMatrixFixed<float,3UL,3UL>::*)(int)) &mrpt::math::CMatrixFixed<float, 3, 3>::operator[], "C++: mrpt::math::CMatrixFixed<float, 3, 3>::operator[](int) --> float &", pybind11::return_value_policy::automatic, pybind11::arg("i"));
+ cl.def("__call__", (float & (mrpt::math::CMatrixFixed<float,3UL,3UL>::*)(int, int)) &mrpt::math::CMatrixFixed<float, 3, 3>::operator(), "C++: mrpt::math::CMatrixFixed<float, 3, 3>::operator()(int, int) --> float &", pybind11::return_value_policy::reference, pybind11::arg("row"), pybind11::arg("col"));
+ cl.def("__call__", (float & (mrpt::math::CMatrixFixed<float,3UL,3UL>::*)(int)) &mrpt::math::CMatrixFixed<float, 3, 3>::operator(), "C++: mrpt::math::CMatrixFixed<float, 3, 3>::operator()(int) --> float &", pybind11::return_value_policy::reference, pybind11::arg("i"));
cl.def("cast_float", (class mrpt::math::CMatrixFixed<float, 3, 3> (mrpt::math::CMatrixFixed<float,3UL,3UL>::*)() const) &mrpt::math::CMatrixFixed<float, 3, 3>::cast_float, "C++: mrpt::math::CMatrixFixed<float, 3, 3>::cast_float() const --> class mrpt::math::CMatrixFixed<float, 3, 3>");
cl.def("sum_At", (void (mrpt::math::CMatrixFixed<float,3UL,3UL>::*)(const class mrpt::math::CMatrixFixed<float, 3, 3> &)) &mrpt::math::CMatrixFixed<float, 3, 3>::sum_At, "C++: mrpt::math::CMatrixFixed<float, 3, 3>::sum_At(const class mrpt::math::CMatrixFixed<float, 3, 3> &) --> void", pybind11::arg("A"));
+
+ // Manually-added matrix methods:
+ using dat_t = float;
+ using mat_t = mrpt::math::CMatrixFixed<dat_t,3,3>;
+ cl.def("__getitem__", [](const mat_t&self, pybind11::tuple coord) -> dat_t { if (coord.size()==2) return self.coeff(coord[0].cast<size_t>(), coord[1].cast<size_t>()); else if (coord.size()==1) return self[coord[0].cast<size_t>()]; else throw std::invalid_argument("Access with [idx] or [row,col]"); });
+ cl.def("__setitem__", [](mat_t&self, pybind11::tuple coord, dat_t val) { if (coord.size()==2) self.coeffRef(coord[0].cast<size_t>(), coord[1].cast<size_t>())=val; else if (coord.size()==1) self[coord[0].cast<size_t>()]=val; else throw std::invalid_argument("Access with [idx] or [row,col]"); });
+ cl.def("__str__", [](const mat_t& o) -> std::string { return o.asString(); } );
+ cl.def("inMatlabFormat", [](const mat_t& o) -> std::string { return o.inMatlabFormat(); } );
+ cl.def("size", [](const mat_t&self) -> pybind11::tuple { return pybind11::make_tuple(self.cols(),self.rows()); });
+ cl.def_static("Identity", []() -> mat_t { return mat_t::Identity(); }, "Returns the NxN identity matrix");
+ cl.def_static("Zero", []() -> mat_t { return mat_t::Zero(); }, "Returns a matrix with zeroes");
+ cl.def(pybind11::init( [](pybind11::list vals){ auto m = new mat_t(); const auto nR = vals.size(); if (!nR) return m; const auto nC = vals[0].cast<pybind11::list>().size(); m->setSize(nR,nC); for (size_t r=0;r<nR;r++) { const auto row = vals[r].cast<pybind11::list>(); for (size_t c=0;c<nC;c++) m->coeffRef(r,c) = row[c].cast<dat_t>(); } return m; }));
+ cl.def("to_list", [](const mat_t&self) -> pybind11::list { auto l = pybind11::list(); const auto nR = self.rows(), nC = self.cols(); for (int r=0;r<nR;r++) { auto row = pybind11::list(); l.append(row); for (int c=0;c<nC;c++) row.append(self.coeff(r,c)); } return l; });
}
}
diff --git a/python/src/mrpt/math/CMatrixFixed_3.cpp b/python/src/mrpt/math/CMatrixFixed_3.cpp
index 9f57fa132..0192960f3 100644
--- a/python/src/mrpt/math/CMatrixFixed_3.cpp
+++ b/python/src/mrpt/math/CMatrixFixed_3.cpp
@@ -38,12 +38,24 @@ void bind_mrpt_math_CMatrixFixed_3(std::function< pybind11::module &(std::string
cl.def("rows", (int (mrpt::math::CMatrixFixed<float,4UL,4UL>::*)() const) &mrpt::math::CMatrixFixed<float, 4, 4>::rows, "C++: mrpt::math::CMatrixFixed<float, 4, 4>::rows() const --> int");
cl.def("cols", (int (mrpt::math::CMatrixFixed<float,4UL,4UL>::*)() const) &mrpt::math::CMatrixFixed<float, 4, 4>::cols, "C++: mrpt::math::CMatrixFixed<float, 4, 4>::cols() const --> int");
cl.def("data", (float * (mrpt::math::CMatrixFixed<float,4UL,4UL>::*)()) &mrpt::math::CMatrixFixed<float, 4, 4>::data, "C++: mrpt::math::CMatrixFixed<float, 4, 4>::data() --> float *", pybind11::return_value_policy::automatic);
- cl.def("__call__", (float & (mrpt::math::CMatrixFixed<float,4UL,4UL>::*)(int, int)) &mrpt::math::CMatrixFixed<float, 4, 4>::operator(), "C++: mrpt::math::CMatrixFixed<float, 4, 4>::operator()(int, int) --> float &", pybind11::return_value_policy::automatic, pybind11::arg("row"), pybind11::arg("col"));
- cl.def("__call__", (float & (mrpt::math::CMatrixFixed<float,4UL,4UL>::*)(int)) &mrpt::math::CMatrixFixed<float, 4, 4>::operator(), "C++: mrpt::math::CMatrixFixed<float, 4, 4>::operator()(int) --> float &", pybind11::return_value_policy::automatic, pybind11::arg("i"));
- cl.def("__getitem__", (float & (mrpt::math::CMatrixFixed<float,4UL,4UL>::*)(int)) &mrpt::math::CMatrixFixed<float, 4, 4>::operator[], "C++: mrpt::math::CMatrixFixed<float, 4, 4>::operator[](int) --> float &", pybind11::return_value_policy::automatic, pybind11::arg("i"));
+ cl.def("__call__", (float & (mrpt::math::CMatrixFixed<float,4UL,4UL>::*)(int, int)) &mrpt::math::CMatrixFixed<float, 4, 4>::operator(), "C++: mrpt::math::CMatrixFixed<float, 4, 4>::operator()(int, int) --> float &", pybind11::return_value_policy::reference, pybind11::arg("row"), pybind11::arg("col"));
+ cl.def("__call__", (float & (mrpt::math::CMatrixFixed<float,4UL,4UL>::*)(int)) &mrpt::math::CMatrixFixed<float, 4, 4>::operator(), "C++: mrpt::math::CMatrixFixed<float, 4, 4>::operator()(int) --> float &", pybind11::return_value_policy::reference, pybind11::arg("i"));
cl.def("cast_float", (class mrpt::math::CMatrixFixed<float, 4, 4> (mrpt::math::CMatrixFixed<float,4UL,4UL>::*)() const) &mrpt::math::CMatrixFixed<float, 4, 4>::cast_float, "C++: mrpt::math::CMatrixFixed<float, 4, 4>::cast_float() const --> class mrpt::math::CMatrixFixed<float, 4, 4>");
cl.def("sum_At", (void (mrpt::math::CMatrixFixed<float,4UL,4UL>::*)(const class mrpt::math::CMatrixFixed<float, 4, 4> &)) &mrpt::math::CMatrixFixed<float, 4, 4>::sum_At, "C++: mrpt::math::CMatrixFixed<float, 4, 4>::sum_At(const class mrpt::math::CMatrixFixed<float, 4, 4> &) --> void", pybind11::arg("A"));
cl.def("assign", (class mrpt::math::CMatrixFixed<float, 4, 4> & (mrpt::math::CMatrixFixed<float,4UL,4UL>::*)(const class mrpt::math::CMatrixFixed<float, 4, 4> &)) &mrpt::math::CMatrixFixed<float, 4, 4>::operator=, "C++: mrpt::math::CMatrixFixed<float, 4, 4>::operator=(const class mrpt::math::CMatrixFixed<float, 4, 4> &) --> class mrpt::math::CMatrixFixed<float, 4, 4> &", pybind11::return_value_policy::automatic, pybind11::arg(""));
+
+ // Manually-added matrix methods:
+ using dat_t = float;
+ using mat_t = mrpt::math::CMatrixFixed<dat_t,4,4>;
+ cl.def("__getitem__", [](const mat_t&self, pybind11::tuple coord) -> dat_t { if (coord.size()==2) return self.coeff(coord[0].cast<size_t>(), coord[1].cast<size_t>()); else if (coord.size()==1) return self[coord[0].cast<size_t>()]; else throw std::invalid_argument("Access with [idx] or [row,col]"); });
+ cl.def("__setitem__", [](mat_t&self, pybind11::tuple coord, dat_t val) { if (coord.size()==2) self.coeffRef(coord[0].cast<size_t>(), coord[1].cast<size_t>())=val; else if (coord.size()==1) self[coord[0].cast<size_t>()]=val; else throw std::invalid_argument("Access with [idx] or [row,col]"); });
+ cl.def("__str__", [](const mat_t& o) -> std::string { return o.asString(); } );
+ cl.def("inMatlabFormat", [](const mat_t& o) -> std::string { return o.inMatlabFormat(); } );
+ cl.def("size", [](const mat_t&self) -> pybind11::tuple { return pybind11::make_tuple(self.cols(),self.rows()); });
+ cl.def_static("Identity", []() -> mat_t { return mat_t::Identity(); }, "Returns the NxN identity matrix");
+ cl.def_static("Zero", []() -> mat_t { return mat_t::Zero(); }, "Returns a matrix with zeroes");
+ cl.def(pybind11::init( [](pybind11::list vals){ auto m = new mat_t(); const auto nR = vals.size(); if (!nR) return m; const auto nC = vals[0].cast<pybind11::list>().size(); m->setSize(nR,nC); for (size_t r=0;r<nR;r++) { const auto row = vals[r].cast<pybind11::list>(); for (size_t c=0;c<nC;c++) m->coeffRef(r,c) = row[c].cast<dat_t>(); } return m; }));
+ cl.def("to_list", [](const mat_t&self) -> pybind11::list { auto l = pybind11::list(); const auto nR = self.rows(), nC = self.cols(); for (int r=0;r<nR;r++) { auto row = pybind11::list(); l.append(row); for (int c=0;c<nC;c++) row.append(self.coeff(r,c)); } return l; });
}
{ // mrpt::math::CMatrixFixed file:mrpt/math/CMatrixFixed.h line:34
pybind11::class_<mrpt::math::CMatrixFixed<float,3UL,1UL>, std::shared_ptr<mrpt::math::CMatrixFixed<float,3UL,1UL>>> cl(M("mrpt::math"), "CMatrixFixed_float_3UL_1UL_t", "");
@@ -65,12 +77,23 @@ void bind_mrpt_math_CMatrixFixed_3(std::function< pybind11::module &(std::string
cl.def("rows", (int (mrpt::math::CMatrixFixed<float,3UL,1UL>::*)() const) &mrpt::math::CMatrixFixed<float, 3, 1>::rows, "C++: mrpt::math::CMatrixFixed<float, 3, 1>::rows() const --> int");
cl.def("cols", (int (mrpt::math::CMatrixFixed<float,3UL,1UL>::*)() const) &mrpt::math::CMatrixFixed<float, 3, 1>::cols, "C++: mrpt::math::CMatrixFixed<float, 3, 1>::cols() const --> int");
cl.def("data", (float * (mrpt::math::CMatrixFixed<float,3UL,1UL>::*)()) &mrpt::math::CMatrixFixed<float, 3, 1>::data, "C++: mrpt::math::CMatrixFixed<float, 3, 1>::data() --> float *", pybind11::return_value_policy::automatic);
- cl.def("__call__", (float & (mrpt::math::CMatrixFixed<float,3UL,1UL>::*)(int, int)) &mrpt::math::CMatrixFixed<float, 3, 1>::operator(), "C++: mrpt::math::CMatrixFixed<float, 3, 1>::operator()(int, int) --> float &", pybind11::return_value_policy::automatic, pybind11::arg("row"), pybind11::arg("col"));
- cl.def("__call__", (float & (mrpt::math::CMatrixFixed<float,3UL,1UL>::*)(int)) &mrpt::math::CMatrixFixed<float, 3, 1>::operator(), "C++: mrpt::math::CMatrixFixed<float, 3, 1>::operator()(int) --> float &", pybind11::return_value_policy::automatic, pybind11::arg("i"));
- cl.def("__getitem__", (float & (mrpt::math::CMatrixFixed<float,3UL,1UL>::*)(int)) &mrpt::math::CMatrixFixed<float, 3, 1>::operator[], "C++: mrpt::math::CMatrixFixed<float, 3, 1>::operator[](int) --> float &", pybind11::return_value_policy::automatic, pybind11::arg("i"));
+ cl.def("__call__", (float & (mrpt::math::CMatrixFixed<float,3UL,1UL>::*)(int, int)) &mrpt::math::CMatrixFixed<float, 3, 1>::operator(), "C++: mrpt::math::CMatrixFixed<float, 3, 1>::operator()(int, int) --> float &", pybind11::return_value_policy::reference, pybind11::arg("row"), pybind11::arg("col"));
+ cl.def("__call__", (float & (mrpt::math::CMatrixFixed<float,3UL,1UL>::*)(int)) &mrpt::math::CMatrixFixed<float, 3, 1>::operator(), "C++: mrpt::math::CMatrixFixed<float, 3, 1>::operator()(int) --> float &", pybind11::return_value_policy::reference, pybind11::arg("i"));
cl.def("cast_float", (class mrpt::math::CMatrixFixed<float, 3, 1> (mrpt::math::CMatrixFixed<float,3UL,1UL>::*)() const) &mrpt::math::CMatrixFixed<float, 3, 1>::cast_float, "C++: mrpt::math::CMatrixFixed<float, 3, 1>::cast_float() const --> class mrpt::math::CMatrixFixed<float, 3, 1>");
cl.def("sum_At", (void (mrpt::math::CMatrixFixed<float,3UL,1UL>::*)(const class mrpt::math::CMatrixFixed<float, 3, 1> &)) &mrpt::math::CMatrixFixed<float, 3, 1>::sum_At, "C++: mrpt::math::CMatrixFixed<float, 3, 1>::sum_At(const class mrpt::math::CMatrixFixed<float, 3, 1> &) --> void", pybind11::arg("A"));
cl.def("assign", (class mrpt::math::CMatrixFixed<float, 3, 1> & (mrpt::math::CMatrixFixed<float,3UL,1UL>::*)(const class mrpt::math::CMatrixFixed<float, 3, 1> &)) &mrpt::math::CMatrixFixed<float, 3, 1>::operator=, "C++: mrpt::math::CMatrixFixed<float, 3, 1>::operator=(const class mrpt::math::CMatrixFixed<float, 3, 1> &) --> class mrpt::math::CMatrixFixed<float, 3, 1> &", pybind11::return_value_policy::automatic, pybind11::arg(""));
+
+ // Manually-added matrix methods:
+ using dat_t = float;
+ using mat_t = mrpt::math::CMatrixFixed<dat_t,3,1>;
+ cl.def("__getitem__", [](const mat_t&self, pybind11::tuple coord) -> dat_t { if (coord.size()==2) return self.coeff(coord[0].cast<size_t>(), coord[1].cast<size_t>()); else if (coord.size()==1) return self[coord[0].cast<size_t>()]; else throw std::invalid_argument("Access with [idx] or [row,col]"); });
+ cl.def("__setitem__", [](mat_t&self, pybind11::tuple coord, dat_t val) { if (coord.size()==2) self.coeffRef(coord[0].cast<size_t>(), coord[1].cast<size_t>())=val; else if (coord.size()==1) self[coord[0].cast<size_t>()]=val; else throw std::invalid_argument("Access with [idx] or [row,col]"); });
+ cl.def("__str__", [](const mat_t& o) -> std::string { return o.asString(); } );
+ cl.def("inMatlabFormat", [](const mat_t& o) -> std::string { return o.inMatlabFormat(); } );
+ cl.def("size", [](const mat_t&self) -> pybind11::tuple { return pybind11::make_tuple(self.cols(),self.rows()); });
+ cl.def_static("Zero", []() -> mat_t { return mat_t::Zero(); }, "Returns a matrix with zeroes");
+ cl.def(pybind11::init( [](pybind11::list vals){ auto m = new mat_t(); const auto nR = vals.size(); if (!nR) return m; const auto nC = vals[0].cast<pybind11::list>().size(); m->setSize(nR,nC); for (size_t r=0;r<nR;r++) { const auto row = vals[r].cast<pybind11::list>(); for (size_t c=0;c<nC;c++) m->coeffRef(r,c) = row[c].cast<dat_t>(); } return m; }));
+ cl.def("to_list", [](const mat_t&self) -> pybind11::list { auto l = pybind11::list(); const auto nR = self.rows(), nC = self.cols(); for (int r=0;r<nR;r++) { auto row = pybind11::list(); l.append(row); for (int c=0;c<nC;c++) row.append(self.coeff(r,c)); } return l; });
}
{ // mrpt::math::CMatrixFixed file:mrpt/math/CMatrixFixed.h line:34
pybind11::class_<mrpt::math::CMatrixFixed<double,12UL,1UL>, std::shared_ptr<mrpt::math::CMatrixFixed<double,12UL,1UL>>> cl(M("mrpt::math"), "CMatrixFixed_double_12UL_1UL_t", "");
@@ -92,9 +115,9 @@ void bind_mrpt_math_CMatrixFixed_3(std::function< pybind11::module &(std::string
cl.def("rows", (int (mrpt::math::CMatrixFixed<double,12UL,1UL>::*)() const) &mrpt::math::CMatrixFixed<double, 12, 1>::rows, "C++: mrpt::math::CMatrixFixed<double, 12, 1>::rows() const --> int");
cl.def("cols", (int (mrpt::math::CMatrixFixed<double,12UL,1UL>::*)() const) &mrpt::math::CMatrixFixed<double, 12, 1>::cols, "C++: mrpt::math::CMatrixFixed<double, 12, 1>::cols() const --> int");
cl.def("data", (double * (mrpt::math::CMatrixFixed<double,12UL,1UL>::*)()) &mrpt::math::CMatrixFixed<double, 12, 1>::data, "C++: mrpt::math::CMatrixFixed<double, 12, 1>::data() --> double *", pybind11::return_value_policy::automatic);
- cl.def("__call__", (double & (mrpt::math::CMatrixFixed<double,12UL,1UL>::*)(int, int)) &mrpt::math::CMatrixFixed<double, 12, 1>::operator(), "C++: mrpt::math::CMatrixFixed<double, 12, 1>::operator()(int, int) --> double &", pybind11::return_value_policy::automatic, pybind11::arg("row"), pybind11::arg("col"));
- cl.def("__call__", (double & (mrpt::math::CMatrixFixed<double,12UL,1UL>::*)(int)) &mrpt::math::CMatrixFixed<double, 12, 1>::operator(), "C++: mrpt::math::CMatrixFixed<double, 12, 1>::operator()(int) --> double &", pybind11::return_value_policy::automatic, pybind11::arg("i"));
- cl.def("__getitem__", (double & (mrpt::math::CMatrixFixed<double,12UL,1UL>::*)(int)) &mrpt::math::CMatrixFixed<double, 12, 1>::operator[], "C++: mrpt::math::CMatrixFixed<double, 12, 1>::operator[](int) --> double &", pybind11::return_value_policy::automatic, pybind11::arg("i"));
+ cl.def("__call__", (double & (mrpt::math::CMatrixFixed<double,12UL,1UL>::*)(int, int)) &mrpt::math::CMatrixFixed<double, 12, 1>::operator(), "C++: mrpt::math::CMatrixFixed<double, 12, 1>::operator()(int, int) --> double &", pybind11::return_value_policy::reference, pybind11::arg("row"), pybind11::arg("col"));
+ cl.def("__call__", (double & (mrpt::math::CMatrixFixed<double,12UL,1UL>::*)(int)) &mrpt::math::CMatrixFixed<double, 12, 1>::operator(), "C++: mrpt::math::CMatrixFixed<double, 12, 1>::operator()(int) --> double &", pybind11::return_value_policy::reference, pybind11::arg("i"));
+ cl.def("__getitem__", (double & (mrpt::math::CMatrixFixed<double,12UL,1UL>::*)(int)) &mrpt::math::CMatrixFixed<double, 12, 1>::operator[], "C++: mrpt::math::CMatrixFixed<double, 12, 1>::operator[](int) --> double &", pybind11::return_value_policy::reference, pybind11::arg("i"));
cl.def("sum_At", (void (mrpt::math::CMatrixFixed<double,12UL,1UL>::*)(const class mrpt::math::CMatrixFixed<double, 12, 1> &)) &mrpt::math::CMatrixFixed<double, 12, 1>::sum_At, "C++: mrpt::math::CMatrixFixed<double, 12, 1>::sum_At(const class mrpt::math::CMatrixFixed<double, 12, 1> &) --> void", pybind11::arg("A"));
}
{ // mrpt::math::CMatrixFixed file:mrpt/math/CMatrixFixed.h line:34
@@ -117,11 +140,22 @@ void bind_mrpt_math_CMatrixFixed_3(std::function< pybind11::module &(std::string
cl.def("rows", (int (mrpt::math::CMatrixFixed<float,4UL,1UL>::*)() const) &mrpt::math::CMatrixFixed<float, 4, 1>::rows, "C++: mrpt::math::CMatrixFixed<float, 4, 1>::rows() const --> int");
cl.def("cols", (int (mrpt::math::CMatrixFixed<float,4UL,1UL>::*)() const) &mrpt::math::CMatrixFixed<float, 4, 1>::cols, "C++: mrpt::math::CMatrixFixed<float, 4, 1>::cols() const --> int");
cl.def("data", (float * (mrpt::math::CMatrixFixed<float,4UL,1UL>::*)()) &mrpt::math::CMatrixFixed<float, 4, 1>::data, "C++: mrpt::math::CMatrixFixed<float, 4, 1>::data() --> float *", pybind11::return_value_policy::automatic);
- cl.def("__call__", (float & (mrpt::math::CMatrixFixed<float,4UL,1UL>::*)(int, int)) &mrpt::math::CMatrixFixed<float, 4, 1>::operator(), "C++: mrpt::math::CMatrixFixed<float, 4, 1>::operator()(int, int) --> float &", pybind11::return_value_policy::automatic, pybind11::arg("row"), pybind11::arg("col"));
- cl.def("__call__", (float & (mrpt::math::CMatrixFixed<float,4UL,1UL>::*)(int)) &mrpt::math::CMatrixFixed<float, 4, 1>::operator(), "C++: mrpt::math::CMatrixFixed<float, 4, 1>::operator()(int) --> float &", pybind11::return_value_policy::automatic, pybind11::arg("i"));
- cl.def("__getitem__", (float & (mrpt::math::CMatrixFixed<float,4UL,1UL>::*)(int)) &mrpt::math::CMatrixFixed<float, 4, 1>::operator[], "C++: mrpt::math::CMatrixFixed<float, 4, 1>::operator[](int) --> float &", pybind11::return_value_policy::automatic, pybind11::arg("i"));
+ cl.def("__call__", (float & (mrpt::math::CMatrixFixed<float,4UL,1UL>::*)(int, int)) &mrpt::math::CMatrixFixed<float, 4, 1>::operator(), "C++: mrpt::math::CMatrixFixed<float, 4, 1>::operator()(int, int) --> float &", pybind11::return_value_policy::reference, pybind11::arg("row"), pybind11::arg("col"));
+ cl.def("__call__", (float & (mrpt::math::CMatrixFixed<float,4UL,1UL>::*)(int)) &mrpt::math::CMatrixFixed<float, 4, 1>::operator(), "C++: mrpt::math::CMatrixFixed<float, 4, 1>::operator()(int) --> float &", pybind11::return_value_policy::reference, pybind11::arg("i"));
cl.def("cast_float", (class mrpt::math::CMatrixFixed<float, 4, 1> (mrpt::math::CMatrixFixed<float,4UL,1UL>::*)() const) &mrpt::math::CMatrixFixed<float, 4, 1>::cast_float, "C++: mrpt::math::CMatrixFixed<float, 4, 1>::cast_float() const --> class mrpt::math::CMatrixFixed<float, 4, 1>");
cl.def("sum_At", (void (mrpt::math::CMatrixFixed<float,4UL,1UL>::*)(const class mrpt::math::CMatrixFixed<float, 4, 1> &)) &mrpt::math::CMatrixFixed<float, 4, 1>::sum_At, "C++: mrpt::math::CMatrixFixed<float, 4, 1>::sum_At(const class mrpt::math::CMatrixFixed<float, 4, 1> &) --> void", pybind11::arg("A"));
cl.def("assign", (class mrpt::math::CMatrixFixed<float, 4, 1> & (mrpt::math::CMatrixFixed<float,4UL,1UL>::*)(const class mrpt::math::CMatrixFixed<float, 4, 1> &)) &mrpt::math::CMatrixFixed<float, 4, 1>::operator=, "C++: mrpt::math::CMatrixFixed<float, 4, 1>::operator=(const class mrpt::math::CMatrixFixed<float, 4, 1> &) --> class mrpt::math::CMatrixFixed<float, 4, 1> &", pybind11::return_value_policy::automatic, pybind11::arg(""));
+
+ // Manually-added matrix methods:
+ using dat_t = float;
+ using mat_t = mrpt::math::CMatrixFixed<dat_t,4,1>;
+ cl.def("__getitem__", [](const mat_t&self, pybind11::tuple coord) -> dat_t { if (coord.size()==2) return self.coeff(coord[0].cast<size_t>(), coord[1].cast<size_t>()); else if (coord.size()==1) return self[coord[0].cast<size_t>()]; else throw std::invalid_argument("Access with [idx] or [row,col]"); });
+ cl.def("__setitem__", [](mat_t&self, pybind11::tuple coord, dat_t val) { if (coord.size()==2) self.coeffRef(coord[0].cast<size_t>(), coord[1].cast<size_t>())=val; else if (coord.size()==1) self[coord[0].cast<size_t>()]=val; else throw std::invalid_argument("Access with [idx] or [row,col]"); });
+ cl.def("__str__", [](const mat_t& o) -> std::string { return o.asString(); } );
+ cl.def("inMatlabFormat", [](const mat_t& o) -> std::string { return o.inMatlabFormat(); } );
+ cl.def("size", [](const mat_t&self) -> pybind11::tuple { return pybind11::make_tuple(self.cols(),self.rows()); });
+ cl.def_static("Zero", []() -> mat_t { return mat_t::Zero(); }, "Returns a matrix with zeroes");
+ cl.def(pybind11::init( [](pybind11::list vals){ auto m = new mat_t(); const auto nR = vals.size(); if (!nR) return m; const auto nC = vals[0].cast<pybind11::list>().size(); m->setSize(nR,nC); for (size_t r=0;r<nR;r++) { const auto row = vals[r].cast<pybind11::list>(); for (size_t c=0;c<nC;c++) m->coeffRef(r,c) = row[c].cast<dat_t>(); } return m; }));
+ cl.def("to_list", [](const mat_t&self) -> pybind11::list { auto l = pybind11::list(); const auto nR = self.rows(), nC = self.cols(); for (int r=0;r<nR;r++) { auto row = pybind11::list(); l.append(row); for (int c=0;c<nC;c++) row.append(self.coeff(r,c)); } return l; });
}
}
diff --git a/python/src/mrpt/math/CVectorDynamic.cpp b/python/src/mrpt/math/CVectorDynamic.cpp
index 780fbaa83..b9075ff96 100644
--- a/python/src/mrpt/math/CVectorDynamic.cpp
+++ b/python/src/mrpt/math/CVectorDynamic.cpp
@@ -46,8 +46,8 @@ void bind_mrpt_math_CVectorDynamic(std::function< pybind11::module &(std::string
cl.def("resize", (void (mrpt::math::CVectorDynamic<double>::*)(std::size_t, bool)) &mrpt::math::CVectorDynamic<double>::resize, "C++: mrpt::math::CVectorDynamic<double>::resize(std::size_t, bool) --> void", pybind11::arg("N"), pybind11::arg("zeroNewElements"));
cl.def("push_back", (void (mrpt::math::CVectorDynamic<double>::*)(const double &)) &mrpt::math::CVectorDynamic<double>::push_back, "C++: mrpt::math::CVectorDynamic<double>::push_back(const double &) --> void", pybind11::arg("val"));
cl.def("segmentCopy", (class mrpt::math::CVectorDynamic<double> (mrpt::math::CVectorDynamic<double>::*)(int, int) const) &mrpt::math::CVectorDynamic<double>::segmentCopy, "C++: mrpt::math::CVectorDynamic<double>::segmentCopy(int, int) const --> class mrpt::math::CVectorDynamic<double>", pybind11::arg("start"), pybind11::arg("LEN"));
- cl.def("__call__", (double & (mrpt::math::CVectorDynamic<double>::*)(size_t, size_t)) &mrpt::math::CVectorDynamic<double>::operator(), "C++: mrpt::math::CVectorDynamic<double>::operator()(size_t, size_t) --> double &", pybind11::return_value_policy::automatic, pybind11::arg("row"), pybind11::arg("col"));
- cl.def("__getitem__", (double & (mrpt::math::CVectorDynamic<double>::*)(size_t)) &mrpt::math::CVectorDynamic<double>::operator[], "C++: mrpt::math::CVectorDynamic<double>::operator[](size_t) --> double &", pybind11::return_value_policy::automatic, pybind11::arg("ith"));
+ cl.def("__call__", (double & (mrpt::math::CVectorDynamic<double>::*)(size_t, size_t)) &mrpt::math::CVectorDynamic<double>::operator(), "C++: mrpt::math::CVectorDynamic<double>::operator()(size_t, size_t) --> double &", pybind11::return_value_policy::reference, pybind11::arg("row"), pybind11::arg("col"));
+ cl.def("__getitem__", (double & (mrpt::math::CVectorDynamic<double>::*)(size_t)) &mrpt::math::CVectorDynamic<double>::operator[], "C++: mrpt::math::CVectorDynamic<double>::operator[](size_t) --> double &", pybind11::return_value_policy::reference, pybind11::arg("ith"));
cl.def("assign", (class mrpt::math::CVectorDynamic<double> & (mrpt::math::CVectorDynamic<double>::*)(const class mrpt::math::CVectorDynamic<double> &)) &mrpt::math::CVectorDynamic<double>::operator=, "C++: mrpt::math::CVectorDynamic<double>::operator=(const class mrpt::math::CVectorDynamic<double> &) --> class mrpt::math::CVectorDynamic<double> &", pybind11::return_value_policy::automatic, pybind11::arg(""));
}
{ // mrpt::math::CVectorDynamic file:mrpt/math/CVectorDynamic.h line:32
@@ -70,8 +70,8 @@ void bind_mrpt_math_CVectorDynamic(std::function< pybind11::module &(std::string
cl.def("resize", (void (mrpt::math::CVectorDynamic<float>::*)(std::size_t, bool)) &mrpt::math::CVectorDynamic<float>::resize, "C++: mrpt::math::CVectorDynamic<float>::resize(std::size_t, bool) --> void", pybind11::arg("N"), pybind11::arg("zeroNewElements"));
cl.def("push_back", (void (mrpt::math::CVectorDynamic<float>::*)(const float &)) &mrpt::math::CVectorDynamic<float>::push_back, "C++: mrpt::math::CVectorDynamic<float>::push_back(const float &) --> void", pybind11::arg("val"));
cl.def("segmentCopy", (class mrpt::math::CVectorDynamic<float> (mrpt::math::CVectorDynamic<float>::*)(int, int) const) &mrpt::math::CVectorDynamic<float>::segmentCopy, "C++: mrpt::math::CVectorDynamic<float>::segmentCopy(int, int) const --> class mrpt::math::CVectorDynamic<float>", pybind11::arg("start"), pybind11::arg("LEN"));
- cl.def("__call__", (float & (mrpt::math::CVectorDynamic<float>::*)(size_t, size_t)) &mrpt::math::CVectorDynamic<float>::operator(), "C++: mrpt::math::CVectorDynamic<float>::operator()(size_t, size_t) --> float &", pybind11::return_value_policy::automatic, pybind11::arg("row"), pybind11::arg("col"));
- cl.def("__getitem__", (float & (mrpt::math::CVectorDynamic<float>::*)(size_t)) &mrpt::math::CVectorDynamic<float>::operator[], "C++: mrpt::math::CVectorDynamic<float>::operator[](size_t) --> float &", pybind11::return_value_policy::automatic, pybind11::arg("ith"));
+ cl.def("__call__", (float & (mrpt::math::CVectorDynamic<float>::*)(size_t, size_t)) &mrpt::math::CVectorDynamic<float>::operator(), "C++: mrpt::math::CVectorDynamic<float>::operator()(size_t, size_t) --> float &", pybind11::return_value_policy::reference, pybind11::arg("row"), pybind11::arg("col"));
+ cl.def("__getitem__", (float & (mrpt::math::CVectorDynamic<float>::*)(size_t)) &mrpt::math::CVectorDynamic<float>::operator[], "C++: mrpt::math::CVectorDynamic<float>::operator[](size_t) --> float &", pybind11::return_value_policy::reference, pybind11::arg("ith"));
cl.def("assign", (class mrpt::math::CVectorDynamic<float> & (mrpt::math::CVectorDynamic<float>::*)(const class mrpt::math::CVectorDynamic<float> &)) &mrpt::math::CVectorDynamic<float>::operator=, "C++: mrpt::math::CVectorDynamic<float>::operator=(const class mrpt::math::CVectorDynamic<float> &) --> class mrpt::math::CVectorDynamic<float> &", pybind11::return_value_policy::automatic, pybind11::arg(""));
}
}
|