Ifpack2 Templated Preconditioning Package Version 1.0
Loading...
Searching...
No Matches
Ifpack2_Details_Chebyshev_Weights.hpp
Go to the documentation of this file.
1/*
2//@HEADER
3// ***********************************************************************
4//
5// Ifpack2: Templated Object-Oriented Algebraic Preconditioner Package
6// Copyright (2009) Sandia Corporation
7//
8// Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
9// license for use of this work by or on behalf of the U.S. Government.
10//
11// Redistribution and use in source and binary forms, with or without
12// modification, are permitted provided that the following conditions are
13// met:
14//
15// 1. Redistributions of source code must retain the above copyright
16// notice, this list of conditions and the following disclaimer.
17//
18// 2. Redistributions in binary form must reproduce the above copyright
19// notice, this list of conditions and the following disclaimer in the
20// documentation and/or other materials provided with the distribution.
21//
22// 3. Neither the name of the Corporation nor the names of the
23// contributors may be used to endorse or promote products derived from
24// this software without specific prior written permission.
25//
26// THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
27// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
30// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
31// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
32// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
33// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
34// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
35// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
36// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37//
38// Questions? Contact Michael A. Heroux (maherou@sandia.gov)
39//
40// ***********************************************************************
41//@HEADER
42*/
43
44#ifndef IFPACK2_DETAILS_CHEBYSHEV_WEIGHTS_HPP
45#define IFPACK2_DETAILS_CHEBYSHEV_WEIGHTS_HPP
46
47#include <stdexcept>
48#include <vector>
49#include "Teuchos_StandardParameterEntryValidators.hpp"
50
58
59
60namespace Ifpack2 {
61namespace Details {
62
73 template<typename ScalarType>
74 std::vector<ScalarType>
75 optimalWeightsImpl (const int chebyOrder)
76 {
77 if (chebyOrder == 0){
78 return {};
79 }
80 if (chebyOrder == 1){
81 return {
82 1.12500000000000,
83 };
84 }
85
86 if (chebyOrder == 2){
87 return {
88 1.02387287570313,
89 1.26408905371085,
90 };
91 }
92
93 if (chebyOrder == 3){
94 return {
95 1.00842544782028,
96 1.08867839208730,
97 1.33753125909618,
98 };
99 }
100
101 if (chebyOrder == 4){
102 return {
103 1.00391310427285,
104 1.04035811188593,
105 1.14863498546254,
106 1.38268869241000,
107 };
108 }
109
110 if (chebyOrder == 5){
111 return {
112 1.00212930146164,
113 1.02173711549260,
114 1.07872433192603,
115 1.19810065292663,
116 1.41322542791682,
117 };
118 }
119
120 if (chebyOrder == 6){
121 return {
122 1.00128517255940,
123 1.01304293035233,
124 1.04678215124113,
125 1.11616489419675,
126 1.23829020218444,
127 1.43524297106744,
128 };
129 }
130
131 if (chebyOrder == 7){
132 return {
133 1.00083464397912,
134 1.00843949430122,
135 1.03008707768713,
136 1.07408384092003,
137 1.15036186707366,
138 1.27116474046139,
139 1.45186658649364,
140 };
141 }
142
143 if (chebyOrder == 8){
144 return {
145 1.00057246631197,
146 1.00577427662415,
147 1.02050187922941,
148 1.05019803444565,
149 1.10115572984941,
150 1.18086042806856,
151 1.29838585382576,
152 1.46486073151099,
153 };
154 }
155
156 if (chebyOrder == 9){
157 return {
158 1.00040960072832,
159 1.00412439506106,
160 1.01460212148266,
161 1.03561113626671,
162 1.07139972529194,
163 1.12688273710962,
164 1.20785219140729,
165 1.32121930716746,
166 1.47529642820699,
167 };
168 }
169
170 if (chebyOrder == 10){
171 return {
172 1.00030312229652,
173 1.00304840660796,
174 1.01077022715387,
175 1.02619011597640,
176 1.05231724933755,
177 1.09255743207549,
178 1.15083376663972,
179 1.23172250870894,
180 1.34060802024460,
181 1.48386124407011,
182 };
183 }
184
185 if (chebyOrder == 11){
186 return {
187 1.00023058595209,
188 1.00231675024028,
189 1.00817245396304,
190 1.01982986566342,
191 1.03950210235324,
192 1.06965042700541,
193 1.11305754295742,
194 1.17290876275564,
195 1.25288300576792,
196 1.35725579919519,
197 1.49101672564139,
198 };
199 }
200
201 if (chebyOrder == 12){
202 return {
203 1.00017947200828,
204 1.00180189139619,
205 1.00634861907307,
206 1.01537864566306,
207 1.03056942830760,
208 1.05376019693943,
209 1.08699862592072,
210 1.13259183097913,
211 1.19316273358172,
212 1.27171293675110,
213 1.37169337969799,
214 1.49708418575562,
215 };
216 }
217
218 if (chebyOrder == 13){
219 return {
220 1.00014241921559,
221 1.00142906932629,
222 1.00503028986298,
223 1.01216910518495,
224 1.02414874342792,
225 1.04238158880820,
226 1.06842008128700,
227 1.10399010936759,
228 1.15102748242645,
229 1.21171811910125,
230 1.28854264865128,
231 1.38432619380991,
232 1.50229418757368,
233 };
234 }
235
236 if (chebyOrder == 14){
237 return {
238 1.00011490538261,
239 1.00115246376914,
240 1.00405357333264,
241 1.00979590573153,
242 1.01941300472994,
243 1.03401425035436,
244 1.05480599606629,
245 1.08311420301813,
246 1.12040891660892,
247 1.16833095655446,
248 1.22872122288238,
249 1.30365305707817,
250 1.39546814053678,
251 1.50681646209583,
252 };
253 }
254
255 if (chebyOrder == 15){
256 return {
257 1.00009404750752,
258 1.00094291696343,
259 1.00331449056444,
260 1.00800294833816,
261 1.01584236259140,
262 1.02772083317705,
263 1.04459535422831,
264 1.06750761206125,
265 1.09760092545889,
266 1.13613855366157,
267 1.18452361426236,
268 1.24432087304475,
269 1.31728069083392,
270 1.40536543893560,
271 1.51077872501845,
272 };
273 }
274
275 if (chebyOrder == 16){
276 return {
277 1.00007794828179,
278 1.00078126847253,
279 1.00274487974401,
280 1.00662291017015,
281 1.01309858836971,
282 1.02289448329337,
283 1.03678321409983,
284 1.05559875719896,
285 1.08024848405560,
286 1.11172607131497,
287 1.15112543431072,
288 1.19965584614973,
289 1.25865841744946,
290 1.32962412656664,
291 1.41421360695576,
292 1.51427891730346,
293 };
294 }
295
296 TEUCHOS_TEST_FOR_EXCEPTION(
297 true, std::runtime_error, "Ifpack2::Details::optimalWeightsImpl::"
298 "Requested Chebyshev order exceeds maximum of 16."
299 );
300 }
301
302} // namespace Details
303} // namespace Ifpack2
304
305#endif // IFPACK2_DETAILS_CHEBYSHEV_WEIGHTS_HPP
std::vector< ScalarType > optimalWeightsImpl(const int chebyOrder)
Generate optimal weights for using the fourth kind Chebyshev polynomials see: https://arxiv....
Definition Ifpack2_Details_Chebyshev_Weights.hpp:75
Preconditioners and smoothers for Tpetra sparse matrices.
Definition Ifpack2_AdditiveSchwarz_decl.hpp:74