We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent c234e8c commit f732df9Copy full SHA for f732df9
reference/test/matrix/csr_kernels.cpp
@@ -1,4 +1,4 @@
1
-// SPDX-FileCopyrightText: 2017 - 2024 The Ginkgo authors
+// SPDX-FileCopyrightText: 2017 - 2025 The Ginkgo authors
2
//
3
// SPDX-License-Identifier: BSD-3-Clause
4
@@ -518,6 +518,22 @@ TYPED_TEST(Csr, AppliesLinearCombinationToDenseVector)
518
}
519
520
521
+TYPED_TEST(Csr, AppliesLinearCombinationToDenseVectorWithZeroBetaNaN)
522
+{
523
+ using Vec = typename TestFixture::Vec;
524
+ using T = typename TestFixture::value_type;
525
+ auto alpha = gko::initialize<Vec>({-1.0}, this->exec);
526
+ auto beta = gko::initialize<Vec>({0.0}, this->exec);
527
+ auto x = gko::initialize<Vec>({2.0, 1.0, 4.0}, this->exec);
528
+ auto y = gko::initialize<Vec>({gko::nan<T>(), gko::nan<T>()}, this->exec);
529
+
530
+ this->mtx->apply(alpha, x, beta, y);
531
532
+ EXPECT_EQ(y->at(0), T{-13.0});
533
+ EXPECT_EQ(y->at(1), T{-5.0});
534
+}
535
536
537
TYPED_TEST(Csr, MixedAppliesLinearCombinationToDenseVector1)
538
{
539
// Both vectors have the same value type which differs from the matrix
reference/test/matrix/dense_kernels.cpp
@@ -230,6 +230,25 @@ TYPED_TEST(Dense, AppliesLinearCombinationToDense)
230
231
232
233
+TYPED_TEST(Dense, AppliesLinearCombinationToDenseWithZeroBetaNan)
234
235
+ using Mtx = typename TestFixture::Mtx;
236
237
+ auto alpha = gko::initialize<Mtx>({-1.0}, this->exec);
238
+ auto beta = gko::initialize<Mtx>({0.0}, this->exec);
239
+ this->mtx3->fill(gko::nan<T>());
240
241
+ this->mtx2->apply(alpha, this->mtx1, beta, this->mtx3);
242
243
+ EXPECT_EQ(this->mtx3->at(0, 0), T{0.5});
244
+ EXPECT_EQ(this->mtx3->at(0, 1), T{0.5});
245
+ EXPECT_EQ(this->mtx3->at(0, 2), T{0.5});
246
+ EXPECT_EQ(this->mtx3->at(1, 0), T{-1.0});
247
+ EXPECT_EQ(this->mtx3->at(1, 1), T{-1.0});
248
+ EXPECT_EQ(this->mtx3->at(1, 2), T{-1.0});
249
250
251
252
TYPED_TEST(Dense, AppliesLinearCombinationToMixedDense)
253
254
using MixedMtx = typename TestFixture::MixedMtx;
reference/test/matrix/ell_kernels.cpp
@@ -244,6 +244,21 @@ TYPED_TEST(Ell, AppliesLinearCombinationToDenseVector)
+TYPED_TEST(Ell, AppliesLinearCombinationToDenseVectorWithZeroBetaNaN)
255
256
+ this->mtx1->apply(alpha, x, beta, y);
257
258
+ GKO_ASSERT_MTX_NEAR(y, l({-13.0, -5.0}), 0.0);
259
260
261
262
TYPED_TEST(Ell, MixedAppliesLinearCombinationToDenseVector1)
263
264
reference/test/matrix/sellp_kernels.cpp
@@ -114,6 +114,21 @@ TYPED_TEST(Sellp, AppliesLinearCombinationToDenseVector)
114
115
116
117
+TYPED_TEST(Sellp, AppliesLinearCombinationToDenseVectorWithZeroBetaNaN)
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
TYPED_TEST(Sellp, AppliesLinearCombinationToMixedDenseVector)
133
134
using value_type = gko::next_precision<typename TestFixture::value_type>;
reference/test/matrix/sparsity_csr_kernels.cpp
@@ -190,6 +190,22 @@ TYPED_TEST(SparsityCsr, AppliesLinearCombinationToDenseVector)
190
191
192
193
+TYPED_TEST(SparsityCsr, AppliesLinearCombinationToDenseVectorWithZeroBetaNaN)
194
195
196
197
198
199
200
201
202
203
204
+ EXPECT_EQ(y->at(0), T{-7.0});
205
+ EXPECT_EQ(y->at(1), T{-1.0});
206
207
208
209
TYPED_TEST(SparsityCsr, AppliesLinearCombinationToMixedDenseVector)
210
211
using T = gko::next_precision<typename TestFixture::value_type>;
0 commit comments