~ubuntu-branches/ubuntu/saucy/blender/saucy-proposed

« back to all changes in this revision

Viewing changes to extern/Eigen3/Eigen/src/Sparse/SparseTriangularView.h

  • Committer: Package Import Robot
  • Author(s): Jeremy Bicha
  • Date: 2013-03-06 12:08:47 UTC
  • mfrom: (1.5.1) (14.1.8 experimental)
  • Revision ID: package-import@ubuntu.com-20130306120847-frjfaryb2zrotwcg
Tags: 2.66a-1ubuntu1
* Resynchronize with Debian (LP: #1076930, #1089256, #1052743, #999024,
  #1122888, #1147084)
* debian/control:
  - Lower build-depends on libavcodec-dev since we're not
    doing the libav9 transition in Ubuntu yet

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 Gael Guennebaud <gael.guennebaud@inria.fr>
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_SPARSE_TRIANGULARVIEW_H
26
 
#define EIGEN_SPARSE_TRIANGULARVIEW_H
27
 
 
28
 
namespace internal {
29
 
  
30
 
template<typename MatrixType, int Mode>
31
 
struct traits<SparseTriangularView<MatrixType,Mode> >
32
 
: public traits<MatrixType>
33
 
{};
34
 
 
35
 
} // namespace internal
36
 
 
37
 
template<typename MatrixType, int Mode> class SparseTriangularView
38
 
  : public SparseMatrixBase<SparseTriangularView<MatrixType,Mode> >
39
 
{
40
 
    enum { SkipFirst = (Mode==Lower && !(MatrixType::Flags&RowMajorBit))
41
 
                    || (Mode==Upper &&  (MatrixType::Flags&RowMajorBit)) };
42
 
  public:
43
 
    
44
 
    EIGEN_SPARSE_PUBLIC_INTERFACE(SparseTriangularView)
45
 
 
46
 
    class InnerIterator;
47
 
 
48
 
    inline Index rows() const { return m_matrix.rows(); }
49
 
    inline Index cols() const { return m_matrix.cols(); }
50
 
 
51
 
    typedef typename internal::conditional<internal::must_nest_by_value<MatrixType>::ret,
52
 
        MatrixType, const MatrixType&>::type MatrixTypeNested;
53
 
 
54
 
    inline SparseTriangularView(const MatrixType& matrix) : m_matrix(matrix) {}
55
 
 
56
 
    /** \internal */
57
 
    inline const MatrixType& nestedExpression() const { return m_matrix; }
58
 
 
59
 
    template<typename OtherDerived>
60
 
    typename internal::plain_matrix_type_column_major<OtherDerived>::type
61
 
    solve(const MatrixBase<OtherDerived>& other) const;
62
 
 
63
 
    template<typename OtherDerived> void solveInPlace(MatrixBase<OtherDerived>& other) const;
64
 
    template<typename OtherDerived> void solveInPlace(SparseMatrixBase<OtherDerived>& other) const;
65
 
 
66
 
  protected:
67
 
    MatrixTypeNested m_matrix;
68
 
};
69
 
 
70
 
template<typename MatrixType, int Mode>
71
 
class SparseTriangularView<MatrixType,Mode>::InnerIterator : public MatrixType::InnerIterator
72
 
{
73
 
    typedef typename MatrixType::InnerIterator Base;
74
 
  public:
75
 
 
76
 
    EIGEN_STRONG_INLINE InnerIterator(const SparseTriangularView& view, Index outer)
77
 
      : Base(view.nestedExpression(), outer)
78
 
    {
79
 
      if(SkipFirst)
80
 
        while((*this) && this->index()<outer)
81
 
          ++(*this);
82
 
    }
83
 
    inline Index row() const { return Base::row(); }
84
 
    inline Index col() const { return Base::col(); }
85
 
 
86
 
    EIGEN_STRONG_INLINE operator bool() const
87
 
    {
88
 
      return SkipFirst ? Base::operator bool() : (Base::operator bool() && this->index() <= this->outer());
89
 
    }
90
 
};
91
 
 
92
 
template<typename Derived>
93
 
template<int Mode>
94
 
inline const SparseTriangularView<Derived, Mode>
95
 
SparseMatrixBase<Derived>::triangularView() const
96
 
{
97
 
  return derived();
98
 
}
99
 
 
100
 
#endif // EIGEN_SPARSE_TRIANGULARVIEW_H