4
4
// Copyright (C) 2008 Gael Guennebaud <gael.guennebaud@inria.fr>
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.
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.
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.
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/>.
6
// This Source Code Form is subject to the terms of the Mozilla
7
// Public License v. 2.0. If a copy of the MPL was not distributed
8
// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
25
10
#ifndef EIGEN_ALLANDANY_H
26
11
#define EIGEN_ALLANDANY_H
28
15
namespace internal {
30
17
template<typename Derived, int UnrollCount>
35
22
row = (UnrollCount-1) % Derived::RowsAtCompileTime
38
inline static bool run(const Derived &mat)
25
static inline bool run(const Derived &mat)
40
27
return all_unroller<Derived, UnrollCount-1>::run(mat) && mat.coeff(row, col);
44
31
template<typename Derived>
45
32
struct all_unroller<Derived, 1>
47
inline static bool run(const Derived &mat) { return mat.coeff(0, 0); }
34
static inline bool run(const Derived &mat) { return mat.coeff(0, 0); }
50
37
template<typename Derived>
51
38
struct all_unroller<Derived, Dynamic>
53
inline static bool run(const Derived &) { return false; }
40
static inline bool run(const Derived &) { return false; }
56
43
template<typename Derived, int UnrollCount>
61
48
row = (UnrollCount-1) % Derived::RowsAtCompileTime
64
inline static bool run(const Derived &mat)
51
static inline bool run(const Derived &mat)
66
53
return any_unroller<Derived, UnrollCount-1>::run(mat) || mat.coeff(row, col);
70
57
template<typename Derived>
71
58
struct any_unroller<Derived, 1>
73
inline static bool run(const Derived &mat) { return mat.coeff(0, 0); }
60
static inline bool run(const Derived &mat) { return mat.coeff(0, 0); }
76
63
template<typename Derived>
77
64
struct any_unroller<Derived, Dynamic>
79
inline static bool run(const Derived &) { return false; }
66
static inline bool run(const Derived &) { return false; }
82
69
} // end namespace internal