12 #ifndef EIGEN_MATRIXSTORAGE_H 13 #define EIGEN_MATRIXSTORAGE_H 15 #ifdef EIGEN_DENSE_STORAGE_CTOR_PLUGIN 16 #define EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN EIGEN_DENSE_STORAGE_CTOR_PLUGIN; 18 #define EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN 27 template<
typename T,
int Size>
void check_static_allocation_size()
30 #if EIGEN_STACK_ALLOCATION_LIMIT 31 EIGEN_STATIC_ASSERT(Size *
sizeof(
T) <= EIGEN_STACK_ALLOCATION_LIMIT, OBJECT_ALLOCATED_ON_STACK_IS_TOO_BIG);
39 template <
typename T,
int Size,
int MatrixOrArrayOptions,
40 int Alignment = (MatrixOrArrayOptions&
DontAlign) ? 0
41 : (((Size*
sizeof(
T))%16)==0) ? 16
49 check_static_allocation_size<T,Size>();
54 check_static_allocation_size<T,Size>();
58 #if defined(EIGEN_DISABLE_UNALIGNED_ARRAY_ASSERT) 59 #define EIGEN_MAKE_UNALIGNED_ARRAY_ASSERT(sizemask) 60 #elif EIGEN_GNUC_AT_LEAST(4,7) 64 template<
typename PtrType>
65 EIGEN_ALWAYS_INLINE PtrType eigen_unaligned_array_assert_workaround_gcc47(PtrType array) {
return array; }
66 #define EIGEN_MAKE_UNALIGNED_ARRAY_ASSERT(sizemask) \ 67 eigen_assert((reinterpret_cast<size_t>(eigen_unaligned_array_assert_workaround_gcc47(array)) & sizemask) == 0 \ 68 && "this assertion is explained here: " \ 69 "http://eigen.tuxfamily.org/dox-devel/group__TopicUnalignedArrayAssert.html" \ 70 " **** READ THIS WEB PAGE !!! ****"); 72 #define EIGEN_MAKE_UNALIGNED_ARRAY_ASSERT(sizemask) \ 73 eigen_assert((reinterpret_cast<size_t>(array) & sizemask) == 0 \ 74 && "this assertion is explained here: " \ 75 "http://eigen.tuxfamily.org/dox-devel/group__TopicUnalignedArrayAssert.html" \ 76 " **** READ THIS WEB PAGE !!! ****"); 79 template <
typename T,
int Size,
int MatrixOrArrayOptions>
82 EIGEN_USER_ALIGN16
T array[Size];
86 EIGEN_MAKE_UNALIGNED_ARRAY_ASSERT(0xf);
87 check_static_allocation_size<T,Size>();
92 check_static_allocation_size<T,Size>();
96 template <
typename T,
int MatrixOrArrayOptions,
int Alignment>
99 EIGEN_USER_ALIGN16
T array[1];
118 template<
typename T,
int Size,
int _Rows,
int _Cols,
int _Options>
class DenseStorage;
121 template<
typename T,
int Size,
int _Rows,
int _Cols,
int _Options>
class DenseStorage
128 DenseStorage(
const DenseStorage& other) : m_data(other.m_data) {}
129 DenseStorage& operator=(
const DenseStorage& other)
131 if (
this != &other) m_data = other.m_data;
134 DenseStorage(DenseIndex,DenseIndex,DenseIndex) {}
135 void swap(DenseStorage& other) { std::swap(m_data,other.m_data); }
136 static DenseIndex rows(
void) {
return _Rows;}
137 static DenseIndex cols(
void) {
return _Cols;}
138 void conservativeResize(DenseIndex,DenseIndex,DenseIndex) {}
139 void resize(DenseIndex,DenseIndex,DenseIndex) {}
140 const T *data()
const {
return m_data.array; }
141 T *data() {
return m_data.array; }
150 DenseStorage(
const DenseStorage&) {}
151 DenseStorage& operator=(
const DenseStorage&) {
return *
this; }
152 DenseStorage(DenseIndex,DenseIndex,DenseIndex) {}
153 void swap(DenseStorage& ) {}
154 static DenseIndex rows(
void) {
return _Rows;}
155 static DenseIndex cols(
void) {
return _Cols;}
156 void conservativeResize(DenseIndex,DenseIndex,DenseIndex) {}
157 void resize(DenseIndex,DenseIndex,DenseIndex) {}
158 const T *data()
const {
return 0; }
159 T *data() {
return 0; }
179 DenseStorage() : m_rows(0), m_cols(0) {}
182 DenseStorage(
const DenseStorage& other) : m_data(other.m_data), m_rows(other.m_rows), m_cols(other.m_cols) {}
183 DenseStorage& operator=(
const DenseStorage& other)
187 m_data = other.m_data;
188 m_rows = other.m_rows;
189 m_cols = other.m_cols;
193 DenseStorage(DenseIndex, DenseIndex nbRows, DenseIndex nbCols) : m_rows(nbRows), m_cols(nbCols) {}
194 void swap(DenseStorage& other)
195 { std::swap(m_data,other.m_data); std::swap(m_rows,other.m_rows); std::swap(m_cols,other.m_cols); }
196 DenseIndex rows()
const {
return m_rows;}
197 DenseIndex cols()
const {
return m_cols;}
198 void conservativeResize(DenseIndex, DenseIndex nbRows, DenseIndex nbCols) { m_rows = nbRows; m_cols = nbCols; }
199 void resize(DenseIndex, DenseIndex nbRows, DenseIndex nbCols) { m_rows = nbRows; m_cols = nbCols; }
200 const T *data()
const {
return m_data.array; }
201 T *data() {
return m_data.array; }
210 DenseStorage() : m_rows(0) {}
213 DenseStorage(
const DenseStorage& other) : m_data(other.m_data), m_rows(other.m_rows) {}
214 DenseStorage& operator=(
const DenseStorage& other)
218 m_data = other.m_data;
219 m_rows = other.m_rows;
223 DenseStorage(DenseIndex, DenseIndex nbRows, DenseIndex) : m_rows(nbRows) {}
224 void swap(DenseStorage& other) { std::swap(m_data,other.m_data); std::swap(m_rows,other.m_rows); }
225 DenseIndex rows(
void)
const {
return m_rows;}
226 DenseIndex cols(
void)
const {
return _Cols;}
227 void conservativeResize(DenseIndex, DenseIndex nbRows, DenseIndex) { m_rows = nbRows; }
228 void resize(DenseIndex, DenseIndex nbRows, DenseIndex) { m_rows = nbRows; }
229 const T *data()
const {
return m_data.array; }
230 T *data() {
return m_data.array; }
239 DenseStorage() : m_cols(0) {}
242 DenseStorage(
const DenseStorage& other) : m_data(other.m_data), m_cols(other.m_cols) {}
243 DenseStorage& operator=(
const DenseStorage& other)
247 m_data = other.m_data;
248 m_cols = other.m_cols;
252 DenseStorage(DenseIndex, DenseIndex, DenseIndex nbCols) : m_cols(nbCols) {}
253 void swap(DenseStorage& other) { std::swap(m_data,other.m_data); std::swap(m_cols,other.m_cols); }
254 DenseIndex rows(
void)
const {
return _Rows;}
255 DenseIndex cols(
void)
const {
return m_cols;}
256 void conservativeResize(DenseIndex, DenseIndex, DenseIndex nbCols) { m_cols = nbCols; }
257 void resize(DenseIndex, DenseIndex, DenseIndex nbCols) { m_cols = nbCols; }
258 const T *data()
const {
return m_data.array; }
259 T *data() {
return m_data.array; }
269 DenseStorage() : m_data(0), m_rows(0), m_cols(0) {}
271 : m_data(0), m_rows(0), m_cols(0) {}
272 DenseStorage(DenseIndex
size, DenseIndex nbRows, DenseIndex nbCols)
273 : m_data(internal::conditional_aligned_new_auto<
T,(_Options&
DontAlign)==0>(size)), m_rows(nbRows), m_cols(nbCols)
274 { EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN }
275 #ifdef EIGEN_HAVE_RVALUE_REFERENCES 276 DenseStorage(DenseStorage&& other)
277 : m_data(std::move(other.m_data))
278 , m_rows(std::move(other.m_rows))
279 , m_cols(std::move(other.m_cols))
281 other.m_data =
nullptr;
283 DenseStorage& operator=(DenseStorage&& other)
286 swap(m_data, other.m_data);
287 swap(m_rows, other.m_rows);
288 swap(m_cols, other.m_cols);
292 ~DenseStorage() { internal::conditional_aligned_delete_auto<T,(_Options&DontAlign)==0>(m_data, m_rows*m_cols); }
293 void swap(DenseStorage& other)
294 { std::swap(m_data,other.m_data); std::swap(m_rows,other.m_rows); std::swap(m_cols,other.m_cols); }
295 DenseIndex rows(
void)
const {
return m_rows;}
296 DenseIndex cols(
void)
const {
return m_cols;}
297 void conservativeResize(DenseIndex size, DenseIndex nbRows, DenseIndex nbCols)
299 m_data = internal::conditional_aligned_realloc_new_auto<T,(_Options&DontAlign)==0>(m_data,
size, m_rows*m_cols);
303 void resize(DenseIndex size, DenseIndex nbRows, DenseIndex nbCols)
305 if(size != m_rows*m_cols)
307 internal::conditional_aligned_delete_auto<T,(_Options&DontAlign)==0>(m_data, m_rows*m_cols);
309 m_data = internal::conditional_aligned_new_auto<T,(_Options&DontAlign)==0>(
size);
312 EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN
317 const T *data()
const {
return m_data; }
318 T *data() {
return m_data; }
320 DenseStorage(
const DenseStorage&);
321 DenseStorage& operator=(
const DenseStorage&);
330 DenseStorage() : m_data(0), m_cols(0) {}
332 DenseStorage(DenseIndex
size, DenseIndex, DenseIndex nbCols) : m_data(internal::conditional_aligned_new_auto<
T,(_Options&
DontAlign)==0>(size)), m_cols(nbCols)
333 { EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN }
334 #ifdef EIGEN_HAVE_RVALUE_REFERENCES 335 DenseStorage(DenseStorage&& other)
336 : m_data(std::move(other.m_data))
337 , m_cols(std::move(other.m_cols))
339 other.m_data =
nullptr;
341 DenseStorage& operator=(DenseStorage&& other)
344 swap(m_data, other.m_data);
345 swap(m_cols, other.m_cols);
349 ~DenseStorage() { internal::conditional_aligned_delete_auto<T,(_Options&DontAlign)==0>(m_data, _Rows*m_cols); }
350 void swap(DenseStorage& other) { std::swap(m_data,other.m_data); std::swap(m_cols,other.m_cols); }
351 static DenseIndex rows(
void) {
return _Rows;}
352 DenseIndex cols(
void)
const {
return m_cols;}
353 void conservativeResize(DenseIndex size, DenseIndex, DenseIndex nbCols)
355 m_data = internal::conditional_aligned_realloc_new_auto<T,(_Options&DontAlign)==0>(m_data,
size, _Rows*m_cols);
358 EIGEN_STRONG_INLINE
void resize(DenseIndex size, DenseIndex, DenseIndex nbCols)
360 if(size != _Rows*m_cols)
362 internal::conditional_aligned_delete_auto<T,(_Options&DontAlign)==0>(m_data, _Rows*m_cols);
364 m_data = internal::conditional_aligned_new_auto<T,(_Options&DontAlign)==0>(
size);
367 EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN
371 const T *data()
const {
return m_data; }
372 T *data() {
return m_data; }
374 DenseStorage(
const DenseStorage&);
375 DenseStorage& operator=(
const DenseStorage&);
384 DenseStorage() : m_data(0), m_rows(0) {}
386 DenseStorage(DenseIndex
size, DenseIndex nbRows, DenseIndex) : m_data(internal::conditional_aligned_new_auto<
T,(_Options&
DontAlign)==0>(size)), m_rows(nbRows)
387 { EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN }
388 #ifdef EIGEN_HAVE_RVALUE_REFERENCES 389 DenseStorage(DenseStorage&& other)
390 : m_data(std::move(other.m_data))
391 , m_rows(std::move(other.m_rows))
393 other.m_data =
nullptr;
395 DenseStorage& operator=(DenseStorage&& other)
398 swap(m_data, other.m_data);
399 swap(m_rows, other.m_rows);
403 ~DenseStorage() { internal::conditional_aligned_delete_auto<T,(_Options&DontAlign)==0>(m_data, _Cols*m_rows); }
404 void swap(DenseStorage& other) { std::swap(m_data,other.m_data); std::swap(m_rows,other.m_rows); }
405 DenseIndex rows(
void)
const {
return m_rows;}
406 static DenseIndex cols(
void) {
return _Cols;}
407 void conservativeResize(DenseIndex size, DenseIndex nbRows, DenseIndex)
409 m_data = internal::conditional_aligned_realloc_new_auto<T,(_Options&DontAlign)==0>(m_data,
size, m_rows*_Cols);
412 EIGEN_STRONG_INLINE
void resize(DenseIndex size, DenseIndex nbRows, DenseIndex)
414 if(size != m_rows*_Cols)
416 internal::conditional_aligned_delete_auto<T,(_Options&DontAlign)==0>(m_data, _Cols*m_rows);
418 m_data = internal::conditional_aligned_new_auto<T,(_Options&DontAlign)==0>(
size);
421 EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN
425 const T *data()
const {
return m_data; }
426 T *data() {
return m_data; }
428 DenseStorage(
const DenseStorage&);
429 DenseStorage& operator=(
const DenseStorage&);
434 #endif // EIGEN_MATRIX_H Definition: DenseStorage.h:325
Definition: DenseStorage.h:80
Definition: DenseStorage.h:118
iterative scaling algorithm to equilibrate rows and column norms in matrices
Definition: TestIMU_Common.h:87
Definition: DenseStorage.h:234
Definition: DenseStorage.h:169
Definition: DenseStorage.h:173
detail::size< coerce_list< Ts... >> size
Get the size of a list (number of elements.)
Definition: Size.h:56
Definition: DenseStorage.h:205
Definition: DenseStorage.h:379
Definition: DenseStorage.h:166
Definition: BandTriangularSolver.h:13
Don't require alignment for the matrix itself (the array of coefficients, if dynamically allocated...
Definition: Constants.h:270
Definition: DenseStorage.h:97
Definition: DenseStorage.h:43
Definition: DenseStorage.h:25
Definition: DenseStorage.h:145
Definition: DenseStorage.h:163
Definition: DenseStorage.h:263