From 0ebce69424a1557a78c47239ae483d1f728da146 Mon Sep 17 00:00:00 2001 From: Gael Guennebaud Date: Fri, 20 Mar 2015 16:33:48 +0100 Subject: [PATCH] Update approx. minimum ordering method to push and keep structural empty diagonal elements to the bottom-right part of the matrix --- Eigen/src/OrderingMethods/Amd.h | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/Eigen/src/OrderingMethods/Amd.h b/Eigen/src/OrderingMethods/Amd.h index 41b4fd7e3..1c28bdf41 100644 --- a/Eigen/src/OrderingMethods/Amd.h +++ b/Eigen/src/OrderingMethods/Amd.h @@ -144,15 +144,23 @@ void minimum_degree_ordering(SparseMatrix& C, Permutation /* --- Initialize degree lists ------------------------------------------ */ for(i = 0; i < n; i++) { + bool has_diag = false; + for(p = Cp[i]; p dense) /* node i is dense */ + else if(d > dense || !has_diag) /* node i is dense or has no structural diagonal element */ { nv[i] = 0; /* absorb i into element n */ elen[i] = -1; /* node i is dead */ @@ -168,6 +176,10 @@ void minimum_degree_ordering(SparseMatrix& C, Permutation } } + elen[n] = -2; /* n is a dead element */ + Cp[n] = -1; /* n is a root of assembly tree */ + w[n] = 0; /* n is a dead element */ + while (nel < n) /* while (selecting pivots) do */ { /* --- Select node of minimum approximate degree -------------------- */