Ifpack2 Templated Preconditioning Package  Version 1.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Ifpack2_Details_Chebyshev_Weights.hpp
Go to the documentation of this file.
1 // @HEADER
2 // *****************************************************************************
3 // Ifpack2: Templated Object-Oriented Algebraic Preconditioner Package
4 //
5 // Copyright 2009 NTESS and the Ifpack2 contributors.
6 // SPDX-License-Identifier: BSD-3-Clause
7 // *****************************************************************************
8 // @HEADER
9 
10 #ifndef IFPACK2_DETAILS_CHEBYSHEV_WEIGHTS_HPP
11 #define IFPACK2_DETAILS_CHEBYSHEV_WEIGHTS_HPP
12 
13 #include <stdexcept>
14 #include <vector>
15 #include "Teuchos_StandardParameterEntryValidators.hpp"
16 
24 
25 namespace Ifpack2 {
26 namespace Details {
27 
38 template <typename ScalarType>
39 std::vector<ScalarType>
40 optimalWeightsImpl(const int chebyOrder) {
41  if (chebyOrder == 0) {
42  return {};
43  }
44  if (chebyOrder == 1) {
45  return {
46  1.12500000000000,
47  };
48  }
49 
50  if (chebyOrder == 2) {
51  return {
52  1.02387287570313,
53  1.26408905371085,
54  };
55  }
56 
57  if (chebyOrder == 3) {
58  return {
59  1.00842544782028,
60  1.08867839208730,
61  1.33753125909618,
62  };
63  }
64 
65  if (chebyOrder == 4) {
66  return {
67  1.00391310427285,
68  1.04035811188593,
69  1.14863498546254,
70  1.38268869241000,
71  };
72  }
73 
74  if (chebyOrder == 5) {
75  return {
76  1.00212930146164,
77  1.02173711549260,
78  1.07872433192603,
79  1.19810065292663,
80  1.41322542791682,
81  };
82  }
83 
84  if (chebyOrder == 6) {
85  return {
86  1.00128517255940,
87  1.01304293035233,
88  1.04678215124113,
89  1.11616489419675,
90  1.23829020218444,
91  1.43524297106744,
92  };
93  }
94 
95  if (chebyOrder == 7) {
96  return {
97  1.00083464397912,
98  1.00843949430122,
99  1.03008707768713,
100  1.07408384092003,
101  1.15036186707366,
102  1.27116474046139,
103  1.45186658649364,
104  };
105  }
106 
107  if (chebyOrder == 8) {
108  return {
109  1.00057246631197,
110  1.00577427662415,
111  1.02050187922941,
112  1.05019803444565,
113  1.10115572984941,
114  1.18086042806856,
115  1.29838585382576,
116  1.46486073151099,
117  };
118  }
119 
120  if (chebyOrder == 9) {
121  return {
122  1.00040960072832,
123  1.00412439506106,
124  1.01460212148266,
125  1.03561113626671,
126  1.07139972529194,
127  1.12688273710962,
128  1.20785219140729,
129  1.32121930716746,
130  1.47529642820699,
131  };
132  }
133 
134  if (chebyOrder == 10) {
135  return {
136  1.00030312229652,
137  1.00304840660796,
138  1.01077022715387,
139  1.02619011597640,
140  1.05231724933755,
141  1.09255743207549,
142  1.15083376663972,
143  1.23172250870894,
144  1.34060802024460,
145  1.48386124407011,
146  };
147  }
148 
149  if (chebyOrder == 11) {
150  return {
151  1.00023058595209,
152  1.00231675024028,
153  1.00817245396304,
154  1.01982986566342,
155  1.03950210235324,
156  1.06965042700541,
157  1.11305754295742,
158  1.17290876275564,
159  1.25288300576792,
160  1.35725579919519,
161  1.49101672564139,
162  };
163  }
164 
165  if (chebyOrder == 12) {
166  return {
167  1.00017947200828,
168  1.00180189139619,
169  1.00634861907307,
170  1.01537864566306,
171  1.03056942830760,
172  1.05376019693943,
173  1.08699862592072,
174  1.13259183097913,
175  1.19316273358172,
176  1.27171293675110,
177  1.37169337969799,
178  1.49708418575562,
179  };
180  }
181 
182  if (chebyOrder == 13) {
183  return {
184  1.00014241921559,
185  1.00142906932629,
186  1.00503028986298,
187  1.01216910518495,
188  1.02414874342792,
189  1.04238158880820,
190  1.06842008128700,
191  1.10399010936759,
192  1.15102748242645,
193  1.21171811910125,
194  1.28854264865128,
195  1.38432619380991,
196  1.50229418757368,
197  };
198  }
199 
200  if (chebyOrder == 14) {
201  return {
202  1.00011490538261,
203  1.00115246376914,
204  1.00405357333264,
205  1.00979590573153,
206  1.01941300472994,
207  1.03401425035436,
208  1.05480599606629,
209  1.08311420301813,
210  1.12040891660892,
211  1.16833095655446,
212  1.22872122288238,
213  1.30365305707817,
214  1.39546814053678,
215  1.50681646209583,
216  };
217  }
218 
219  if (chebyOrder == 15) {
220  return {
221  1.00009404750752,
222  1.00094291696343,
223  1.00331449056444,
224  1.00800294833816,
225  1.01584236259140,
226  1.02772083317705,
227  1.04459535422831,
228  1.06750761206125,
229  1.09760092545889,
230  1.13613855366157,
231  1.18452361426236,
232  1.24432087304475,
233  1.31728069083392,
234  1.40536543893560,
235  1.51077872501845,
236  };
237  }
238 
239  if (chebyOrder == 16) {
240  return {
241  1.00007794828179,
242  1.00078126847253,
243  1.00274487974401,
244  1.00662291017015,
245  1.01309858836971,
246  1.02289448329337,
247  1.03678321409983,
248  1.05559875719896,
249  1.08024848405560,
250  1.11172607131497,
251  1.15112543431072,
252  1.19965584614973,
253  1.25865841744946,
254  1.32962412656664,
255  1.41421360695576,
256  1.51427891730346,
257  };
258  }
259 
261  true, std::runtime_error,
262  "Ifpack2::Details::optimalWeightsImpl::"
263  "Requested Chebyshev order exceeds maximum of 16.");
264 }
265 
266 } // namespace Details
267 } // namespace Ifpack2
268 
269 #endif // IFPACK2_DETAILS_CHEBYSHEV_WEIGHTS_HPP
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)