~siretart/ubuntu/utopic/blender/libav10

« back to all changes in this revision

Viewing changes to extern/Eigen3/Eigen/src/misc/Kernel.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) 2009 Benoit Jacob <jacob.benoit.1@gmail.com>
 
5
//
 
6
// Eigen is free software; you can redistribute it and/or
 
7
// modify it under the terms of the GNU Lesser General Public
 
8
// License as published by the Free Software Foundation; either
 
9
// version 3 of the License, or (at your option) any later version.
 
10
//
 
11
// Alternatively, you can redistribute it and/or
 
12
// modify it under the terms of the GNU General Public License as
 
13
// published by the Free Software Foundation; either version 2 of
 
14
// the License, or (at your option) any later version.
 
15
//
 
16
// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
 
17
// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 
18
// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
 
19
// GNU General Public License for more details.
 
20
//
 
21
// You should have received a copy of the GNU Lesser General Public
 
22
// License and a copy of the GNU General Public License along with
 
23
// Eigen. If not, see <http://www.gnu.org/licenses/>.
 
24
 
 
25
#ifndef EIGEN_MISC_KERNEL_H
 
26
#define EIGEN_MISC_KERNEL_H
 
27
 
 
28
namespace internal {
 
29
 
 
30
/** \class kernel_retval_base
 
31
  *
 
32
  */
 
33
template<typename DecompositionType>
 
34
struct traits<kernel_retval_base<DecompositionType> >
 
35
{
 
36
  typedef typename DecompositionType::MatrixType MatrixType;
 
37
  typedef Matrix<
 
38
    typename MatrixType::Scalar,
 
39
    MatrixType::ColsAtCompileTime, // the number of rows in the "kernel matrix"
 
40
                                   // is the number of cols of the original matrix
 
41
                                   // so that the product "matrix * kernel = zero" makes sense
 
42
    Dynamic,                       // we don't know at compile-time the dimension of the kernel
 
43
    MatrixType::Options,
 
44
    MatrixType::MaxColsAtCompileTime, // see explanation for 2nd template parameter
 
45
    MatrixType::MaxColsAtCompileTime // the kernel is a subspace of the domain space,
 
46
                                     // whose dimension is the number of columns of the original matrix
 
47
  > ReturnType;
 
48
};
 
49
 
 
50
template<typename _DecompositionType> struct kernel_retval_base
 
51
 : public ReturnByValue<kernel_retval_base<_DecompositionType> >
 
52
{
 
53
  typedef _DecompositionType DecompositionType;
 
54
  typedef ReturnByValue<kernel_retval_base> Base;
 
55
  typedef typename Base::Index Index;
 
56
 
 
57
  kernel_retval_base(const DecompositionType& dec)
 
58
    : m_dec(dec),
 
59
      m_rank(dec.rank()),
 
60
      m_cols(m_rank==dec.cols() ? 1 : dec.cols() - m_rank)
 
61
  {}
 
62
 
 
63
  inline Index rows() const { return m_dec.cols(); }
 
64
  inline Index cols() const { return m_cols; }
 
65
  inline Index rank() const { return m_rank; }
 
66
  inline const DecompositionType& dec() const { return m_dec; }
 
67
 
 
68
  template<typename Dest> inline void evalTo(Dest& dst) const
 
69
  {
 
70
    static_cast<const kernel_retval<DecompositionType>*>(this)->evalTo(dst);
 
71
  }
 
72
 
 
73
  protected:
 
74
    const DecompositionType& m_dec;
 
75
    Index m_rank, m_cols;
 
76
};
 
77
 
 
78
} // end namespace internal
 
79
 
 
80
#define EIGEN_MAKE_KERNEL_HELPERS(DecompositionType) \
 
81
  typedef typename DecompositionType::MatrixType MatrixType; \
 
82
  typedef typename MatrixType::Scalar Scalar; \
 
83
  typedef typename MatrixType::RealScalar RealScalar; \
 
84
  typedef typename MatrixType::Index Index; \
 
85
  typedef Eigen::internal::kernel_retval_base<DecompositionType> Base; \
 
86
  using Base::dec; \
 
87
  using Base::rank; \
 
88
  using Base::rows; \
 
89
  using Base::cols; \
 
90
  kernel_retval(const DecompositionType& dec) : Base(dec) {}
 
91
 
 
92
#endif // EIGEN_MISC_KERNEL_H