Reference documentation for deal.II version 9.1.0-pre
lapack_support.h
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 2005 - 2017 by the deal.II authors
4 //
5 // This file is part of the deal.II library.
6 //
7 // The deal.II library is free software; you can use it, redistribute
8 // it, and/or modify it under the terms of the GNU Lesser General
9 // Public License as published by the Free Software Foundation; either
10 // version 2.1 of the License, or (at your option) any later version.
11 // The full text of the license can be found in the file LICENSE.md at
12 // the top level directory of deal.II.
13 //
14 // ---------------------------------------------------------------------
15 
16 #ifndef dealii_lapack_support_h
17 #define dealii_lapack_support_h
18 
19 
20 #include <deal.II/base/config.h>
21 
22 #include <deal.II/base/exceptions.h>
23 
24 DEAL_II_NAMESPACE_OPEN
25 
26 namespace types
27 {
28 #ifdef LAPACK_WITH_64BIT_BLAS_INDICES
29 
32  using blas_int = long long;
33 #else
34 
37  using blas_int = int;
38 #endif
39 } // namespace types
40 
45 namespace LAPACKSupport
46 {
57  enum State
58  {
64  lu,
70  svd,
74  unusable = 0x8000
75  };
76 
80  inline const char *
82  {
83  switch (s)
84  {
85  case matrix:
86  return "matrix";
87  case inverse_matrix:
88  return "inverse matrix";
89  case lu:
90  return "lu decomposition";
91  case cholesky:
92  return "cholesky decomposition";
93  case eigenvalues:
94  return "eigenvalues";
95  case svd:
96  return "svd";
97  case inverse_svd:
98  return "inverse_svd";
99  case unusable:
100  return "unusable";
101  default:
102  return "unknown";
103  }
104  }
105 
110  enum Property
111  {
113  general = 0,
121  diagonal = 6,
124  };
125 
129  inline const char *
131  {
132  switch (s)
133  {
134  case general:
135  return "general";
136  case symmetric:
137  return "symmetric";
138  case upper_triangular:
139  return "upper triangular";
140  case lower_triangular:
141  return "lower triangular";
142  case diagonal:
143  return "diagonal";
144  case hessenberg:
145  return "Hessenberg";
146  }
147 
148  Assert(false, ExcNotImplemented());
149  return "invalid";
150  }
151 
155  static const char A = 'A';
159  static const char N = 'N';
163  static const char T = 'T';
167  static const char U = 'U';
171  static const char L = 'L';
175  static const char V = 'V';
179  static const types::blas_int zero = 0;
183  static const types::blas_int one = 1;
184 
189  std::string,
191  << "The function " << arg1 << " returned with an error code "
192  << arg2);
193 
200  ExcState,
201  State,
202  << "The function cannot be called while the matrix is in state "
203  << state_name(arg1));
204 
210  Property,
211  << "The function cannot be called with a "
212  << property_name(arg1) << " matrix.");
213 
219  ExcMissing,
220  std::string,
221  << "When you ran 'cmake' during installation of deal.II, "
222  << "no suitable installation of the BLAS or LAPACK library could "
223  << "be found. Consequently, the function <" << arg1
224  << "> can not be called. Refer to the doc/readme.html "
225  << "file for information on how to ensure that deal.II "
226  << "picks up an existing BLAS and LAPACK installation at "
227  << "configuration time.");
228 } // namespace LAPACKSupport
229 
230 
231 DEAL_II_NAMESPACE_CLOSE
232 
233 #endif
Matrix is symmetric.
#define DeclException2(Exception2, type1, type2, outsequence)
Definition: exceptions.h:420
static const char L
Contents is actually a matrix.
std::array< Number, 1 > eigenvalues(const SymmetricTensor< 2, 1, Number > &T)
Matrix is upper triangular.
Contents is the inverse of a matrix.
static const char V
static const types::blas_int one
static const char U
static::ExceptionBase & ExcErrorCode(std::string arg1, types::blas_int arg2)
const char * state_name(State s)
Matrix is diagonal.
static::ExceptionBase & ExcState(State arg1)
Contents is a Cholesky decomposition.
#define DeclException1(Exception1, type1, outsequence)
Definition: exceptions.h:408
static const char T
Definition: types.h:31
#define Assert(cond, exc)
Definition: exceptions.h:1227
static::ExceptionBase & ExcMissing(std::string arg1)
Contents is something useless.
Matrix is the inverse of a singular value decomposition.
static const char A
int blas_int
Matrix contains singular value decomposition,.
static const char N
static::ExceptionBase & ExcNotImplemented()
static const types::blas_int zero
const char * property_name(const Property s)
static::ExceptionBase & ExcProperty(Property arg1)
Matrix is in upper Hessenberg form.
Matrix is lower triangular.
Contents is an LU decomposition.