Skip to content

Commit 0351f48

Browse files
yhmtsaiMarcelKoch
andcommitted
update the type name and add more assert to check foci
Co-authored-by: Marcel Koch <marcel.koch@kit.edu>
1 parent e8cba61 commit 0351f48

3 files changed

Lines changed: 14 additions & 11 deletions

File tree

common/unified/solver/chebyshev_kernels.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,13 @@ void init_update(std::shared_ptr<const DefaultExecutor> exec,
4747
matrix::Dense<ValueType>* update_sol,
4848
matrix::Dense<ValueType>* output)
4949
{
50-
using backend_coeff_type =
50+
using coeff_type =
5151
if_single_only_type<solver::detail::coeff_type<ValueType>>;
52-
// the backend_coeff_type always be the highest precision, so we need
52+
// the coeff_type always be the highest precision, so we need
5353
// to cast the others from ValueType to this precision.
54-
using arithmetic_type = device_type<backend_coeff_type>;
54+
using arithmetic_type = device_type<coeff_type>;
5555

56-
auto alpha_val = static_cast<backend_coeff_type>(alpha);
56+
auto alpha_val = static_cast<coeff_type>(alpha);
5757

5858
run_kernel(
5959
exec,
@@ -81,14 +81,14 @@ void update(std::shared_ptr<const DefaultExecutor> exec,
8181
matrix::Dense<ValueType>* update_sol,
8282
matrix::Dense<ValueType>* output)
8383
{
84-
using backend_coeff_type =
84+
using coeff_type =
8585
if_single_only_type<solver::detail::coeff_type<ValueType>>;
86-
// the backend_coeff_type always be the highest precision, so we need
86+
// the coeff_type always be the highest precision, so we need
8787
// to cast the others from ValueType to this precision.
88-
using arithmetic_type = device_type<backend_coeff_type>;
88+
using arithmetic_type = device_type<coeff_type>;
8989

90-
auto alpha_val = static_cast<backend_coeff_type>(alpha);
91-
auto beta_val = static_cast<backend_coeff_type>(beta);
90+
auto alpha_val = static_cast<coeff_type>(alpha);
91+
auto beta_val = static_cast<coeff_type>(beta);
9292

9393
run_kernel(
9494
exec,

core/solver/chebyshev.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,13 @@ Chebyshev<ValueType>::Chebyshev(const Factory* factory,
8585
auto left_foci = std::get<0>(parameters_.foci);
8686
auto right_foci = std::get<1>(parameters_.foci);
8787
GKO_ASSERT(real(left_foci) <= real(right_foci));
88+
GKO_ASSERT(is_nonzero(left_foci) || is_nonzero(right_foci));
8889
center_ =
8990
(left_foci + right_foci) / solver::detail::coeff_type<ValueType>{2};
9091
foci_direction_ =
9192
(right_foci - left_foci) / solver::detail::coeff_type<ValueType>{2};
93+
// if the center is zero then the alpha will be inf
94+
GKO_ASSERT(is_nonzero(center_));
9295
}
9396

9497

reference/solver/chebyshev_kernels.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ void init_update(std::shared_ptr<const DefaultExecutor> exec,
2020
matrix::Dense<ValueType>* update_sol,
2121
matrix::Dense<ValueType>* output)
2222
{
23-
// the backend_coeff_type always be the highest precision, so we need
23+
// the coeff_type always be the highest precision, so we need
2424
// to cast the others from ValueType to this precision.
2525
using arithmetic_type = solver::detail::coeff_type<ValueType>;
2626
for (size_t row = 0; row < output->get_size()[0]; row++) {
@@ -46,7 +46,7 @@ void update(std::shared_ptr<const DefaultExecutor> exec,
4646
matrix::Dense<ValueType>* update_sol,
4747
matrix::Dense<ValueType>* output)
4848
{
49-
// the backend_coeff_type always be the highest precision, so we need
49+
// the coeff_type always be the highest precision, so we need
5050
// to cast the others from ValueType to this precision.
5151
using arithmetic_type = solver::detail::coeff_type<ValueType>;
5252
for (size_t row = 0; row < output->get_size()[0]; row++) {

0 commit comments

Comments
 (0)