really fix permute_symm_to_symm for sparse complex matrix

This commit is contained in:
Gael Guennebaud 2011-01-28 15:51:55 +01:00
parent 6ec660ca7e
commit 817d86cbaf

View File

@ -367,7 +367,7 @@ void permute_symm_to_symm(const MatrixType& mat, SparseMatrix<typename MatrixTyp
typedef SparseMatrix<Scalar,DestOrder,Index> Dest; typedef SparseMatrix<Scalar,DestOrder,Index> Dest;
Dest& dest(_dest.derived()); Dest& dest(_dest.derived());
typedef Matrix<Index,Dynamic,1> VectorI; typedef Matrix<Index,Dynamic,1> VectorI;
internal::conj_if<SrcUpLo!=DstUpLo> cj; //internal::conj_if<SrcUpLo!=DstUpLo> cj;
Index size = mat.rows(); Index size = mat.rows();
VectorI count(size); VectorI count(size);
@ -405,7 +405,11 @@ void permute_symm_to_symm(const MatrixType& mat, SparseMatrix<typename MatrixTyp
Index ip = perm? perm[i] : i; Index ip = perm? perm[i] : i;
Index k = count[DstUpLo==Lower ? std::min(ip,jp) : std::max(ip,jp)]++; Index k = count[DstUpLo==Lower ? std::min(ip,jp) : std::max(ip,jp)]++;
dest._innerIndexPtr()[k] = DstUpLo==Lower ? std::max(ip,jp) : std::min(ip,jp); dest._innerIndexPtr()[k] = DstUpLo==Lower ? std::max(ip,jp) : std::min(ip,jp);
dest._valuePtr()[k] = cj(it.value());
if((DstUpLo==Lower && ip<jp) || (DstUpLo==Upper && ip>jp))
dest._valuePtr()[k] = conj(it.value());
else
dest._valuePtr()[k] = it.value();
} }
} }
} }