config.h Source File

CPP API: config.h Source File
memilio/config.h
Go to the documentation of this file.
1 /*
2 * Copyright (C) 2020-2026 MEmilio
3 *
4 * Authors: Daniel Abele
5 *
6 * Contact: Martin J. Kuehn <Martin.Kuehn@DLR.de>
7 *
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
11 *
12 * http://www.apache.org/licenses/LICENSE-2.0
13 *
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 */
20 
25 #ifndef MIO_CONFIG_H
26 #define MIO_CONFIG_H
27 
28 #include "memilio/config_internal.h"
29 
30 using ScalarType = double;
31 
32 namespace ad
33 {
34 namespace internal
35 {
36 // Forward declaration used for support of ad types in Limits.
37 // These templates are called AD_TAPE_REAL and DATA_HANDLER internally in AD.
38 template <class FP, class DataHandler>
39 struct active_type;
40 } // namespace internal
41 } // namespace ad
42 
43 namespace mio
44 {
58 template <typename FP>
59 struct Limits {
60  static constexpr FP zero_tolerance() = delete;
61 };
62 
63 template <>
64 struct Limits<float> {
66  static constexpr float zero_tolerance()
67  {
68  return 1e-6f;
69  }
70 };
71 
72 template <>
73 struct Limits<double> {
75  static constexpr double zero_tolerance()
76  {
77  return 1e-12;
78  }
79 };
80 
81 template <class FP, class DataHandler>
82 struct Limits<ad::internal::active_type<FP, DataHandler>> {
84  static constexpr FP zero_tolerance()
85  {
87  }
88 };
91 } // namespace mio
92 #endif
double ScalarType
Configuration of memilio library.
Definition: memilio/config.h:30
Definition: ad.h:31
A collection of classes to simplify handling of matrix shapes in meta programming.
Definition: models/abm/analyze_result.h:30
static constexpr FP zero_tolerance()
Returns the limit under which an AD value may be rounded down to zero.
Definition: memilio/config.h:84
static constexpr double zero_tolerance()
Returns the limit under which a double may be rounded down to zero.
Definition: memilio/config.h:75
static constexpr float zero_tolerance()
Returns the limit under which a float may be rounded down to zero.
Definition: memilio/config.h:66
Type specific limits for floating-points.
Definition: memilio/config.h:59
static constexpr FP zero_tolerance()=delete