Re: [eigen] Sparse non-SPD symmetric solving
• To: eigen <eigen@xxxxxxxxxxxxxxxxxxx>
• Subject: Re: [eigen] Sparse non-SPD symmetric solving
• From: Gael Guennebaud <gael.guennebaud@xxxxxxxxx>
• Date: Mon, 8 Jun 2015 10:23:10 +0200
• Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=WdzhxW6IKELmLKLZ+8VY7sAp0Eky9aROtf5w+VDDqZE=; b=VYQrafTcTCs/HgcCz9AssI+TEWXnn9i/jc109uZ37xEbkYI2jH26pv5o2fhoAjJ8Gx TSVh/ucuv2le2AqfzT8pH57w7Gf0AnqiKtTFPJFnT+kfDYWtJkfCjbyqIoohkVkOfd/+ RmAqFIFXJHKzpZ+WY6rWrt5rQ+haLXGhHD2NyIa+e+eksphhkKCxfCOZ1PaqtN5cJxyV 1KUdGmaButygr9LZkK9Wuf0i7pQfCAJXu/nl1UTREHCoYJZQ9tFlhym6nLwBq6/NwYMt sGTCWkxaMOTsMc4BoCTd34zKQFP0r3lsb4LtVIRxqKDa18UMgiUtnd/6UCQbofVr21A6 rfXw==

Hi,

yes, since SparseLU is for general square problems, you need to build a full version explicitly using A.selfadjointView<Upper>(). Note that Upper is a template parameter, not an argument of the method.

On the other hand, solvers specialized for self-adjoint problems (e.g., Simplicial*, ConjugateGradient) read only the triangular part as specified by their 2nd template argument. For them, calling sefladjointView is thus not required, and even counter productive. Here is an example:

cg.compute(A);

cheers,
Gaël

On Fri, Jun 5, 2015 at 10:46 PM, Alberto Luaces wrote:
Hi,

I want to solve a symmetric, non-definite positive sparse linear
system.  My input is a matrix whose values are stored into the upper
part.

I wonder if the following is the best way to solve the system.  I am
concerned about my handling of the symmetric matrix: should I use the
adjoint view or try to build an adjoint matrix from the beginning?

Eigen::SparseMatrix<double> A;
A.setFromTriplets(...);

Eigen::SparseLU<Eigen::SparseMatrix<double>> solver;

solver.isSymmetric(true);