glucat  0.8.4
tuning.h
Go to the documentation of this file.
1 #ifndef GLUCAT_TEST_TUNING_H
2 #define GLUCAT_TEST_TUNING_H
3 /***************************************************************************
4  GluCat : Generic library of universal Clifford algebra templates
5  tuning.h : Use preprocessor macros to control test tuning
6  -------------------
7  begin : Sun 2001-12-09
8  copyright : (C) 2001-2016 by Paul C. Leopardi
9  ***************************************************************************
10 
11  This library is free software: you can redistribute it and/or modify
12  it under the terms of the GNU Lesser General Public License as published
13  by the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  This library is distributed in the hope that it will be useful,
17  but WITHOUT ANY WARRANTY; without even the implied warranty of
18  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  GNU Lesser General Public License for more details.
20 
21  You should have received a copy of the GNU Lesser General Public License
22  along with this library. If not, see <http://www.gnu.org/licenses/>.
23 
24  ***************************************************************************
25  This library is based on a prototype written by Arvind Raja and was
26  licensed under the LGPL with permission of the author. See Arvind Raja,
27  "Object-oriented implementations of Clifford algebras in C++: a prototype",
28  in Ablamowicz, Lounesto and Parra (eds.)
29  "Clifford algebras with numeric and symbolic computations", Birkhauser, 1996.
30  ***************************************************************************
31  See also Arvind Raja's original header comments in glucat.h
32  ***************************************************************************/
33 
34 // If radix of int is not 2, we can't easily set thresholds
35 _GLUCAT_CTAssert(std::numeric_limits<unsigned int>::radix == 2, CannotSetThresholds)
36 const unsigned int Test_Tuning_Int_Digits = std::numeric_limits<int>::digits;
37 const unsigned int Test_Tuning_Max_Threshold = 1 << Test_Tuning_Int_Digits;
38 
40 
41 #define __TEST_TUNING_DEFAULT_CONSTANT(SUFFIX) \
42 const unsigned int Test_Tuning_##SUFFIX = glucat::DEFAULT_##SUFFIX
43 
44 // Tuning policy constants
45 #if defined ( _GLUCAT_TEST_TUNING_SLOW )
46 const unsigned int Test_Tuning_Mult_Matrix_Threshold = Test_Tuning_Max_Threshold;
47 __TEST_TUNING_DEFAULT_CONSTANT(Div_Max_Steps);
48 __TEST_TUNING_DEFAULT_CONSTANT(Sqrt_Max_Steps);
49 __TEST_TUNING_DEFAULT_CONSTANT(Log_Max_Outer_Steps);
50 __TEST_TUNING_DEFAULT_CONSTANT(Log_Max_Inner_Steps);
51 const unsigned int Test_Tuning_Basis_Max_Count = 0;
52 const unsigned int Test_Tuning_Fast_Size_Threshold = Test_Tuning_Max_Threshold;
53 const unsigned int Test_Tuning_Inv_Fast_Dim_Threshold = Test_Tuning_Max_Threshold;
54 const unsigned int Test_Tuning_Products_Size_Threshold = Test_Tuning_Max_Threshold;
56 #elif defined ( _GLUCAT_TEST_TUNING_NAIVE )
57 const unsigned int Test_Tuning_Mult_Matrix_Threshold = 0;
58 __TEST_TUNING_DEFAULT_CONSTANT(Div_Max_Steps);
59 __TEST_TUNING_DEFAULT_CONSTANT(Sqrt_Max_Steps);
60 __TEST_TUNING_DEFAULT_CONSTANT(Log_Max_Outer_Steps);
61 __TEST_TUNING_DEFAULT_CONSTANT(Log_Max_Inner_Steps);
62 const unsigned int Test_Tuning_Basis_Max_Count = Test_Tuning_Max_Threshold;
63 const unsigned int Test_Tuning_Fast_Size_Threshold = Test_Tuning_Max_Threshold;
64 const unsigned int Test_Tuning_Inv_Fast_Dim_Threshold = Test_Tuning_Max_Threshold;
65 __TEST_TUNING_DEFAULT_CONSTANT(Products_Size_Threshold);
67 #elif defined ( _GLUCAT_TEST_TUNING_FAST )
68 const unsigned int Test_Tuning_Mult_Matrix_Threshold = 0;
69 const unsigned int Test_Tuning_Div_Max_Steps = 0;
70 const unsigned int Test_Tuning_Sqrt_Max_Steps = 16;
71 const unsigned int Test_Tuning_Log_Max_Outer_Steps = 16;
72 const unsigned int Test_Tuning_Log_Max_Inner_Steps = 8;
73 const unsigned int Test_Tuning_Basis_Max_Count = 1;
74 const unsigned int Test_Tuning_Fast_Size_Threshold = 0;
75 const unsigned int Test_Tuning_Inv_Fast_Dim_Threshold = 0;
76 const unsigned int Test_Tuning_Products_Size_Threshold = 0;
78 #elif defined ( _GLUCAT_TEST_TUNING_PROMOTED )
79 __TEST_TUNING_DEFAULT_CONSTANT(Mult_Matrix_Threshold);
80 __TEST_TUNING_DEFAULT_CONSTANT(Div_Max_Steps);
81 __TEST_TUNING_DEFAULT_CONSTANT(Sqrt_Max_Steps);
82 __TEST_TUNING_DEFAULT_CONSTANT(Log_Max_Outer_Steps);
83 __TEST_TUNING_DEFAULT_CONSTANT(Log_Max_Inner_Steps);
84 __TEST_TUNING_DEFAULT_CONSTANT(Basis_Max_Count);
85 __TEST_TUNING_DEFAULT_CONSTANT(Fast_Size_Threshold);
86 __TEST_TUNING_DEFAULT_CONSTANT(Inv_Fast_Dim_Threshold);
87 __TEST_TUNING_DEFAULT_CONSTANT(Products_Size_Threshold);
89 #elif defined ( _GLUCAT_TEST_TUNING_DEMOTED )
90 __TEST_TUNING_DEFAULT_CONSTANT(Mult_Matrix_Threshold);
91 __TEST_TUNING_DEFAULT_CONSTANT(Div_Max_Steps);
92 __TEST_TUNING_DEFAULT_CONSTANT(Sqrt_Max_Steps);
93 __TEST_TUNING_DEFAULT_CONSTANT(Log_Max_Outer_Steps);
94 __TEST_TUNING_DEFAULT_CONSTANT(Log_Max_Inner_Steps);
95 __TEST_TUNING_DEFAULT_CONSTANT(Basis_Max_Count);
96 __TEST_TUNING_DEFAULT_CONSTANT(Fast_Size_Threshold);
97 __TEST_TUNING_DEFAULT_CONSTANT(Inv_Fast_Dim_Threshold);
98 __TEST_TUNING_DEFAULT_CONSTANT(Products_Size_Threshold);
100 #else
101 __TEST_TUNING_DEFAULT_CONSTANT(Mult_Matrix_Threshold);
104 __TEST_TUNING_DEFAULT_CONSTANT(Log_Max_Outer_Steps);
105 __TEST_TUNING_DEFAULT_CONSTANT(Log_Max_Inner_Steps);
107 __TEST_TUNING_DEFAULT_CONSTANT(Fast_Size_Threshold);
108 __TEST_TUNING_DEFAULT_CONSTANT(Inv_Fast_Dim_Threshold);
109 __TEST_TUNING_DEFAULT_CONSTANT(Products_Size_Threshold);
111 #endif
112 
114 typedef glucat::tuning
115  <
116  Test_Tuning_Mult_Matrix_Threshold,
117  Test_Tuning_Div_Max_Steps,
118  Test_Tuning_Sqrt_Max_Steps,
119  Test_Tuning_Log_Max_Outer_Steps,
120  Test_Tuning_Log_Max_Inner_Steps,
121  Test_Tuning_Basis_Max_Count,
122  Test_Tuning_Fast_Size_Threshold,
123  Test_Tuning_Inv_Fast_Dim_Threshold,
124  Test_Tuning_Products_Size_Threshold,
127 
128 #undef __TEST_TUNING_DEFAULT_CONSTANT
129 
130 #endif // GLUCAT_TEST_TUNING_H
Tune_P
glucat::tuning< Test_Tuning_Mult_Matrix_Threshold, Test_Tuning_Div_Max_Steps, Test_Tuning_Sqrt_Max_Steps, Test_Tuning_Log_Max_Outer_Steps, Test_Tuning_Log_Max_Inner_Steps, Test_Tuning_Basis_Max_Count, Test_Tuning_Fast_Size_Threshold, Test_Tuning_Inv_Fast_Dim_Threshold, Test_Tuning_Products_Size_Threshold, Test_Tuning_Function_Precision > Tune_P
Tuning policy.
Definition: tuning.h:126
glucat::precision_demoted
@ precision_demoted
Definition: global.h:148
Test_Tuning_Max_Threshold
const unsigned int Test_Tuning_Max_Threshold
Definition: tuning.h:37
glucat::tuning
Tuning policy.
Definition: global.h:181
glucat::DEFAULT_Function_Precision
const precision_t DEFAULT_Function_Precision
Definition: global.h:163
glucat::precision_promoted
@ precision_promoted
Definition: global.h:150
precision_t
glucat::precision_t precision_t
Definition: tuning.h:39
_GLUCAT_CTAssert
_GLUCAT_CTAssert(std::numeric_limits< unsigned int >::radix==2, CannotSetThresholds) const unsigned int Test_Tuning_Int_Digits
glucat::precision_t
precision_t
Precision policy.
Definition: global.h:147
__TEST_TUNING_DEFAULT_CONSTANT
#define __TEST_TUNING_DEFAULT_CONSTANT(SUFFIX)
Definition: tuning.h:41
Test_Tuning_Function_Precision
const precision_t Test_Tuning_Function_Precision
Definition: tuning.h:110