Use conj_expr_if to clarify what it's doing.

This commit is contained in:
Chen-Pang He 2012-09-09 21:35:28 +08:00
parent 669db3d776
commit 2828c995c5
3 changed files with 10 additions and 9 deletions

View File

@ -21,9 +21,10 @@ struct general_rank1_update<Scalar,Index,ColMajor,ConjLhs,ConjRhs>
{
static void run(Index rows, Index cols, Scalar* mat, Index stride, const Scalar* u, const Scalar* v, Scalar alpha)
{
internal::conj_if<ConjRhs> cj;
typedef Map<const Matrix<Scalar,Dynamic,1> > OtherMap;
typedef typename internal::conditional<ConjLhs,typename OtherMap::ConjugateReturnType,const OtherMap&>::type ConjRhsType;
typedef typename conj_expr_if<ConjLhs,OtherMap>::type ConjRhsType;
conj_if<ConjRhs> cj;
for (Index i=0; i<cols; ++i)
Map<Matrix<Scalar,Dynamic,1> >(mat+stride*i,rows) += alpha * cj(v[i]) * ConjRhsType(OtherMap(u,rows));
}

View File

@ -17,9 +17,9 @@ namespace internal {
*
* FIXME I always fail tests for complex self-adjoint matrices.
*
******* FATAL ERROR - PARAMETER NUMBER 6 WAS CHANGED INCORRECTLY *******
******* xHPR FAILED ON CALL NUMBER:
2: xHPR ('U', 1, 0.0, X, 1, AP)
* ******* FATAL ERROR - PARAMETER NUMBER 6 WAS CHANGED INCORRECTLY *******
* ******* xHPR FAILED ON CALL NUMBER:
* 2: xHPR ('U', 1, 0.0, X, 1, AP)
*/
template<typename Scalar, typename Index, int StorageOrder, int UpLo, bool ConjLhs, bool ConjRhs>
struct selfadjoint_packed_rank1_update;
@ -29,9 +29,9 @@ struct selfadjoint_packed_rank1_update<Scalar,Index,ColMajor,UpLo,ConjLhs,ConjRh
{
static void run(Index size, Scalar* mat, const Scalar* vec, Scalar alpha)
{
internal::conj_if<ConjRhs> cj;
typedef Map<const Matrix<Scalar,Dynamic,1> > OtherMap;
typedef typename internal::conditional<ConjLhs,typename OtherMap::ConjugateReturnType,const OtherMap&>::type ConjRhsType;
typedef typename conj_expr_if<ConjLhs,OtherMap>::type ConjRhsType;
conj_if<ConjRhs> cj;
Index offset = 0;
for (Index i=0; i<size; ++i)

View File

@ -242,8 +242,8 @@ int EIGEN_BLAS_FUNC(spr)(char *uplo, int *n, Scalar *palpha, Scalar *px, int *in
for(int k=0; k<2; ++k)
func[k] = 0;
func[UP] = (internal::selfadjoint_packed_rank1_update<Scalar,int,ColMajor,Upper,false,Conj>::run);
func[LO] = (internal::selfadjoint_packed_rank1_update<Scalar,int,ColMajor,Lower,false,Conj>::run);
func[UP] = (internal::selfadjoint_packed_rank1_update<Scalar,int,ColMajor,Upper,false,false>::run);
func[LO] = (internal::selfadjoint_packed_rank1_update<Scalar,int,ColMajor,Lower,false,false>::run);
init = true;
}