Efficient diagonalization of symmetric matrices associated with graphs of small treewidth
Let M=(m_ij) be a symmetric matrix of order n whose elements lie in an arbitrary field 𝔽, and let G be the graph with vertex set {1,…,n} such that distinct vertices i and j are adjacent if and only if m_ij≠ 0. We introduce a dynamic programming algorithm that finds a diagonal matrix that is congruent to M. If G is given with a tree decomposition 𝒯 of width k, then this can be done in time O(k|𝒯| + k^2 n), where |𝒯| denotes the number of nodes in 𝒯. Among other things, this allows one to compute the determinant, the rank and the inertia of a symmetric matrix in time O(k|𝒯| + k^2 n).
READ FULL TEXT