1c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath// This file is part of Eigen, a lightweight C++ template library
2c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath// for linear algebra.
3c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath//
4c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath// Copyright (C) 2007-2010 Benoit Jacob <jacob.benoit.1@gmail.com>
5c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath// Copyright (C) 2008 Gael Guennebaud <gael.guennebaud@inria.fr>
6c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath//
7c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath// This Source Code Form is subject to the terms of the Mozilla
8c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath// Public License v. 2.0. If a copy of the MPL was not distributed
9c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
10c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath
11c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath#ifndef EIGEN_MAP_H
12c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath#define EIGEN_MAP_H
13c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath
14c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamathnamespace Eigen {
15c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath
16c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath/** \class Map
17c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath  * \ingroup Core_Module
18c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath  *
19c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath  * \brief A matrix or vector expression mapping an existing array of data.
20c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath  *
21c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath  * \tparam PlainObjectType the equivalent matrix type of the mapped data
22c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath  * \tparam MapOptions specifies whether the pointer is \c #Aligned, or \c #Unaligned.
23c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath  *                The default is \c #Unaligned.
24c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath  * \tparam StrideType optionally specifies strides. By default, Map assumes the memory layout
25c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath  *                   of an ordinary, contiguous array. This can be overridden by specifying strides.
26c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath  *                   The type passed here must be a specialization of the Stride template, see examples below.
27c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath  *
28c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath  * This class represents a matrix or vector expression mapping an existing array of data.
29c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath  * It can be used to let Eigen interface without any overhead with non-Eigen data structures,
30c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath  * such as plain C arrays or structures from other libraries. By default, it assumes that the
31c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath  * data is laid out contiguously in memory. You can however override this by explicitly specifying
32c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath  * inner and outer strides.
33c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath  *
34c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath  * Here's an example of simply mapping a contiguous array as a \ref TopicStorageOrders "column-major" matrix:
35c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath  * \include Map_simple.cpp
36c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath  * Output: \verbinclude Map_simple.out
37c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath  *
38c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath  * If you need to map non-contiguous arrays, you can do so by specifying strides:
39c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath  *
40c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath  * Here's an example of mapping an array as a vector, specifying an inner stride, that is, the pointer
41c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath  * increment between two consecutive coefficients. Here, we're specifying the inner stride as a compile-time
42c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath  * fixed value.
43c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath  * \include Map_inner_stride.cpp
44c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath  * Output: \verbinclude Map_inner_stride.out
45c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath  *
46c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath  * Here's an example of mapping an array while specifying an outer stride. Here, since we're mapping
47c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath  * as a column-major matrix, 'outer stride' means the pointer increment between two consecutive columns.
48c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath  * Here, we're specifying the outer stride as a runtime parameter. Note that here \c OuterStride<> is
49c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath  * a short version of \c OuterStride<Dynamic> because the default template parameter of OuterStride
50c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath  * is  \c Dynamic
51c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath  * \include Map_outer_stride.cpp
52c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath  * Output: \verbinclude Map_outer_stride.out
53c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath  *
54c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath  * For more details and for an example of specifying both an inner and an outer stride, see class Stride.
55c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath  *
56c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath  * \b Tip: to change the array of data mapped by a Map object, you can use the C++
57c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath  * placement new syntax:
58c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath  *
59c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath  * Example: \include Map_placement_new.cpp
60c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath  * Output: \verbinclude Map_placement_new.out
61c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath  *
62c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath  * This class is the return type of PlainObjectBase::Map() but can also be used directly.
63c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath  *
64c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath  * \sa PlainObjectBase::Map(), \ref TopicStorageOrders
65c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath  */
66c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath
67c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamathnamespace internal {
68c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamathtemplate<typename PlainObjectType, int MapOptions, typename StrideType>
69c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamathstruct traits<Map<PlainObjectType, MapOptions, StrideType> >
70c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath  : public traits<PlainObjectType>
71c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath{
72c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath  typedef traits<PlainObjectType> TraitsBase;
73c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath  typedef typename PlainObjectType::Index Index;
74c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath  typedef typename PlainObjectType::Scalar Scalar;
75c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath  enum {
76c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    InnerStrideAtCompileTime = StrideType::InnerStrideAtCompileTime == 0
77c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath                             ? int(PlainObjectType::InnerStrideAtCompileTime)
78c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath                             : int(StrideType::InnerStrideAtCompileTime),
79c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    OuterStrideAtCompileTime = StrideType::OuterStrideAtCompileTime == 0
80c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath                             ? int(PlainObjectType::OuterStrideAtCompileTime)
81c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath                             : int(StrideType::OuterStrideAtCompileTime),
82c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    HasNoInnerStride = InnerStrideAtCompileTime == 1,
83c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    HasNoOuterStride = StrideType::OuterStrideAtCompileTime == 0,
84c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    HasNoStride = HasNoInnerStride && HasNoOuterStride,
85c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    IsAligned = bool(EIGEN_ALIGN) && ((int(MapOptions)&Aligned)==Aligned),
86c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    IsDynamicSize = PlainObjectType::SizeAtCompileTime==Dynamic,
87c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    KeepsPacketAccess = bool(HasNoInnerStride)
88c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath                        && ( bool(IsDynamicSize)
89c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath                           || HasNoOuterStride
90c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath                           || ( OuterStrideAtCompileTime!=Dynamic
91c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath                           && ((static_cast<int>(sizeof(Scalar))*OuterStrideAtCompileTime)%16)==0 ) ),
92c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    Flags0 = TraitsBase::Flags & (~NestByRefBit),
93c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    Flags1 = IsAligned ? (int(Flags0) | AlignedBit) : (int(Flags0) & ~AlignedBit),
94c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    Flags2 = (bool(HasNoStride) || bool(PlainObjectType::IsVectorAtCompileTime))
95c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath           ? int(Flags1) : int(Flags1 & ~LinearAccessBit),
96c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    Flags3 = is_lvalue<PlainObjectType>::value ? int(Flags2) : (int(Flags2) & ~LvalueBit),
97c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    Flags = KeepsPacketAccess ? int(Flags3) : (int(Flags3) & ~PacketAccessBit)
98c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath  };
99c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamathprivate:
100c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath  enum { Options }; // Expressions don't have Options
101c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath};
102c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath}
103c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath
104c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamathtemplate<typename PlainObjectType, int MapOptions, typename StrideType> class Map
105c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath  : public MapBase<Map<PlainObjectType, MapOptions, StrideType> >
106c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath{
107c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath  public:
108c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath
109c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    typedef MapBase<Map> Base;
110c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    EIGEN_DENSE_PUBLIC_INTERFACE(Map)
111c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath
112c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    typedef typename Base::PointerType PointerType;
113c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath#if EIGEN2_SUPPORT_STAGE <= STAGE30_FULL_EIGEN3_API
114c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    typedef const Scalar* PointerArgType;
115c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    inline PointerType cast_to_pointer_type(PointerArgType ptr) { return const_cast<PointerType>(ptr); }
116c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath#else
117c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    typedef PointerType PointerArgType;
118c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    inline PointerType cast_to_pointer_type(PointerArgType ptr) { return ptr; }
119c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath#endif
120c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath
121c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    inline Index innerStride() const
122c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    {
123c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath      return StrideType::InnerStrideAtCompileTime != 0 ? m_stride.inner() : 1;
124c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    }
125c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath
126c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    inline Index outerStride() const
127c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    {
128c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath      return StrideType::OuterStrideAtCompileTime != 0 ? m_stride.outer()
129c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath           : IsVectorAtCompileTime ? this->size()
130c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath           : int(Flags)&RowMajorBit ? this->cols()
131c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath           : this->rows();
132c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    }
133c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath
134c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    /** Constructor in the fixed-size case.
135c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath      *
1367faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez      * \param dataPtr pointer to the array to map
1377faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez      * \param a_stride optional Stride object, passing the strides.
138c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath      */
1397faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez    inline Map(PointerArgType dataPtr, const StrideType& a_stride = StrideType())
1407faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez      : Base(cast_to_pointer_type(dataPtr)), m_stride(a_stride)
141c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    {
142c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath      PlainObjectType::Base::_check_template_params();
143c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    }
144c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath
145c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    /** Constructor in the dynamic-size vector case.
146c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath      *
1477faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez      * \param dataPtr pointer to the array to map
1487faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez      * \param a_size the size of the vector expression
1497faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez      * \param a_stride optional Stride object, passing the strides.
150c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath      */
1517faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez    inline Map(PointerArgType dataPtr, Index a_size, const StrideType& a_stride = StrideType())
1527faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez      : Base(cast_to_pointer_type(dataPtr), a_size), m_stride(a_stride)
153c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    {
154c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath      PlainObjectType::Base::_check_template_params();
155c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    }
156c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath
157c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    /** Constructor in the dynamic-size matrix case.
158c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath      *
1597faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez      * \param dataPtr pointer to the array to map
1607faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez      * \param nbRows the number of rows of the matrix expression
1617faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez      * \param nbCols the number of columns of the matrix expression
1627faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez      * \param a_stride optional Stride object, passing the strides.
163c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath      */
1647faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez    inline Map(PointerArgType dataPtr, Index nbRows, Index nbCols, const StrideType& a_stride = StrideType())
1657faaa9f3f0df9d23790277834d426c3d992ac3baCarlos Hernandez      : Base(cast_to_pointer_type(dataPtr), nbRows, nbCols), m_stride(a_stride)
166c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    {
167c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath      PlainObjectType::Base::_check_template_params();
168c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    }
169c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath
170c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Map)
171c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath
172c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath  protected:
173c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath    StrideType m_stride;
174c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath};
175c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath
176c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamathtemplate<typename _Scalar, int _Rows, int _Cols, int _Options, int _MaxRows, int _MaxCols>
177c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamathinline Array<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols>
178c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath  ::Array(const Scalar *data)
179c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath{
180c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath  this->_set_noalias(Eigen::Map<const Array>(data));
181c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath}
182c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath
183c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamathtemplate<typename _Scalar, int _Rows, int _Cols, int _Options, int _MaxRows, int _MaxCols>
184c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamathinline Matrix<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols>
185c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath  ::Matrix(const Scalar *data)
186c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath{
187c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath  this->_set_noalias(Eigen::Map<const Matrix>(data));
188c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath}
189c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath
190c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath} // end namespace Eigen
191c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath
192c981c48f5bc9aefeffc0bcb0cc3934c2fae179ddNarayan Kamath#endif // EIGEN_MAP_H
193