1 // This file is part of Eigen, a lightweight C++ template library
4 // Copyright (C) 2011 Benoit Jacob <jacob.benoit.1@gmail.com>
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/.
13 template<typename MatrixType
> void zeroReduction(const MatrixType
& m
) {
14 // Reductions that must hold for zero sized objects
20 VERIFY(m
.allFinite());
25 template<typename MatrixType
> void zeroSizedMatrix()
29 if (MatrixType::SizeAtCompileTime
== Dynamic
|| MatrixType::SizeAtCompileTime
== 0)
32 if (MatrixType::RowsAtCompileTime
== Dynamic
)
33 VERIFY(t1
.rows() == 0);
34 if (MatrixType::ColsAtCompileTime
== Dynamic
)
35 VERIFY(t1
.cols() == 0);
37 if (MatrixType::RowsAtCompileTime
== Dynamic
&& MatrixType::ColsAtCompileTime
== Dynamic
)
41 VERIFY(t2
.rows() == 0);
42 VERIFY(t2
.cols() == 0);
50 template<typename VectorType
> void zeroSizedVector()
54 if (VectorType::SizeAtCompileTime
== Dynamic
|| VectorType::SizeAtCompileTime
==0)
57 VERIFY(t1
.size() == 0);
58 VectorType
t2(DenseIndex(0)); // DenseIndex disambiguates with 0-the-null-pointer (error with gcc 4.4 and MSVC8)
59 VERIFY(t2
.size() == 0);
68 zeroSizedMatrix
<Matrix2d
>();
69 zeroSizedMatrix
<Matrix3i
>();
70 zeroSizedMatrix
<Matrix
<float, 2, Dynamic
> >();
71 zeroSizedMatrix
<MatrixXf
>();
72 zeroSizedMatrix
<Matrix
<float, 0, 0> >();
73 zeroSizedMatrix
<Matrix
<float, Dynamic
, 0, 0, 0, 0> >();
74 zeroSizedMatrix
<Matrix
<float, 0, Dynamic
, 0, 0, 0> >();
75 zeroSizedMatrix
<Matrix
<float, Dynamic
, Dynamic
, 0, 0, 0> >();
76 zeroSizedMatrix
<Matrix
<float, 0, 4> >();
77 zeroSizedMatrix
<Matrix
<float, 4, 0> >();
79 zeroSizedVector
<Vector2d
>();
80 zeroSizedVector
<Vector3i
>();
81 zeroSizedVector
<VectorXf
>();
82 zeroSizedVector
<Matrix
<float, 0, 1> >();
83 zeroSizedVector
<Matrix
<float, 1, 0> >();