MueLu Version of the Day
Loading...
Searching...
No Matches
MueLu_CutDrop.hpp
Go to the documentation of this file.
1// @HEADER
2// *****************************************************************************
3// MueLu: A package for multigrid based preconditioning
4//
5// Copyright 2012 NTESS and the MueLu contributors.
6// SPDX-License-Identifier: BSD-3-Clause
7// *****************************************************************************
8// @HEADER
9
10#ifndef MUELU_CUTDROP_HPP
11#define MUELU_CUTDROP_HPP
12
13#include "Kokkos_Core.hpp"
14#include "KokkosKernels_ArithTraits.hpp"
16#include "MueLu_Utilities.hpp"
17#include "Xpetra_Matrix.hpp"
18#include "Xpetra_MultiVector.hpp"
20
21namespace MueLu::CutDrop {
22
28
33template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
35 public:
36 using matrix_type = Xpetra::Matrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>;
37
38 using local_matrix_type = typename matrix_type::local_matrix_device_type;
39 using scalar_type = typename local_matrix_type::value_type;
40 using local_ordinal_type = typename local_matrix_type::ordinal_type;
41 using memory_space = typename local_matrix_type::memory_space;
42 using results_view = Kokkos::View<DecisionType*, memory_space>;
43
46
47 private:
48 using ATS = KokkosKernels::ArithTraits<scalar_type>;
49 using magnitudeType = typename ATS::magnitudeType;
50 using values_view = Kokkos::View<magnitudeType*, memory_space>;
52
53 public:
55 : A(A_.getLocalMatrixDevice())
56 , results(results_)
57 , values("UnscaledComparison::values", A.nnz()) {}
58
59 template <class local_matrix_type2>
60 struct Comparator {
61 private:
62 using scalar_type = typename local_matrix_type2::value_type;
63 using local_ordinal_type = typename local_matrix_type2::ordinal_type;
64 using memory_space = typename local_matrix_type2::memory_space;
65 using results_view = Kokkos::View<DecisionType*, memory_space>;
66
67 using ATS = KokkosKernels::ArithTraits<scalar_type>;
68 using magnitudeType = typename ATS::magnitudeType;
69 using values_view = Kokkos::View<magnitudeType*, memory_space>;
70
71 const local_matrix_type2 A;
75
76 public:
77 KOKKOS_INLINE_FUNCTION
78 Comparator(const local_matrix_type2& A_, local_ordinal_type rlid_, const results_view& results_, values_view& values_)
79 : A(A_)
80 , offset(A_.graph.row_map(rlid_))
81 , results(results_)
82 , values(Kokkos::subview(values_, Kokkos::make_pair(A.graph.row_map(rlid_), A.graph.row_map(rlid_ + 1)))) {
83 for (auto i = 0U; i < values.extent(0); ++i) {
84 values(i) = get_value_impl(i);
85 }
86 }
87
88 KOKKOS_FORCEINLINE_FUNCTION
89 magnitudeType get_value(size_t x) const {
90 return values(x);
91 }
92
93 KOKKOS_INLINE_FUNCTION
94 bool operator()(size_t x, size_t y) const {
95 if (results(offset + x) != UNDECIDED) {
96 if (results(offset + y) != UNDECIDED) {
97 // does not matter
98 return (x < y);
99 } else {
100 // sort undecided to the right
101 return true;
102 }
103 } else {
104 if (results(offset + y) != UNDECIDED) {
105 // sort undecided to the right
106 return false;
107 } else {
108 return get_value(x) > get_value(y);
109 }
110 }
111 }
112
113 private:
114 KOKKOS_INLINE_FUNCTION
116 return ATS::magnitude(A.values(offset + x) * A.values(offset + x));
117 }
118 };
119
121
122 KOKKOS_INLINE_FUNCTION
126};
127
132template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node, Misc::StrengthMeasure measure>
134 public:
135 using matrix_type = Xpetra::Matrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>;
136 using local_matrix_type = typename matrix_type::local_matrix_device_type;
137 using scalar_type = typename local_matrix_type::value_type;
138 using local_ordinal_type = typename local_matrix_type::ordinal_type;
139 using memory_space = typename local_matrix_type::memory_space;
140 using diag_vec_type = Xpetra::MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node>;
141 using diag_view_type = typename Kokkos::DualView<const scalar_type*, Kokkos::LayoutStride, typename Node::device_type, Kokkos::MemoryUnmanaged>::t_dev;
142 using results_view = Kokkos::View<DecisionType*, memory_space>;
143
146
147 private:
148 using ATS = KokkosKernels::ArithTraits<scalar_type>;
149 using magnitudeType = typename ATS::magnitudeType;
150
151 Teuchos::RCP<diag_vec_type> diagVec;
153 using values_view = Kokkos::View<magnitudeType*, memory_space>;
155
156 public:
158 : A(A_.getLocalMatrixDevice())
159 , results(results_)
160 , values("ScaledComparison::values", A.nnz()) {
161 if constexpr ((measure == Misc::SmoothedAggregationMeasure) || (measure == Misc::SignedSmoothedAggregationMeasure)) {
163 auto lclDiag2d = diagVec->getLocalViewDevice(Tpetra::Access::ReadOnly);
164 diag = Kokkos::subview(lclDiag2d, Kokkos::ALL(), 0);
165 } else if constexpr (measure == Misc::SignedRugeStuebenMeasure) {
167 auto lcl2d = diagVec->getLocalViewDevice(Tpetra::Access::ReadOnly);
168 diag = Kokkos::subview(lcl2d, Kokkos::ALL(), 0);
169 }
170 }
171
172 template <class local_matrix_type2, class diag_view_type2>
173 struct Comparator {
174 private:
175 using scalar_type = typename local_matrix_type2::value_type;
176 using local_ordinal_type = typename local_matrix_type2::ordinal_type;
177 using memory_space = typename local_matrix_type2::memory_space;
178 using results_view = Kokkos::View<DecisionType*, memory_space>;
179
180 using ATS = KokkosKernels::ArithTraits<scalar_type>;
181 using magnitudeType = typename ATS::magnitudeType;
182 using mATS = KokkosKernels::ArithTraits<magnitudeType>;
183 using values_view = Kokkos::View<magnitudeType*, memory_space>;
184
185 const local_matrix_type2 A;
186 const diag_view_type2 diag;
191
192 public:
193 KOKKOS_INLINE_FUNCTION
194 Comparator(const local_matrix_type2& A_, const diag_view_type2& diag_, const local_ordinal_type rlid_, const results_view& results_, values_view& values_)
195 : A(A_)
196 , diag(diag_)
197 , rlid(rlid_)
198 , offset(A_.graph.row_map(rlid_))
199 , results(results_)
200 , values(Kokkos::subview(values_, Kokkos::make_pair(A.graph.row_map(rlid_), A.graph.row_map(rlid_ + 1)))) {
201 for (auto i = 0U; i < values.extent(0); ++i) {
202 values(i) = get_value_impl(i);
203 }
204 }
205
206 KOKKOS_INLINE_FUNCTION
207 magnitudeType get_value(size_t x) const {
208 return values(x);
209 }
210
211 KOKKOS_INLINE_FUNCTION
212 bool operator()(size_t x, size_t y) const {
213 if (results(offset + x) != UNDECIDED) {
214 if (results(offset + y) != UNDECIDED) {
215 // does not matter
216 return (x < y);
217 } else {
218 // sort undecided to the right
219 return true;
220 }
221 } else {
222 if (results(offset + y) != UNDECIDED) {
223 // sort undecided to the right
224 return false;
225 } else {
226 return get_value(x) > get_value(y);
227 }
228 }
229 }
230
231 private:
232 KOKKOS_INLINE_FUNCTION
234 if constexpr (measure == Misc::SmoothedAggregationMeasure) {
235 auto x_aij = ATS::magnitude(A.values(offset + x) * A.values(offset + x));
236 auto x_aiiajj = ATS::magnitude(diag(rlid) * diag(A.graph.entries(offset + x)));
237 return (x_aij / x_aiiajj);
238 } else if constexpr (measure == Misc::SignedRugeStuebenMeasure) {
239 auto val = A.values(offset + x);
240 auto neg_aij = -ATS::real(val);
241 auto max_neg_aik = ATS::real(diag(rlid));
242 auto v = neg_aij / max_neg_aik;
243 if (ATS::real(v) <= mATS::zero()) {
244 return -ATS::magnitude(v * v);
245 } else {
246 return ATS::magnitude(v * v);
247 }
248 } else if constexpr (measure == Misc::SignedSmoothedAggregationMeasure) {
249 auto val = A.values(offset + x);
250 auto x_aiiajj = ATS::magnitude(diag(rlid) * diag(A.graph.entries(offset + x)));
251 const bool is_nonpositive = ATS::real(val) <= mATS::zero();
252 magnitudeType aij2 = ATS::magnitude(val) * ATS::magnitude(val);
253 if (!is_nonpositive)
254 aij2 = -aij2;
255 return (aij2 / x_aiiajj);
256 }
257 }
258 };
259
261
262 KOKKOS_INLINE_FUNCTION
266};
267
268// helper function to allow partial template deduction
269template <Misc::StrengthMeasure measure, class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
270auto make_comparison_functor(Xpetra::Matrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>& A_,
272 if constexpr (measure == Misc::UnscaledMeasure) {
274 return functor;
275 } else {
277 return functor;
278 }
279}
280
281template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node, class DistanceFunctorType>
283 public:
284 using matrix_type = Xpetra::Matrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>;
285 using local_matrix_type = typename matrix_type::local_matrix_device_type;
286 using scalar_type = typename local_matrix_type::value_type;
287 using local_ordinal_type = typename local_matrix_type::ordinal_type;
288 using memory_space = typename local_matrix_type::memory_space;
289 using diag_vec_type = Xpetra::MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node>;
290 using diag_view_type = typename Kokkos::DualView<const scalar_type*, Kokkos::LayoutStride, typename Node::device_type, Kokkos::MemoryUnmanaged>::t_dev;
291 using results_view = Kokkos::View<DecisionType*, memory_space>;
292
295
296 private:
297 using ATS = KokkosKernels::ArithTraits<scalar_type>;
298 using magnitudeType = typename ATS::magnitudeType;
299 using values_view = Kokkos::View<magnitudeType*, memory_space>;
300
301 Teuchos::RCP<diag_vec_type> diagVec;
303 DistanceFunctorType dist2;
305
306 public:
307 UnscaledDistanceLaplacianComparison(matrix_type& A_, DistanceFunctorType& dist2_, results_view& results_)
308 : A(A_.getLocalMatrixDevice())
309 , results(results_)
310 , dist2(dist2_)
311 , values("UnscaledDistanceLaplacianComparison::values", A.nnz()) {
312 // Construct ghosted distance Laplacian diagonal
314 auto lclDiag2d = diagVec->getLocalViewDevice(Tpetra::Access::ReadOnly);
315 diag = Kokkos::subview(lclDiag2d, Kokkos::ALL(), 0);
316 }
317
318 template <class local_matrix_type2, class DistanceFunctorType2, class diag_view_type2>
319 struct Comparator {
320 private:
321 using scalar_type = typename local_matrix_type2::value_type;
322 using local_ordinal_type = typename local_matrix_type2::ordinal_type;
323 using memory_space = typename local_matrix_type2::memory_space;
324 using results_view = Kokkos::View<DecisionType*, memory_space>;
325
326 using ATS = KokkosKernels::ArithTraits<scalar_type>;
327 using magnitudeType = typename ATS::magnitudeType;
328 using values_view = Kokkos::View<magnitudeType*, memory_space>;
329
330 const local_matrix_type2 A;
331 const diag_view_type2 diag;
332 const DistanceFunctorType2* dist2;
337
338 const scalar_type one = ATS::one();
339
340 public:
341 KOKKOS_INLINE_FUNCTION
342 Comparator(const local_matrix_type2& A_, const diag_view_type2& diag_, const DistanceFunctorType2* dist2_, local_ordinal_type rlid_, const results_view& results_, values_view& values_)
343 : A(A_)
344 , diag(diag_)
345 , dist2(dist2_)
346 , rlid(rlid_)
347 , offset(A_.graph.row_map(rlid_))
348 , results(results_)
349 , values(Kokkos::subview(values_, Kokkos::make_pair(A.graph.row_map(rlid_), A.graph.row_map(rlid_ + 1)))) {
350 for (auto i = 0U; i < values.extent(0); ++i) {
351 values(i) = get_value_impl(i);
352 }
353 }
354
355 KOKKOS_FORCEINLINE_FUNCTION
356 magnitudeType get_value(size_t x) const {
357 return values(x);
358 }
359
360 KOKKOS_INLINE_FUNCTION
361 bool operator()(size_t x, size_t y) const {
362 if (results(offset + x) != UNDECIDED) {
363 if (results(offset + y) != UNDECIDED) {
364 // does not matter
365 return (x < y);
366 } else {
367 // sort undecided to the right
368 return true;
369 }
370 } else {
371 if (results(offset + y) != UNDECIDED) {
372 // sort undecided to the right
373 return false;
374 } else {
375 return get_value(x) > get_value(y);
376 }
377 }
378 }
379
380 private:
381 KOKKOS_INLINE_FUNCTION
383 auto clid = A.graph.entries(offset + x);
384 scalar_type val;
385 if (rlid != clid) {
386 val = -one / dist2->distance2(rlid, clid);
387 } else {
388 val = diag(rlid);
389 }
390 auto aij2 = ATS::magnitude(val) * ATS::magnitude(val); // |a_ij|^2
391 return aij2;
392 }
393 };
394
396
397 KOKKOS_INLINE_FUNCTION
401};
402
407template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node, class DistanceFunctorType, Misc::StrengthMeasure measure>
409 public:
410 using matrix_type = Xpetra::Matrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>;
411 using local_matrix_type = typename matrix_type::local_matrix_device_type;
412 using scalar_type = typename local_matrix_type::value_type;
413 using local_ordinal_type = typename local_matrix_type::ordinal_type;
414 using memory_space = typename local_matrix_type::memory_space;
415 using diag_vec_type = Xpetra::MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node>;
416 using diag_view_type = typename Kokkos::DualView<const scalar_type*, Kokkos::LayoutStride, typename Node::device_type, Kokkos::MemoryUnmanaged>::t_dev;
417 using results_view = Kokkos::View<DecisionType*, memory_space>;
418
421
422 private:
423 using ATS = KokkosKernels::ArithTraits<scalar_type>;
424 using magnitudeType = typename ATS::magnitudeType;
425
426 Teuchos::RCP<diag_vec_type> diagVec;
428 DistanceFunctorType dist2;
429
430 using values_view = Kokkos::View<magnitudeType*, memory_space>;
432
433 public:
434 ScaledDistanceLaplacianComparison(matrix_type& A_, DistanceFunctorType& dist2_, results_view& results_)
435 : A(A_.getLocalMatrixDevice())
436 , results(results_)
437 , dist2(dist2_)
438 , values("ScaledDistanceLaplacianComparison::values", A.nnz()) {
439 // Construct ghosted distance Laplacian diagonal
440 if constexpr ((measure == Misc::SmoothedAggregationMeasure) || (measure == Misc::SignedSmoothedAggregationMeasure)) {
442 auto lclDiag2d = diagVec->getLocalViewDevice(Tpetra::Access::ReadOnly);
443 diag = Kokkos::subview(lclDiag2d, Kokkos::ALL(), 0);
444 } else if constexpr (measure == Misc::SignedRugeStuebenMeasure) {
446 auto lclDiag2d = diagVec->getLocalViewDevice(Tpetra::Access::ReadOnly);
447 diag = Kokkos::subview(lclDiag2d, Kokkos::ALL(), 0);
448 }
449 }
450
451 template <class local_matrix_type2, class DistanceFunctorType2, class diag_view_type2>
452 struct Comparator {
453 private:
454 using scalar_type = typename local_matrix_type2::value_type;
455 using local_ordinal_type = typename local_matrix_type2::ordinal_type;
456 using memory_space = typename local_matrix_type2::memory_space;
457 using results_view = Kokkos::View<DecisionType*, memory_space>;
458
459 using ATS = KokkosKernels::ArithTraits<scalar_type>;
460 using magnitudeType = typename ATS::magnitudeType;
461 using mATS = KokkosKernels::ArithTraits<magnitudeType>;
462
463 using values_view = Kokkos::View<magnitudeType*, memory_space>;
464
465 const local_matrix_type2 A;
466 const diag_view_type2 diag;
467 const DistanceFunctorType2* dist2;
472
473 const scalar_type one = ATS::one();
474 const scalar_type zero = ATS::zero();
475 const magnitudeType mzero = mATS::zero();
476
477 public:
478 KOKKOS_INLINE_FUNCTION
479 Comparator(const local_matrix_type2& A_, const diag_view_type2& diag_, const DistanceFunctorType2* dist2_, local_ordinal_type rlid_, const results_view& results_, values_view& values_)
480 : A(A_)
481 , diag(diag_)
482 , dist2(dist2_)
483 , rlid(rlid_)
484 , offset(A_.graph.row_map(rlid_))
485 , results(results_)
486 , values(Kokkos::subview(values_, Kokkos::make_pair(A.graph.row_map(rlid), A.graph.row_map(rlid + 1)))) {
487 for (auto i = 0U; i < values.extent(0); ++i) {
488 values(i) = get_value_impl(i);
489 }
490 }
491
492 KOKKOS_FORCEINLINE_FUNCTION
493 magnitudeType get_value(size_t x) const {
494 return values(x);
495 }
496
497 KOKKOS_INLINE_FUNCTION
498 bool operator()(size_t x, size_t y) const {
499 if (results(offset + x) != UNDECIDED) {
500 if (results(offset + y) != UNDECIDED) {
501 // does not matter
502 return (x < y);
503 } else {
504 // sort undecided to the right
505 return true;
506 }
507 } else {
508 if (results(offset + y) != UNDECIDED) {
509 // sort undecided to the right
510 return false;
511 } else {
512 return get_value(x) > get_value(y);
513 }
514 }
515 }
516
517 private:
518 KOKKOS_INLINE_FUNCTION
520 auto clid = A.graph.entries(offset + x);
521 scalar_type val;
522 if (rlid != clid) {
523 val = -one / dist2->distance2(rlid, clid);
524 } else {
525 val = diag(rlid);
526 }
527
528 if constexpr (measure == Misc::SmoothedAggregationMeasure) {
529 auto aiiajj = ATS::magnitude(diag(rlid)) * ATS::magnitude(diag(clid)); // |a_ii|*|a_jj|
530 auto aij2 = ATS::magnitude(val) * ATS::magnitude(val); // |a_ij|^2
531 return (aij2 / aiiajj);
532 } else if constexpr (measure == Misc::SignedRugeStuebenMeasure) {
533 auto neg_aij = -ATS::real(val);
534 auto max_neg_aik = ATS::real(diag(rlid));
535 auto v = ATS::magnitude(neg_aij / max_neg_aik);
536 if (ATS::real(neg_aij) >= mzero)
537 return v * v;
538 else
539 return -v * v;
540 } else if constexpr (measure == Misc::SignedSmoothedAggregationMeasure) {
541 auto aiiajj = ATS::magnitude(diag(rlid)) * ATS::magnitude(diag(clid)); // |a_ii|*|a_jj|
542 const bool is_nonpositive = ATS::real(val) <= mATS::zero();
543 magnitudeType aij2 = ATS::magnitude(val) * ATS::magnitude(val); // |a_ij|^2
544 // + |a_ij|^2, if a_ij < 0, - |a_ij|^2 if a_ij >=0
545 if (!is_nonpositive)
546 aij2 = -aij2;
547 return aij2 / aiiajj;
548 }
549 }
550 };
551
553
554 KOKKOS_INLINE_FUNCTION
558};
559
560// helper function to allow partial template deduction
561template <Misc::StrengthMeasure measure, class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node, class DistanceFunctorType>
562auto make_dlap_comparison_functor(Xpetra::Matrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>& A_,
563 DistanceFunctorType& dist2_,
565 if constexpr (measure == Misc::UnscaledMeasure) {
567 return functor;
568 } else {
570 return functor;
571 }
572}
573
578template <class comparison_type>
580 private:
581 using local_matrix_type = typename comparison_type::local_matrix_type;
582 using scalar_type = typename local_matrix_type::value_type;
583 using local_ordinal_type = typename local_matrix_type::ordinal_type;
584 using memory_space = typename local_matrix_type::memory_space;
585 using results_view = Kokkos::View<DecisionType*, memory_space>;
586
587 using ATS = KokkosKernels::ArithTraits<scalar_type>;
588 using magnitudeType = typename ATS::magnitudeType;
589 using boundary_nodes_view = Kokkos::View<const bool*, memory_space>;
590
592 comparison_type comparison;
595 Kokkos::View<local_ordinal_type*, memory_space> index;
596
597 public:
598 CutDropFunctor(comparison_type& comparison_, magnitudeType threshold)
599 : A(comparison_.A)
600 , comparison(comparison_)
601 , eps(threshold)
602 , results(comparison_.results) {
603 index = Kokkos::View<local_ordinal_type*, memory_space>("indices", A.nnz());
604 }
605
606 KOKKOS_FORCEINLINE_FUNCTION
607 void operator()(const local_ordinal_type& rlid) const {
608 auto row = A.rowConst(rlid);
609 size_t nnz = row.length;
610
611 auto drop_view = Kokkos::subview(results, Kokkos::make_pair(A.graph.row_map(rlid), A.graph.row_map(rlid + 1)));
612 auto row_permutation = Kokkos::subview(index, Kokkos::make_pair(A.graph.row_map(rlid), A.graph.row_map(rlid + 1)));
613
614 auto comparator = comparison.getComparator(rlid);
615
616#ifdef MUELU_COALESCE_DROP_DEBUG
617 {
618 Kokkos::printf("SoC: ");
619 for (local_ordinal_type k = 0; k < row.length; ++k) {
620 Kokkos::printf("%5f ", comparator.get_value(k));
621 }
622 Kokkos::printf("\n");
623 }
624#endif
625
626 for (size_t i = 0; i < nnz; ++i) {
627 row_permutation(i) = i;
628 }
629 Misc::serialHeapSort(row_permutation, comparator);
630
631 size_t keepStart = 0;
632 size_t dropStart = nnz;
633 // find index where dropping starts
634 for (size_t i = 1; i < nnz; ++i) {
635 auto const& x = row_permutation(i - 1);
636 auto const& y = row_permutation(i);
637 if ((drop_view(x) != UNDECIDED) && (drop_view(y) == UNDECIDED))
638 keepStart = i;
639 if ((drop_view(x) != UNDECIDED) || (drop_view(y) != UNDECIDED))
640 continue;
641 magnitudeType x_aij = comparator.get_value(x);
642 magnitudeType y_aij = comparator.get_value(y);
643 if (eps * eps * x_aij > y_aij) {
644 if (i < dropStart) {
645 dropStart = i;
646 }
647 }
648 }
649
650 // drop everything to the right of where values stop passing threshold
651 for (size_t i = keepStart; i < nnz; ++i) {
652 drop_view(row_permutation(i)) = Kokkos::max(dropStart <= i ? DROP : KEEP, drop_view(row_permutation(i)));
653 }
654 }
655};
656
657} // namespace MueLu::CutDrop
658
659#endif
Order each row by a criterion, compare the ratio of values and drop all entries once the ratio is bel...
typename local_matrix_type::ordinal_type local_ordinal_type
KokkosKernels::ArithTraits< scalar_type > ATS
Kokkos::View< const bool *, memory_space > boundary_nodes_view
KOKKOS_FORCEINLINE_FUNCTION void operator()(const local_ordinal_type &rlid) const
CutDropFunctor(comparison_type &comparison_, magnitudeType threshold)
Kokkos::View< DecisionType *, memory_space > results_view
typename local_matrix_type::memory_space memory_space
typename comparison_type::local_matrix_type local_matrix_type
typename ATS::magnitudeType magnitudeType
Kokkos::View< local_ordinal_type *, memory_space > index
typename local_matrix_type::value_type scalar_type
Orders entries of row by .
ScaledComparison(matrix_type &A_, results_view &results_)
typename ATS::magnitudeType magnitudeType
typename Kokkos::DualView< const scalar_type *, Kokkos::LayoutStride, typename Node::device_type, Kokkos::MemoryUnmanaged >::t_dev diag_view_type
Kokkos::View< DecisionType *, memory_space > results_view
KokkosKernels::ArithTraits< scalar_type > ATS
Comparator< local_matrix_type, diag_view_type > comparator_type
Kokkos::View< magnitudeType *, memory_space > values_view
typename matrix_type::local_matrix_device_type local_matrix_type
Xpetra::Matrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > matrix_type
typename local_matrix_type::memory_space memory_space
Teuchos::RCP< diag_vec_type > diagVec
Xpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > diag_vec_type
typename local_matrix_type::value_type scalar_type
KOKKOS_INLINE_FUNCTION comparator_type getComparator(local_ordinal_type rlid) const
typename local_matrix_type::ordinal_type local_ordinal_type
Orders entries of row by where is the distance Laplacian.
KOKKOS_INLINE_FUNCTION comparator_type getComparator(local_ordinal_type rlid) const
KokkosKernels::ArithTraits< scalar_type > ATS
typename local_matrix_type::ordinal_type local_ordinal_type
typename matrix_type::local_matrix_device_type local_matrix_type
typename Kokkos::DualView< const scalar_type *, Kokkos::LayoutStride, typename Node::device_type, Kokkos::MemoryUnmanaged >::t_dev diag_view_type
Kokkos::View< DecisionType *, memory_space > results_view
ScaledDistanceLaplacianComparison(matrix_type &A_, DistanceFunctorType &dist2_, results_view &results_)
Xpetra::Matrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > matrix_type
Comparator< local_matrix_type, DistanceFunctorType, diag_view_type > comparator_type
Kokkos::View< magnitudeType *, memory_space > values_view
Xpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > diag_vec_type
typename local_matrix_type::value_type scalar_type
typename local_matrix_type::memory_space memory_space
Orders entries of row by .
typename local_matrix_type::ordinal_type local_ordinal_type
typename ATS::magnitudeType magnitudeType
Xpetra::Matrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > matrix_type
KokkosKernels::ArithTraits< scalar_type > ATS
UnscaledComparison(matrix_type &A_, results_view &results_)
typename local_matrix_type::memory_space memory_space
Comparator< local_matrix_type > comparator_type
typename local_matrix_type::value_type scalar_type
Kokkos::View< magnitudeType *, memory_space > values_view
Kokkos::View< DecisionType *, memory_space > results_view
KOKKOS_INLINE_FUNCTION comparator_type getComparator(local_ordinal_type rlid) const
typename matrix_type::local_matrix_device_type local_matrix_type
typename Kokkos::DualView< const scalar_type *, Kokkos::LayoutStride, typename Node::device_type, Kokkos::MemoryUnmanaged >::t_dev diag_view_type
KOKKOS_INLINE_FUNCTION comparator_type getComparator(local_ordinal_type rlid) const
UnscaledDistanceLaplacianComparison(matrix_type &A_, DistanceFunctorType &dist2_, results_view &results_)
KokkosKernels::ArithTraits< scalar_type > ATS
typename local_matrix_type::memory_space memory_space
typename local_matrix_type::value_type scalar_type
Xpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > diag_vec_type
Xpetra::Matrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > matrix_type
Kokkos::View< DecisionType *, memory_space > results_view
Comparator< local_matrix_type, DistanceFunctorType, diag_view_type > comparator_type
typename matrix_type::local_matrix_device_type local_matrix_type
typename local_matrix_type::ordinal_type local_ordinal_type
Kokkos::View< magnitudeType *, memory_space > values_view
static Teuchos::RCP< Vector > GetMatrixMaxMinusOffDiagonal(const Xpetra::Matrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A)
Return vector containing: max_{i\not=k}(-a_ik), for each for i in the matrix.
static RCP< Vector > GetMatrixOverlappedDiagonal(const Matrix &A)
Extract Overlapped Matrix Diagonal.
auto make_comparison_functor(Xpetra::Matrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A_, typename ScaledComparison< Scalar, LocalOrdinal, GlobalOrdinal, Node, measure >::results_view &results_)
auto make_dlap_comparison_functor(Xpetra::Matrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A_, DistanceFunctorType &dist2_, typename ScaledDistanceLaplacianComparison< Scalar, LocalOrdinal, GlobalOrdinal, Node, DistanceFunctorType, measure >::results_view &results_)
Teuchos::RCP< Xpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > getDiagonal(Xpetra::Matrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A, DistanceFunctorType &distFunctor)
Teuchos::RCP< Xpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > getMaxMinusOffDiagonal(Xpetra::Matrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A, DistanceFunctorType &distFunctor)
KOKKOS_INLINE_FUNCTION void serialHeapSort(view_type &v, comparator_type comparator)
KOKKOS_INLINE_FUNCTION magnitudeType get_value(size_t x) const
KokkosKernels::ArithTraits< scalar_type > ATS
KOKKOS_INLINE_FUNCTION Comparator(const local_matrix_type2 &A_, const diag_view_type2 &diag_, const local_ordinal_type rlid_, const results_view &results_, values_view &values_)
Kokkos::View< DecisionType *, memory_space > results_view
Kokkos::View< magnitudeType *, memory_space > values_view
typename local_matrix_type2::ordinal_type local_ordinal_type
KOKKOS_INLINE_FUNCTION bool operator()(size_t x, size_t y) const
typename local_matrix_type2::memory_space memory_space
KOKKOS_INLINE_FUNCTION magnitudeType get_value_impl(size_t x) const
KokkosKernels::ArithTraits< magnitudeType > mATS
typename local_matrix_type2::value_type scalar_type
KOKKOS_INLINE_FUNCTION Comparator(const local_matrix_type2 &A_, const diag_view_type2 &diag_, const DistanceFunctorType2 *dist2_, local_ordinal_type rlid_, const results_view &results_, values_view &values_)
KOKKOS_FORCEINLINE_FUNCTION magnitudeType get_value(size_t x) const
KOKKOS_INLINE_FUNCTION bool operator()(size_t x, size_t y) const
typename local_matrix_type2::memory_space memory_space
Kokkos::View< DecisionType *, memory_space > results_view
typename local_matrix_type2::ordinal_type local_ordinal_type
KokkosKernels::ArithTraits< magnitudeType > mATS
Kokkos::View< magnitudeType *, memory_space > values_view
KOKKOS_INLINE_FUNCTION magnitudeType get_value_impl(size_t x) const
KOKKOS_INLINE_FUNCTION Comparator(const local_matrix_type2 &A_, local_ordinal_type rlid_, const results_view &results_, values_view &values_)
Kokkos::View< DecisionType *, memory_space > results_view
KokkosKernels::ArithTraits< scalar_type > ATS
typename local_matrix_type2::value_type scalar_type
typename local_matrix_type2::ordinal_type local_ordinal_type
KOKKOS_FORCEINLINE_FUNCTION magnitudeType get_value(size_t x) const
typename local_matrix_type2::memory_space memory_space
Kokkos::View< magnitudeType *, memory_space > values_view
KOKKOS_INLINE_FUNCTION magnitudeType get_value_impl(size_t x) const
KOKKOS_INLINE_FUNCTION bool operator()(size_t x, size_t y) const
KOKKOS_INLINE_FUNCTION magnitudeType get_value_impl(size_t x) const
KOKKOS_FORCEINLINE_FUNCTION magnitudeType get_value(size_t x) const
KOKKOS_INLINE_FUNCTION Comparator(const local_matrix_type2 &A_, const diag_view_type2 &diag_, const DistanceFunctorType2 *dist2_, local_ordinal_type rlid_, const results_view &results_, values_view &values_)
Kokkos::View< magnitudeType *, memory_space > values_view
Kokkos::View< DecisionType *, memory_space > results_view
KOKKOS_INLINE_FUNCTION bool operator()(size_t x, size_t y) const
typename local_matrix_type2::ordinal_type local_ordinal_type