| 
									
										
										
										
											2015-06-10 16:09:04 +08:00
										 |  |  | // This file is part of Eigen, a lightweight C++ template library
 | 
					
						
							|  |  |  | // for linear algebra.
 | 
					
						
							|  |  |  | //
 | 
					
						
							|  |  |  | // Copyright (C) 2015 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/.
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include "main.h"
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-06-03 14:12:14 +08:00
										 |  |  | using internal::is_same_dense; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-17 20:46:15 +08:00
										 |  |  | EIGEN_DECLARE_TEST(is_same_dense) { | 
					
						
							| 
									
										
										
										
											2015-12-11 17:06:28 +08:00
										 |  |  |   typedef Matrix<double, Dynamic, Dynamic, ColMajor> ColMatrixXd; | 
					
						
							| 
									
										
										
										
											2018-07-03 19:21:43 +08:00
										 |  |  |   typedef Matrix<std::complex<double>, Dynamic, Dynamic, ColMajor> ColMatrixXcd; | 
					
						
							| 
									
										
										
										
											2015-12-11 17:06:28 +08:00
										 |  |  |   ColMatrixXd m1(10, 10); | 
					
						
							| 
									
										
										
										
											2018-07-03 19:21:43 +08:00
										 |  |  |   ColMatrixXcd m2(10, 10); | 
					
						
							| 
									
										
										
										
											2015-12-11 17:06:28 +08:00
										 |  |  |   Ref<ColMatrixXd> ref_m1(m1); | 
					
						
							| 
									
										
										
										
											2018-07-03 19:21:43 +08:00
										 |  |  |   Ref<ColMatrixXd, 0, Stride<Dynamic, Dynamic> > ref_m2_real(m2.real()); | 
					
						
							| 
									
										
										
										
											2015-12-11 17:06:28 +08:00
										 |  |  |   Ref<const ColMatrixXd> const_ref_m1(m1); | 
					
						
							| 
									
										
										
										
											2018-07-03 19:21:43 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-06-10 16:09:04 +08:00
										 |  |  |   VERIFY(is_same_dense(m1, m1)); | 
					
						
							|  |  |  |   VERIFY(is_same_dense(m1, ref_m1)); | 
					
						
							|  |  |  |   VERIFY(is_same_dense(const_ref_m1, m1)); | 
					
						
							|  |  |  |   VERIFY(is_same_dense(const_ref_m1, ref_m1)); | 
					
						
							| 
									
										
										
										
											2023-12-06 05:22:55 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-06-10 16:09:04 +08:00
										 |  |  |   VERIFY(is_same_dense(m1.block(0, 0, m1.rows(), m1.cols()), m1)); | 
					
						
							|  |  |  |   VERIFY(!is_same_dense(m1.row(0), m1.col(0))); | 
					
						
							| 
									
										
										
										
											2023-12-06 05:22:55 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-12-11 17:06:28 +08:00
										 |  |  |   Ref<const ColMatrixXd> const_ref_m1_row(m1.row(1)); | 
					
						
							| 
									
										
										
										
											2015-06-10 16:09:04 +08:00
										 |  |  |   VERIFY(!is_same_dense(m1.row(1), const_ref_m1_row)); | 
					
						
							| 
									
										
										
										
											2018-07-03 19:21:43 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-12-11 17:06:28 +08:00
										 |  |  |   Ref<const ColMatrixXd> const_ref_m1_col(m1.col(1)); | 
					
						
							| 
									
										
										
										
											2015-06-10 16:09:04 +08:00
										 |  |  |   VERIFY(is_same_dense(m1.col(1), const_ref_m1_col)); | 
					
						
							| 
									
										
										
										
											2018-07-03 19:21:43 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  |   VERIFY(!is_same_dense(m1, ref_m2_real)); | 
					
						
							|  |  |  |   VERIFY(!is_same_dense(m2, ref_m2_real)); | 
					
						
							| 
									
										
										
										
											2015-06-10 16:09:04 +08:00
										 |  |  | } |