|
1 | | -// SPDX-FileCopyrightText: 2017 - 2024 The Ginkgo authors |
| 1 | +// SPDX-FileCopyrightText: 2017 - 2025 The Ginkgo authors |
2 | 2 | // |
3 | 3 | // SPDX-License-Identifier: BSD-3-Clause |
4 | 4 |
|
|
7 | 7 |
|
8 | 8 |
|
9 | 9 | #include <limits> |
10 | | -#include <type_traits> |
11 | 10 |
|
12 | 11 | #include <ginkgo/core/base/array.hpp> |
13 | 12 | #include <ginkgo/core/base/math.hpp> |
@@ -121,9 +120,14 @@ class ResidualNorm : public ResidualNormBase<ValueType> { |
121 | 120 | /** |
122 | 121 | * Residual norm reduction factor |
123 | 122 | */ |
124 | | - remove_complex<ValueType> GKO_FACTORY_PARAMETER_SCALAR( |
125 | | - reduction_factor, |
126 | | - 5 * std::numeric_limits<remove_complex<ValueType>>::epsilon()); |
| 123 | + remove_complex<ValueType> reduction_factor{ |
| 124 | + 5 * std ::numeric_limits<remove_complex<ValueType>>::epsilon()}; |
| 125 | + |
| 126 | + parameters_type& with_reduction_factor(remove_complex<ValueType> value) |
| 127 | + { |
| 128 | + this->reduction_factor = value; |
| 129 | + return *this; |
| 130 | + } |
127 | 131 |
|
128 | 132 | /** |
129 | 133 | * The quantity the reduction is relative to. Choices include |
@@ -178,9 +182,14 @@ class ImplicitResidualNorm : public ResidualNormBase<ValueType> { |
178 | 182 | /** |
179 | 183 | * Implicit Residual norm goal |
180 | 184 | */ |
181 | | - remove_complex<ValueType> GKO_FACTORY_PARAMETER_SCALAR( |
182 | | - reduction_factor, |
183 | | - 5 * std::numeric_limits<remove_complex<ValueType>>::epsilon()); |
| 185 | + remove_complex<ValueType> reduction_factor{ |
| 186 | + 5 * std ::numeric_limits<remove_complex<ValueType>>::epsilon()}; |
| 187 | + |
| 188 | + parameters_type& with_reduction_factor(remove_complex<ValueType> value) |
| 189 | + { |
| 190 | + this->reduction_factor = value; |
| 191 | + return *this; |
| 192 | + } |
184 | 193 |
|
185 | 194 | /** |
186 | 195 | * The quantity the reduction is relative to. Choices include |
@@ -254,9 +263,14 @@ class GKO_DEPRECATED( |
254 | 263 | /** |
255 | 264 | * Factor by which the residual norm will be reduced |
256 | 265 | */ |
257 | | - remove_complex<ValueType> GKO_FACTORY_PARAMETER_SCALAR( |
258 | | - reduction_factor, |
259 | | - 5 * std::numeric_limits<remove_complex<ValueType>>::epsilon()); |
| 266 | + remove_complex<ValueType> reduction_factor{ |
| 267 | + 5 * std ::numeric_limits<remove_complex<ValueType>>::epsilon()}; |
| 268 | + |
| 269 | + parameters_type& with_reduction_factor(remove_complex<ValueType> value) |
| 270 | + { |
| 271 | + this->reduction_factor = value; |
| 272 | + return *this; |
| 273 | + } |
260 | 274 | }; |
261 | 275 | GKO_ENABLE_CRITERION_FACTORY(ResidualNormReduction<ValueType>, parameters, |
262 | 276 | Factory); |
@@ -311,9 +325,15 @@ class GKO_DEPRECATED( |
311 | 325 | /** |
312 | 326 | * Relative residual norm goal |
313 | 327 | */ |
314 | | - remove_complex<ValueType> GKO_FACTORY_PARAMETER_SCALAR( |
315 | | - tolerance, |
316 | | - 5 * std::numeric_limits<remove_complex<ValueType>>::epsilon()); |
| 328 | + remove_complex<ValueType> tolerance{ |
| 329 | + 5 * std ::numeric_limits<remove_complex<ValueType>>::epsilon()}; |
| 330 | + |
| 331 | + |
| 332 | + parameters_type& with_tolerance(remove_complex<ValueType> value) |
| 333 | + { |
| 334 | + this->tolerance = value; |
| 335 | + return *this; |
| 336 | + } |
317 | 337 | }; |
318 | 338 | GKO_ENABLE_CRITERION_FACTORY(RelativeResidualNorm<ValueType>, parameters, |
319 | 339 | Factory); |
@@ -365,9 +385,14 @@ class GKO_DEPRECATED( |
365 | 385 | /** |
366 | 386 | * Absolute residual norm goal |
367 | 387 | */ |
368 | | - remove_complex<ValueType> GKO_FACTORY_PARAMETER_SCALAR( |
369 | | - tolerance, |
370 | | - 5 * std::numeric_limits<remove_complex<ValueType>>::epsilon()); |
| 388 | + remove_complex<ValueType> tolerance{ |
| 389 | + 5 * std ::numeric_limits<remove_complex<ValueType>>::epsilon()}; |
| 390 | + |
| 391 | + parameters_type& with_tolerance(remove_complex<ValueType> value) |
| 392 | + { |
| 393 | + this->tolerance = value; |
| 394 | + return *this; |
| 395 | + } |
371 | 396 | }; |
372 | 397 | GKO_ENABLE_CRITERION_FACTORY(AbsoluteResidualNorm<ValueType>, parameters, |
373 | 398 | Factory); |
|
0 commit comments