aboutsummaryrefslogtreecommitdiffhomepage
path: root/Eigen/src/SparseCore/SparseSelfAdjointView.h
diff options
context:
space:
mode:
authorGravatar Desire NUENTSA <desire.nuentsa_wakam@inria.fr>2012-02-10 10:18:38 +0100
committerGravatar Desire NUENTSA <desire.nuentsa_wakam@inria.fr>2012-02-10 10:18:38 +0100
commit2ea98594c4af1af8e3d15545b5091c368b2a5213 (patch)
tree7d1c8dc982bbedcdaccbd65fb6356e1f916dc56b /Eigen/src/SparseCore/SparseSelfAdjointView.h
parent70284b7eff36ed7a9c2a6121fae7a4c95d58ef8c (diff)
Modify the symmetric permutation to deal with nonsymmetric matrices
Diffstat (limited to 'Eigen/src/SparseCore/SparseSelfAdjointView.h')
-rw-r--r--Eigen/src/SparseCore/SparseSelfAdjointView.h22
1 files changed, 15 insertions, 7 deletions
diff --git a/Eigen/src/SparseCore/SparseSelfAdjointView.h b/Eigen/src/SparseCore/SparseSelfAdjointView.h
index d9c22dce6..41cd36d72 100644
--- a/Eigen/src/SparseCore/SparseSelfAdjointView.h
+++ b/Eigen/src/SparseCore/SparseSelfAdjointView.h
@@ -310,9 +310,11 @@ void permute_symm_to_fullsymm(const MatrixType& mat, SparseMatrix<typename Matri
{
Index i = it.index();
Index ip = perm ? perm[i] : i;
- if(i==j)
+ if(UpLo==(Upper|Lower))
+ count[StorageOrderMatch ? jp : ip]++;
+ else if(i==j)
count[ip]++;
- else if((UpLo==Lower && i>j) || (UpLo==Upper && i<j))
+ else if(( UpLo==Lower && i>j) || ( UpLo==Upper && i<j))
{
count[ip]++;
count[jp]++;
@@ -322,7 +324,7 @@ void permute_symm_to_fullsymm(const MatrixType& mat, SparseMatrix<typename Matri
Index nnz = count.sum();
// reserve space
- dest.reserve(nnz);
+ dest.resizeNonZeros(nnz);
dest.outerIndexPtr()[0] = 0;
for(Index j=0; j<size; ++j)
dest.outerIndexPtr()[j+1] = dest.outerIndexPtr()[j] + count[j];
@@ -337,15 +339,21 @@ void permute_symm_to_fullsymm(const MatrixType& mat, SparseMatrix<typename Matri
{
Index i = it.index();
Index ip = perm ? perm[i] : i;
- if(i==j)
+ if(UpLo==(Upper|Lower))
{
- int k = count[ip]++;
+ Index k = count[StorageOrderMatch ? jp : ip]++;
+ dest.innerIndexPtr()[k] = StorageOrderMatch ? ip : jp;
+ dest.valuePtr()[k] = it.value();
+ }
+ else if(i==j)
+ {
+ Index k = count[ip]++;
dest.innerIndexPtr()[k] = ip;
dest.valuePtr()[k] = it.value();
}
- else if((UpLo==Lower && i>j) || (UpLo==Upper && i<j))
+ else if(( (UpLo&Lower)==Lower && i>j) || ( (UpLo&Upper)==Upper && i<j))
{
- int k = count[jp]++;
+ Index k = count[jp]++;
dest.innerIndexPtr()[k] = ip;
dest.valuePtr()[k] = it.value();
k = count[ip]++;