~siretart/ubuntu/utopic/blender/libav10

« back to all changes in this revision

Viewing changes to extern/Eigen3/Eigen/src/Core/NestByValue.h

  • Committer: Package Import Robot
  • Author(s): Matteo F. Vescovi
  • Date: 2012-07-23 08:54:18 UTC
  • mfrom: (14.2.16 sid)
  • mto: (14.2.19 sid)
  • mto: This revision was merged to the branch mainline in revision 42.
  • Revision ID: package-import@ubuntu.com-20120723085418-9foz30v6afaf5ffs
Tags: 2.63a-2
* debian/: Cycles support added (Closes: #658075)
  For now, this top feature has been enabled only
  on [any-amd64 any-i386] architectures because
  of OpenImageIO failing on all others
* debian/: scripts installation path changed
  from /usr/lib to /usr/share:
  + debian/patches/: patchset re-worked for path changing
  + debian/control: "Breaks" field added on yafaray-exporter

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// This file is part of Eigen, a lightweight C++ template library
 
2
// for linear algebra.
 
3
//
 
4
// Copyright (C) 2008 Gael Guennebaud <gael.guennebaud@inria.fr>
 
5
// Copyright (C) 2006-2008 Benoit Jacob <jacob.benoit.1@gmail.com>
 
6
//
 
7
// Eigen is free software; you can redistribute it and/or
 
8
// modify it under the terms of the GNU Lesser General Public
 
9
// License as published by the Free Software Foundation; either
 
10
// version 3 of the License, or (at your option) any later version.
 
11
//
 
12
// Alternatively, you can redistribute it and/or
 
13
// modify it under the terms of the GNU General Public License as
 
14
// published by the Free Software Foundation; either version 2 of
 
15
// the License, or (at your option) any later version.
 
16
//
 
17
// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
 
18
// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 
19
// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
 
20
// GNU General Public License for more details.
 
21
//
 
22
// You should have received a copy of the GNU Lesser General Public
 
23
// License and a copy of the GNU General Public License along with
 
24
// Eigen. If not, see <http://www.gnu.org/licenses/>.
 
25
 
 
26
#ifndef EIGEN_NESTBYVALUE_H
 
27
#define EIGEN_NESTBYVALUE_H
 
28
 
 
29
/** \class NestByValue
 
30
  * \ingroup Core_Module
 
31
  *
 
32
  * \brief Expression which must be nested by value
 
33
  *
 
34
  * \param ExpressionType the type of the object of which we are requiring nesting-by-value
 
35
  *
 
36
  * This class is the return type of MatrixBase::nestByValue()
 
37
  * and most of the time this is the only way it is used.
 
38
  *
 
39
  * \sa MatrixBase::nestByValue()
 
40
  */
 
41
 
 
42
namespace internal {
 
43
template<typename ExpressionType>
 
44
struct traits<NestByValue<ExpressionType> > : public traits<ExpressionType>
 
45
{};
 
46
}
 
47
 
 
48
template<typename ExpressionType> class NestByValue
 
49
  : public internal::dense_xpr_base< NestByValue<ExpressionType> >::type
 
50
{
 
51
  public:
 
52
 
 
53
    typedef typename internal::dense_xpr_base<NestByValue>::type Base;
 
54
    EIGEN_DENSE_PUBLIC_INTERFACE(NestByValue)
 
55
 
 
56
    inline NestByValue(const ExpressionType& matrix) : m_expression(matrix) {}
 
57
 
 
58
    inline Index rows() const { return m_expression.rows(); }
 
59
    inline Index cols() const { return m_expression.cols(); }
 
60
    inline Index outerStride() const { return m_expression.outerStride(); }
 
61
    inline Index innerStride() const { return m_expression.innerStride(); }
 
62
 
 
63
    inline const CoeffReturnType coeff(Index row, Index col) const
 
64
    {
 
65
      return m_expression.coeff(row, col);
 
66
    }
 
67
 
 
68
    inline Scalar& coeffRef(Index row, Index col)
 
69
    {
 
70
      return m_expression.const_cast_derived().coeffRef(row, col);
 
71
    }
 
72
 
 
73
    inline const CoeffReturnType coeff(Index index) const
 
74
    {
 
75
      return m_expression.coeff(index);
 
76
    }
 
77
 
 
78
    inline Scalar& coeffRef(Index index)
 
79
    {
 
80
      return m_expression.const_cast_derived().coeffRef(index);
 
81
    }
 
82
 
 
83
    template<int LoadMode>
 
84
    inline const PacketScalar packet(Index row, Index col) const
 
85
    {
 
86
      return m_expression.template packet<LoadMode>(row, col);
 
87
    }
 
88
 
 
89
    template<int LoadMode>
 
90
    inline void writePacket(Index row, Index col, const PacketScalar& x)
 
91
    {
 
92
      m_expression.const_cast_derived().template writePacket<LoadMode>(row, col, x);
 
93
    }
 
94
 
 
95
    template<int LoadMode>
 
96
    inline const PacketScalar packet(Index index) const
 
97
    {
 
98
      return m_expression.template packet<LoadMode>(index);
 
99
    }
 
100
 
 
101
    template<int LoadMode>
 
102
    inline void writePacket(Index index, const PacketScalar& x)
 
103
    {
 
104
      m_expression.const_cast_derived().template writePacket<LoadMode>(index, x);
 
105
    }
 
106
 
 
107
    operator const ExpressionType&() const { return m_expression; }
 
108
 
 
109
  protected:
 
110
    const ExpressionType m_expression;
 
111
};
 
112
 
 
113
/** \returns an expression of the temporary version of *this.
 
114
  */
 
115
template<typename Derived>
 
116
inline const NestByValue<Derived>
 
117
DenseBase<Derived>::nestByValue() const
 
118
{
 
119
  return NestByValue<Derived>(derived());
 
120
}
 
121
 
 
122
#endif // EIGEN_NESTBYVALUE_H