AMDiS 2.10
The Adaptive Multi-Dimensional Simulation Toolbox
SymmetryStructure.hpp
1#pragma once
2
3#include <string>
4
5namespace AMDiS
6{
7 enum class SymmetryStructure
8 {
9 unknown,
10 spd, //< symmetric positive definite
11 symmetric, //< symmetric in terms of both structure and value
12 hermitian, //< transpose is the complex conjugation
13 structurally_symmetric //< symmetric nonzero structure
14 };
15
16 inline SymmetryStructure symmetryStructure(std::string str)
17 {
18 if (str == "spd")
19 return SymmetryStructure::spd;
20 else if (str == "symmetric")
21 return SymmetryStructure::symmetric;
22 else if (str == "hermitian")
23 return SymmetryStructure::hermitian;
24 else if (str == "structurally_symmetric")
25 return SymmetryStructure::structurally_symmetric;
26 else
27 return SymmetryStructure::unknown;
28 }
29
30 inline std::string to_string(SymmetryStructure symmetry)
31 {
32 switch (symmetry) {
33 case SymmetryStructure::spd:
34 return "spd";
35 case SymmetryStructure::symmetric:
36 return "symmetric";
37 case SymmetryStructure::hermitian:
38 return "hermitian";
39 case SymmetryStructure::structurally_symmetric:
40 return "structurally_symmetric";
41 default:
42 return "unknown";
43 }
44 }
45
46} // end namespace AMDiS