Skip to content

Commit b22f271

Browse files
yhmtsaiMarcelKochpratikvn
committed
update the documentation and format
Co-authored-by: Marcel Koch <[email protected]> Co-authored-by: Pratik Nayak <[email protected]>
1 parent d0e9585 commit b22f271

File tree

9 files changed

+39
-20
lines changed

9 files changed

+39
-20
lines changed

common/unified/preconditioner/jacobi_kernels.cpp

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// SPDX-FileCopyrightText: 2017 - 2024 The Ginkgo authors
1+
// SPDX-FileCopyrightText: 2017 - 2025 The Ginkgo authors
22
//
33
// SPDX-License-Identifier: BSD-3-Clause
44

@@ -140,6 +140,9 @@ void scalar_l1(std::shared_ptr<const DefaultExecutor> exec,
140140
}
141141
off_diag += abs(vals[i]);
142142
}
143+
// TODO: It is unclear effect when this applies to negative diagonal
144+
// value. The reference paper only discusses the positive diagonal
145+
// value.
143146
diag[row] += off_diag;
144147
},
145148
csr->get_size()[0], csr->get_const_row_ptrs(),
@@ -179,6 +182,9 @@ void block_l1(std::shared_ptr<const DefaultExecutor> exec, size_type num_blocks,
179182
}
180183
off_diag += abs(vals[i]);
181184
}
185+
// TODO: It is unclear effect when this applies to negative
186+
// diagonal value. The reference paper only discusses the
187+
// positive diagonal value.
182188
vals[diag_idx] += off_diag;
183189
}
184190
},

core/preconditioner/jacobi.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// SPDX-FileCopyrightText: 2017 - 2024 The Ginkgo authors
1+
// SPDX-FileCopyrightText: 2017 - 2025 The Ginkgo authors
22
//
33
// SPDX-License-Identifier: BSD-3-Clause
44

core/preconditioner/jacobi_kernels.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// SPDX-FileCopyrightText: 2017 - 2024 The Ginkgo authors
1+
// SPDX-FileCopyrightText: 2017 - 2025 The Ginkgo authors
22
//
33
// SPDX-License-Identifier: BSD-3-Clause
44

core/test/config/preconditioner.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// SPDX-FileCopyrightText: 2017 - 2024 The Ginkgo authors
1+
// SPDX-FileCopyrightText: 2017 - 2025 The Ginkgo authors
22
//
33
// SPDX-License-Identifier: BSD-3-Clause
44

core/test/preconditioner/jacobi.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// SPDX-FileCopyrightText: 2017 - 2024 The Ginkgo authors
1+
// SPDX-FileCopyrightText: 2017 - 2025 The Ginkgo authors
22
//
33
// SPDX-License-Identifier: BSD-3-Clause
44

include/ginkgo/core/preconditioner/jacobi.hpp

+9-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// SPDX-FileCopyrightText: 2017 - 2024 The Ginkgo authors
1+
// SPDX-FileCopyrightText: 2017 - 2025 The Ginkgo authors
22
//
33
// SPDX-License-Identifier: BSD-3-Clause
44

@@ -373,9 +373,14 @@ class Jacobi : public EnableLinOp<Jacobi<ValueType, IndexType>>,
373373

374374
/**
375375
* Use L1 Jacboi, which is introduced in the paper A. H. Baker et al.
376-
* "Multigrid smoothers for ultraparallel computing."
377-
* If it is true, it generates the preconditioner on A + Diag(sum_{k in
378-
* off diagonal block of i} A_ik) not A.
376+
* "Multigrid smoothers for ultraparallel computing." This paper
377+
* discusses this type of smoother with the following matrix property.
378+
* $ A_{ii} \geq \theta \sum_{j \in \text{off diagonal block}} |A_{ij}|,
379+
* \theta \geq 0 $
380+
* If it is true, it generates the preconditioner on A +
381+
* Diag(sum_{k in off-diagonal block of i} |A_ik|) not A. We aggregate
382+
* the L1 norm of the value with the same row in the off-diagonal block
383+
* into the diagonal value.
379384
*/
380385
bool GKO_FACTORY_PARAMETER_SCALAR(aggregate_l1, false);
381386

reference/preconditioner/jacobi_kernels.cpp

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// SPDX-FileCopyrightText: 2017 - 2024 The Ginkgo authors
1+
// SPDX-FileCopyrightText: 2017 - 2025 The Ginkgo authors
22
//
33
// SPDX-License-Identifier: BSD-3-Clause
44

@@ -738,6 +738,9 @@ void scalar_l1(std::shared_ptr<const DefaultExecutor> exec,
738738
}
739739
off_diag += abs(csr->get_const_values()[i]);
740740
}
741+
// TODO: It is unclear effect when this applies to negative diagonal
742+
// value. The reference paper only discusses the positive diagonal
743+
// value.
741744
diag->get_values()[row] += off_diag;
742745
}
743746
}
@@ -768,6 +771,9 @@ void block_l1(std::shared_ptr<const DefaultExecutor> exec, size_type num_blocks,
768771
}
769772
off_diag += abs(csr->get_const_values()[i]);
770773
}
774+
// TODO: It is unclear effect when this applies to negative diagonal
775+
// value. The reference paper only discusses the positive diagonal
776+
// value.
771777
csr->get_values()[diag_idx] += off_diag;
772778
}
773779
}

reference/test/preconditioner/jacobi_kernels.cpp

+10-8
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// SPDX-FileCopyrightText: 2017 - 2024 The Ginkgo authors
1+
// SPDX-FileCopyrightText: 2017 - 2025 The Ginkgo authors
22
//
33
// SPDX-License-Identifier: BSD-3-Clause
44

@@ -138,7 +138,7 @@ TYPED_TEST(Jacobi, FindsNaturalBlocks)
138138
using Mtx = typename TestFixture::Mtx;
139139
using index_type = typename TestFixture::index_type;
140140
using value_type = typename TestFixture::value_type;
141-
auto mtx = Mtx::create(this->exec, gko::dim<2>{4}, 8);
141+
auto mtx = Mtx::create(this->exec, gko::dim<2>{4, 4}, 8);
142142
this->template init_array<index_type>(mtx->get_row_ptrs(), {0, 2, 4, 6, 8});
143143
this->template init_array<index_type>(mtx->get_col_idxs(),
144144
{0, 1, 0, 1, 0, 2, 0, 2});
@@ -1127,7 +1127,7 @@ TYPED_TEST(Jacobi, ScalarL1Diag)
11271127
using Mtx = typename TestFixture::Mtx;
11281128
using index_type = typename TestFixture::index_type;
11291129
using value_type = typename TestFixture::value_type;
1130-
auto mtx = Mtx::create(this->exec, gko::dim<2>{4}, 8);
1130+
auto mtx = Mtx::create(this->exec, gko::dim<2>{4, 4}, 8);
11311131
this->template init_array<index_type>(mtx->get_row_ptrs(), {0, 2, 4, 6, 8});
11321132
this->template init_array<index_type>(mtx->get_col_idxs(),
11331133
{0, 1, 0, 1, 0, 2, 0, 2});
@@ -1149,15 +1149,17 @@ TYPED_TEST(Jacobi, ScalarL1Diag)
11491149
TYPED_TEST(Jacobi, BlockL1)
11501150
{
11511151
/* example matrix:
1152-
1 1
1153-
2 2
1154-
-5 1
1155-
1 -1 1
1152+
1 | 1
1153+
---+---+
1154+
2 | 2 |
1155+
+---+--------
1156+
-5 | 1
1157+
1 | -1 1
11561158
*/
11571159
using Mtx = typename TestFixture::Mtx;
11581160
using index_type = typename TestFixture::index_type;
11591161
using value_type = typename TestFixture::value_type;
1160-
auto mtx = Mtx::create(this->exec, gko::dim<2>{4}, 9);
1162+
auto mtx = Mtx::create(this->exec, gko::dim<2>{4, 4}, 9);
11611163
this->template init_array<index_type>(mtx->get_row_ptrs(), {0, 2, 4, 6, 9});
11621164
this->template init_array<index_type>(mtx->get_col_idxs(),
11631165
{0, 1, 0, 1, 0, 2, 0, 2, 3});

test/preconditioner/jacobi_kernels.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// SPDX-FileCopyrightText: 2017 - 2024 The Ginkgo authors
1+
// SPDX-FileCopyrightText: 2017 - 2025 The Ginkgo authors
22
//
33
// SPDX-License-Identifier: BSD-3-Clause
44

@@ -257,7 +257,7 @@ TEST_F(Jacobi,
257257
}
258258

259259

260-
TEST_F(Jacobi, ScalarInLargeMatrixEquivalentToRef)
260+
TEST_F(Jacobi, ScalarL1InLargeMatrixEquivalentToRef)
261261
{
262262
/* example matrix:
263263
1 1

0 commit comments

Comments
 (0)