diff options
| author | Stanislaw Halik <sthalik@misaki.pl> | 2019-03-03 21:09:10 +0100 |
|---|---|---|
| committer | Stanislaw Halik <sthalik@misaki.pl> | 2019-03-03 21:10:13 +0100 |
| commit | f0238cfb6997c4acfc2bd200de7295f3fa36968f (patch) | |
| tree | b215183760e4f615b9c1dabc1f116383b72a1b55 /eigen/test/constructor.cpp | |
| parent | 543edd372a5193d04b3de9f23c176ab439e51b31 (diff) | |
don't index Eigen
Diffstat (limited to 'eigen/test/constructor.cpp')
| -rw-r--r-- | eigen/test/constructor.cpp | 84 |
1 files changed, 0 insertions, 84 deletions
diff --git a/eigen/test/constructor.cpp b/eigen/test/constructor.cpp deleted file mode 100644 index eec9e21..0000000 --- a/eigen/test/constructor.cpp +++ /dev/null @@ -1,84 +0,0 @@ -// This file is part of Eigen, a lightweight C++ template library -// for linear algebra. -// -// Copyright (C) 2017 Gael Guennebaud <gael.guennebaud@inria.fr> -// -// This Source Code Form is subject to the terms of the Mozilla -// Public License v. 2.0. If a copy of the MPL was not distributed -// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. - - -#define TEST_ENABLE_TEMPORARY_TRACKING - -#include "main.h" - -template<typename MatrixType> struct Wrapper -{ - MatrixType m_mat; - inline Wrapper(const MatrixType &x) : m_mat(x) {} - inline operator const MatrixType& () const { return m_mat; } - inline operator MatrixType& () { return m_mat; } -}; - -template<typename MatrixType> void ctor_init1(const MatrixType& m) -{ - // Check logic in PlainObjectBase::_init1 - Index rows = m.rows(); - Index cols = m.cols(); - - MatrixType m0 = MatrixType::Random(rows,cols); - - VERIFY_EVALUATION_COUNT( MatrixType m1(m0), 1); - VERIFY_EVALUATION_COUNT( MatrixType m2(m0+m0), 1); - VERIFY_EVALUATION_COUNT( MatrixType m2(m0.block(0,0,rows,cols)) , 1); - - Wrapper<MatrixType> wrapper(m0); - VERIFY_EVALUATION_COUNT( MatrixType m3(wrapper) , 1); -} - - -void test_constructor() -{ - for(int i = 0; i < g_repeat; i++) { - CALL_SUBTEST_1( ctor_init1(Matrix<float, 1, 1>()) ); - CALL_SUBTEST_1( ctor_init1(Matrix4d()) ); - CALL_SUBTEST_1( ctor_init1(MatrixXcf(internal::random<int>(1,EIGEN_TEST_MAX_SIZE), internal::random<int>(1,EIGEN_TEST_MAX_SIZE))) ); - CALL_SUBTEST_1( ctor_init1(MatrixXi(internal::random<int>(1,EIGEN_TEST_MAX_SIZE), internal::random<int>(1,EIGEN_TEST_MAX_SIZE))) ); - } - { - Matrix<Index,1,1> a(123); - VERIFY_IS_EQUAL(a[0], 123); - } - { - Matrix<Index,1,1> a(123.0); - VERIFY_IS_EQUAL(a[0], 123); - } - { - Matrix<float,1,1> a(123); - VERIFY_IS_EQUAL(a[0], 123.f); - } - { - Array<Index,1,1> a(123); - VERIFY_IS_EQUAL(a[0], 123); - } - { - Array<Index,1,1> a(123.0); - VERIFY_IS_EQUAL(a[0], 123); - } - { - Array<float,1,1> a(123); - VERIFY_IS_EQUAL(a[0], 123.f); - } - { - Array<Index,3,3> a(123); - VERIFY_IS_EQUAL(a(4), 123); - } - { - Array<Index,3,3> a(123.0); - VERIFY_IS_EQUAL(a(4), 123); - } - { - Array<float,3,3> a(123); - VERIFY_IS_EQUAL(a(4), 123.f); - } -} |
