bug #1395: fix the use of compile-time vectors as inputs of JacobiSVD.
(grafted from 6572825703
)
			
			
This commit is contained in:
		
							parent
							
								
									d367ecb475
								
							
						
					
					
						commit
						e1385337ff
					
				| @ -87,7 +87,8 @@ void apply_block_householder_on_the_left(MatrixType& mat, const VectorsType& vec | ||||
|   const TriangularView<const VectorsType, UnitLower> V(vectors); | ||||
| 
 | ||||
|   // A -= V T V^* A
 | ||||
|   Matrix<typename MatrixType::Scalar,VectorsType::ColsAtCompileTime,MatrixType::ColsAtCompileTime,0, | ||||
|   Matrix<typename MatrixType::Scalar,VectorsType::ColsAtCompileTime,MatrixType::ColsAtCompileTime, | ||||
|          (VectorsType::MaxColsAtCompileTime==1 && MatrixType::MaxColsAtCompileTime!=1)?RowMajor:ColMajor, | ||||
|          VectorsType::MaxColsAtCompileTime,MatrixType::MaxColsAtCompileTime> tmp = V.adjoint() * mat; | ||||
|   // FIXME add .noalias() once the triangular product can work inplace
 | ||||
|   if(forward) tmp = T.template triangularView<Upper>()           * tmp; | ||||
|  | ||||
| @ -112,9 +112,11 @@ public: | ||||
|     ColsAtCompileTime = MatrixType::ColsAtCompileTime, | ||||
|     MaxRowsAtCompileTime = MatrixType::MaxRowsAtCompileTime, | ||||
|     MaxColsAtCompileTime = MatrixType::MaxColsAtCompileTime, | ||||
|     Options = MatrixType::Options | ||||
|     TrOptions = RowsAtCompileTime==1 ? (MatrixType::Options & ~(RowMajor)) | ||||
|               : ColsAtCompileTime==1 ? (MatrixType::Options |   RowMajor) | ||||
|               : MatrixType::Options | ||||
|   }; | ||||
|   typedef Matrix<Scalar, ColsAtCompileTime, RowsAtCompileTime, Options, MaxColsAtCompileTime, MaxRowsAtCompileTime> | ||||
|   typedef Matrix<Scalar, ColsAtCompileTime, RowsAtCompileTime, TrOptions, MaxColsAtCompileTime, MaxRowsAtCompileTime> | ||||
|           TransposeTypeWithSameStorageOrder; | ||||
| 
 | ||||
|   void allocate(const JacobiSVD<MatrixType, FullPivHouseholderQRPreconditioner>& svd) | ||||
|  | ||||
| @ -101,6 +101,12 @@ void test_jacobisvd() | ||||
|     // Test on inf/nan matrix
 | ||||
|     CALL_SUBTEST_7(  (svd_inf_nan<JacobiSVD<MatrixXf>, MatrixXf>()) ); | ||||
|     CALL_SUBTEST_10( (svd_inf_nan<JacobiSVD<MatrixXd>, MatrixXd>()) ); | ||||
| 
 | ||||
|     // bug1395 test compile-time vectors as input
 | ||||
|     CALL_SUBTEST_13(( jacobisvd_verify_assert(Matrix<double,6,1>()) )); | ||||
|     CALL_SUBTEST_13(( jacobisvd_verify_assert(Matrix<double,1,6>()) )); | ||||
|     CALL_SUBTEST_13(( jacobisvd_verify_assert(Matrix<double,Dynamic,1>(r)) )); | ||||
|     CALL_SUBTEST_13(( jacobisvd_verify_assert(Matrix<double,1,Dynamic>(c)) )); | ||||
|   } | ||||
| 
 | ||||
|   CALL_SUBTEST_7(( jacobisvd<MatrixXf>(MatrixXf(internal::random<int>(EIGEN_TEST_MAX_SIZE/4, EIGEN_TEST_MAX_SIZE/2), internal::random<int>(EIGEN_TEST_MAX_SIZE/4, EIGEN_TEST_MAX_SIZE/2))) )); | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Gael Guennebaud
						Gael Guennebaud