So-Bogus
A c++ sparse block matrix library aimed at Second Order cone problems
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
EigenBlockContainers.hpp
1 /*
2  * This file is part of bogus, a C++ sparse block matrix library.
3  *
4  * Copyright 2013 Gilles Daviet <gdaviet@gmail.com>
5  *
6  * This Source Code Form is subject to the terms of the Mozilla Public
7  * License, v. 2.0. If a copy of the MPL was not distributed with this
8  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 */
10 
11 #ifndef BOGUS_EIGEN_BLOCK_CONTAINERS_HPP
12 #define BOGUS_EIGEN_BLOCK_CONTAINERS_HPP
13 
14 #include <Eigen/StdVector>
15 #include "../Utils/CppTools.hpp"
16 
17 namespace bogus {
18 
19 // We do not have to use the specialized allocator if the size is dynamic or not a multiple of 16 bytes
20 template< typename Scalar, int Rows, int Cols, int Options, int MaxRows, int MaxCols >
21 struct ResizableSequenceContainer< Eigen::Matrix<Scalar, Rows, Cols, Options, MaxRows, MaxCols> >
22 {
23  typedef Eigen::Matrix<Scalar, Rows, Cols, Options, MaxRows, MaxCols> BlockType ;
24  typedef typename TypeSwapIf<
25  Rows == Eigen::Dynamic || Cols == Eigen::Dynamic || 0 != ( static_cast< std::size_t >( Rows * Cols * sizeof( Scalar ) ) & 0xf ),
26  std::vector< BlockType, Eigen::aligned_allocator<BlockType> >,
27  std::vector< BlockType > >::First Type ;
28 } ;
29 
30 
31 } //namespace bogus
32 
33 #endif
Definition: CppTools.hpp:35
Default container type, that should resizable and use contiguous storage.
Definition: Traits.hpp:23