MCPcopy Create free account
hub / github.com/TinyMPC/TinyMPC / CompressedStorage

Class CompressedStorage

include/Eigen/Eigen/src/SparseCore/CompressedStorage.h:24–219  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

22 */
23template<typename Scalar_,typename StorageIndex_>
24class CompressedStorage
25{
26 public:
27
28 typedef Scalar_ Scalar;
29 typedef StorageIndex_ StorageIndex;
30
31 protected:
32
33 typedef typename NumTraits<Scalar>::Real RealScalar;
34
35 public:
36
37 CompressedStorage()
38 : m_values(0), m_indices(0), m_size(0), m_allocatedSize(0)
39 {}
40
41 explicit CompressedStorage(Index size)
42 : m_values(0), m_indices(0), m_size(0), m_allocatedSize(0)
43 {
44 resize(size);
45 }
46
47 CompressedStorage(const CompressedStorage& other)
48 : m_values(0), m_indices(0), m_size(0), m_allocatedSize(0)
49 {
50 *this = other;
51 }
52
53 CompressedStorage& operator=(const CompressedStorage& other)
54 {
55 resize(other.size());
56 if(other.size()>0)
57 {
58 internal::smart_copy(other.m_values, other.m_values + m_size, m_values);
59 internal::smart_copy(other.m_indices, other.m_indices + m_size, m_indices);
60 }
61 return *this;
62 }
63
64 void swap(CompressedStorage& other)
65 {
66 std::swap(m_values, other.m_values);
67 std::swap(m_indices, other.m_indices);
68 std::swap(m_size, other.m_size);
69 std::swap(m_allocatedSize, other.m_allocatedSize);
70 }
71
72 ~CompressedStorage()
73 {
74 conditional_aligned_delete_auto<Scalar, true>(m_values, m_allocatedSize);
75 conditional_aligned_delete_auto<StorageIndex, true>(m_indices, m_allocatedSize);
76 }
77
78 void reserve(Index size)
79 {
80 Index newAllocatedSize = m_size + size;
81 if (newAllocatedSize > m_allocatedSize)

Callers

nothing calls this directly

Calls 4

smart_copyFunction · 0.85
smart_memmoveFunction · 0.85
resizeFunction · 0.70
sizeMethod · 0.45

Tested by

no test coverage detected