00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #ifndef EIGEN_MAP_H
00027 #define EIGEN_MAP_H
00028
00047 template<typename MatrixType, int _PacketAccess>
00048 struct ei_traits<Map<MatrixType, _PacketAccess> > : public ei_traits<MatrixType>
00049 {
00050 enum {
00051 PacketAccess = _PacketAccess,
00052 Flags = ei_traits<MatrixType>::Flags & ~AlignedBit
00053 };
00054 typedef typename ei_meta_if<int(PacketAccess)==ForceAligned,
00055 Map<MatrixType, _PacketAccess>&,
00056 Map<MatrixType, ForceAligned> >::ret AlignedDerivedType;
00057 };
00058
00059 template<typename MatrixType, int PacketAccess> class Map
00060 : public MapBase<Map<MatrixType, PacketAccess> >
00061 {
00062 public:
00063
00064 _EIGEN_GENERIC_PUBLIC_INTERFACE(Map, MapBase<Map>)
00065 typedef typename ei_traits<Map>::AlignedDerivedType AlignedDerivedType;
00066
00067 inline int stride() const { return this->innerSize(); }
00068
00069 AlignedDerivedType _convertToForceAligned()
00070 {
00071 return Map<MatrixType,ForceAligned>(Base::m_data, Base::m_rows.value(), Base::m_cols.value());
00072 }
00073
00074 inline Map(const Scalar* data) : Base(data) {}
00075
00076 inline Map(const Scalar* data, int size) : Base(data, size) {}
00077
00078 inline Map(const Scalar* data, int rows, int cols) : Base(data, rows, cols) {}
00079
00080 inline void resize(int rows, int cols)
00081 {
00082 EIGEN_ONLY_USED_FOR_DEBUG(rows);
00083 EIGEN_ONLY_USED_FOR_DEBUG(cols);
00084 ei_assert(rows == this->rows());
00085 ei_assert(cols == this->cols());
00086 }
00087
00088 inline void resize(int size)
00089 {
00090 EIGEN_STATIC_ASSERT_VECTOR_ONLY(MatrixType)
00091 EIGEN_ONLY_USED_FOR_DEBUG(size);
00092 ei_assert(size == this->size());
00093 }
00094
00095 EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Map)
00096 };
00097
00104 template<typename _Scalar, int _Rows, int _Cols, int _StorageOrder, int _MaxRows, int _MaxCols>
00105 inline Matrix<_Scalar, _Rows, _Cols, _StorageOrder, _MaxRows, _MaxCols>
00106 ::Matrix(const Scalar *data)
00107 {
00108 _set_noalias(Eigen::Map<Matrix>(data));
00109 }
00110
00111 #endif // EIGEN_MAP_H