SymmetryStructure.hpp 1.23 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#pragma once

#include <string>

namespace AMDiS
{
  enum class SymmetryStructure
  {
    unknown,
    spd,                    //< symmetric positive definite
    symmetric,              //< symmetric in terms of both structure and value
    hermitian,              //< transpose is the complex conjugation
    structurally_symmetric  //< symmetric nonzero structure
  };

  inline SymmetryStructure symmetryStructure(std::string str)
  {
    if (str == "spd")
      return SymmetryStructure::spd;
    else if (str == "symmetric")
      return SymmetryStructure::symmetric;
    else if (str == "hermitian")
      return SymmetryStructure::hermitian;
    else if (str == "structurally_symmetric")
      return SymmetryStructure::structurally_symmetric;
    else
      return SymmetryStructure::unknown;
  }

  inline std::string to_string(SymmetryStructure symmetry)
  {
    switch (symmetry) {
      case SymmetryStructure::spd:
        return "spd";
      case SymmetryStructure::symmetric:
        return "symmetric";
      case SymmetryStructure::hermitian:
        return "hermitian";
      case SymmetryStructure::structurally_symmetric:
        return "structurally_symmetric";
      default:
        return "unknown";
    }
  }

} // end namespace AMDiS