# [Trilinos-Users] Question about boolean inside Trillinos to know if a matrix is symmetric positive-definite

Heroux, Michael A maherou at sandia.gov
Fri Jan 3 08:16:11 MST 2020

```Jordi,

Testing symmetry is fairly straightforward.  Here is an example function from the HPCG Benchmark code:  https://github.com/hpcg-benchmark/hpcg/blob/master/src/TestSymmetry.cpp

Testing positive definiteness is more challenging.  There is a version of the conjugate gradients method in AztecOO that produces an estimate of the condition number of the matrix, which, for an SPD matrix, is the ratio of the max and min eigenvalues.  I am not sure if or how it would work if the matrix is indefinite.  Selecting this solver is straightforward if you are already using AztecOO.  See this PDF and search on condnum:  https://trilinos.github.io/pdfs/Trilinos4.0Tutorial.pdf

Note that this will produce a condition estimate for the preconditioned matrix, if you are using preconditioning.

Sorry there is nothing easier.  In general, we tend to know from the properties of our problems whether or not a matrix is symmetric, positive definite or both, so we don’t provide turnkey ways to test for these properties.

Mike

From: Trilinos-Users <trilinos-users-bounces at trilinos.org> on behalf of Sivasankaran Rajamanickam <srajama at sandia.gov>
Date: Wednesday, December 18, 2019 at 1:49 PM
To: Jordi Font I Reverter <jordi.font.i at upc.edu>, Trilinos Users <trilinos-users at trilinos.org>
Subject: Re: [Trilinos-Users] [EXTERNAL] Question about boolean inside Trillinos to know if a matrix is symmetric positive-definite

​Jordi

We do not have such a Boolean function.

-Siva

________________________________
From: Trilinos-Users <trilinos-users-bounces at trilinos.org> on behalf of Jordi Font I Reverter <jordi.font.i at upc.edu>
Sent: Wednesday, December 18, 2019 9:54 AM
To: trilinos-users at trilinos.org
Subject: [EXTERNAL] [Trilinos-Users] Question about boolean inside Trillinos to know if a matrix is symmetric positive-definite

Greetings.

My name is Jordi Font and I am a Ph.D. student in the Universitat Politècnica de Catalunya (Spain) under the supervision of Marino Arroyo. We perform numerical simulations of biological dynamics and we are currently developing a High-Performance library for Finite Element Methods. We are interested in using Amesos, Amesos2, AztecOO and Belos to solve the sparse linear systems derived from such numerical methods.

I would like to ask you if there is any boolean function inside any of these four packages (or another one provided by Trillinos) that returns if the matrix from the LHS is symmetric positive-definite or not.

Thankfully,
Jordi Font
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://trilinos.org/pipermail/trilinos-users_trilinos.org/attachments/20200103/e7795b44/attachment.html>
```