GCC Code Coverage Report


Directory: ./
File: include/sot/core/memory-task-sot.hh
Date: 2024-11-13 12:35:17
Exec Total Coverage
Lines: 0 7 0.0%
Branches: 0 10 0.0%

Line Branch Exec Source
1 /*
2 * Copyright 2010,
3 * François Bleibel,
4 * Olivier Stasse,
5 *
6 * CNRS/AIST
7 *
8 */
9
10 #ifndef __SOT_MEMORY_TASK_HH
11 #define __SOT_MEMORY_TASK_HH
12
13 #include <sot/core/matrix-svd.hh>
14 #include <sot/core/task-abstract.hh>
15
16 #include "sot/core/api.hh"
17
18 /* --------------------------------------------------------------------- */
19 /* --- CLASS ----------------------------------------------------------- */
20 /* --------------------------------------------------------------------- */
21
22 namespace dynamicgraph {
23 namespace sot {
24
25 class SOT_CORE_EXPORT MemoryTaskSOT : public TaskAbstract::MemoryTaskAbstract {
26 public: // protected:
27 typedef Eigen::Map<Matrix, Eigen::internal::traits<Matrix>::Alignment>
28 Kernel_t;
29 typedef Eigen::Map<const Matrix, Eigen::internal::traits<Matrix>::Alignment>
30 KernelConst_t;
31
32 /* Internal memory to reduce the dynamic allocation at task resolution. */
33 dynamicgraph::Vector err, tmpTask, tmpVar, tmpControl;
34 dynamicgraph::Matrix Jt; //( nJ,mJ );
35
36 dynamicgraph::Matrix JK; //(nJ,mJ);
37
38 SVD_t svd;
39 Kernel_t kernel;
40
41 void resizeKernel(const Matrix::Index r, const Matrix::Index c) {
42 if (kernel.rows() != r || kernel.cols() != c) {
43 if (kernelMem.size() < r * c) kernelMem.resize(r, c);
44 new (&kernel) Kernel_t(kernelMem.data(), r, c);
45 }
46 }
47
48 Kernel_t &getKernel(const Matrix::Index r, const Matrix::Index c) {
49 resizeKernel(r, c);
50 return kernel;
51 }
52
53 public:
54 /**
55 * \param mJ is the number of joints
56 * \param nJ the number of feature in the task
57 **/
58 MemoryTaskSOT(const Matrix::Index nJ = 0, const Matrix::Index mJ = 0);
59
60 void display(std::ostream &os) const;
61
62 private:
63 void initMemory(const Matrix::Index nJ, const Matrix::Index mJ);
64
65 Matrix kernelMem;
66 };
67
68 } /* namespace sot */
69 } /* namespace dynamicgraph */
70
71 #endif // __SOT_MEMORY_TASK_HH
72