You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
1.0 KiB

  1. // This file is part of Eigen, a lightweight C++ template library
  2. // for linear algebra.
  3. //
  4. // Copyright (C) 2015 Gael Guennebaud <gael.guennebaud@inria.fr>
  5. //
  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/.
  9. #include "main.h"
  10. void test_is_same_dense()
  11. {
  12. typedef Matrix<double,Dynamic,Dynamic,ColMajor> ColMatrixXd;
  13. ColMatrixXd m1(10,10);
  14. Ref<ColMatrixXd> ref_m1(m1);
  15. Ref<const ColMatrixXd> const_ref_m1(m1);
  16. VERIFY(is_same_dense(m1,m1));
  17. VERIFY(is_same_dense(m1,ref_m1));
  18. VERIFY(is_same_dense(const_ref_m1,m1));
  19. VERIFY(is_same_dense(const_ref_m1,ref_m1));
  20. VERIFY(is_same_dense(m1.block(0,0,m1.rows(),m1.cols()),m1));
  21. VERIFY(!is_same_dense(m1.row(0),m1.col(0)));
  22. Ref<const ColMatrixXd> const_ref_m1_row(m1.row(1));
  23. VERIFY(!is_same_dense(m1.row(1),const_ref_m1_row));
  24. Ref<const ColMatrixXd> const_ref_m1_col(m1.col(1));
  25. VERIFY(is_same_dense(m1.col(1),const_ref_m1_col));
  26. }