Loading [MathJax]/jax/output/HTML-CSS/config.js
MueLu  Version of the Day
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 "Kokkos_ArithTraits.hpp"
15 #include "MueLu_DroppingCommon.hpp"
16 #include "MueLu_Utilities.hpp"
17 #include "Xpetra_Matrix.hpp"
18 #include "Xpetra_MultiVector.hpp"
20 
21 namespace MueLu::CutDrop {
22 
28 
33 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
35  public:
37 
38  using local_matrix_type = typename matrix_type::local_matrix_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 = Kokkos::ArithTraits<scalar_type>;
49  using magnitudeType = typename ATS::magnitudeType;
50 
51  public:
53  : A(A_.getLocalMatrixDevice())
54  , results(results_) {}
55 
56  template <class local_matrix_type2>
57  struct Comparator {
58  private:
59  using scalar_type = typename local_matrix_type2::value_type;
60  using local_ordinal_type = typename local_matrix_type2::ordinal_type;
61  using memory_space = typename local_matrix_type2::memory_space;
62  using results_view = Kokkos::View<DecisionType*, memory_space>;
63 
64  using ATS = Kokkos::ArithTraits<scalar_type>;
65  using magnitudeType = typename ATS::magnitudeType;
66 
67  const local_matrix_type2 A;
70 
71  public:
72  KOKKOS_INLINE_FUNCTION
73  Comparator(const local_matrix_type2& A_, local_ordinal_type rlid_, const results_view& results_)
74  : A(A_)
75  , offset(A_.graph.row_map(rlid_))
76  , results(results_) {}
77 
78  KOKKOS_INLINE_FUNCTION
79  magnitudeType get_value(size_t x) const {
80  return ATS::magnitude(A.values(offset + x) * A.values(offset + x));
81  }
82 
83  KOKKOS_INLINE_FUNCTION
84  bool operator()(size_t x, size_t y) const {
85  if (results(offset + x) != UNDECIDED) {
86  if (results(offset + y) != UNDECIDED) {
87  // does not matter
88  return (x < y);
89  } else {
90  // sort undecided to the right
91  return true;
92  }
93  } else {
94  if (results(offset + y) != UNDECIDED) {
95  // sort undecided to the right
96  return false;
97  } else {
98  return get_value(x) > get_value(y);
99  }
100  }
101  }
102  };
103 
105 
106  KOKKOS_INLINE_FUNCTION
108  return comparator_type(A, rlid, results);
109  }
110 };
111 
116 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node, Misc::StrengthMeasure measure>
118  public:
120  using local_matrix_type = typename matrix_type::local_matrix_type;
121  using scalar_type = typename local_matrix_type::value_type;
122  using local_ordinal_type = typename local_matrix_type::ordinal_type;
123  using memory_space = typename local_matrix_type::memory_space;
125  using diag_view_type = typename Kokkos::DualView<const scalar_type*, Kokkos::LayoutStride, typename Node::device_type, Kokkos::MemoryUnmanaged>::t_dev;
126  using results_view = Kokkos::View<DecisionType*, memory_space>;
127 
130 
131  private:
132  using ATS = Kokkos::ArithTraits<scalar_type>;
133  using magnitudeType = typename ATS::magnitudeType;
134 
137 
138  public:
140  : A(A_.getLocalMatrixDevice())
141  , results(results_) {
142  if constexpr ((measure == Misc::SmoothedAggregationMeasure) || (measure == Misc::SignedSmoothedAggregationMeasure)) {
144  auto lclDiag2d = diagVec->getLocalViewDevice(Xpetra::Access::ReadOnly);
145  diag = Kokkos::subview(lclDiag2d, Kokkos::ALL(), 0);
146  } else if constexpr (measure == Misc::SignedRugeStuebenMeasure) {
148  auto lcl2d = diagVec->getLocalViewDevice(Xpetra::Access::ReadOnly);
149  diag = Kokkos::subview(lcl2d, Kokkos::ALL(), 0);
150  }
151  }
152 
153  template <class local_matrix_type2, class diag_view_type2>
154  struct Comparator {
155  private:
156  using scalar_type = typename local_matrix_type2::value_type;
157  using local_ordinal_type = typename local_matrix_type2::ordinal_type;
158  using memory_space = typename local_matrix_type2::memory_space;
159  using results_view = Kokkos::View<DecisionType*, memory_space>;
160 
161  using ATS = Kokkos::ArithTraits<scalar_type>;
162  using magnitudeType = typename ATS::magnitudeType;
163  using mATS = Kokkos::ArithTraits<magnitudeType>;
164 
165  const local_matrix_type2 A;
166  const diag_view_type2 diag;
170 
171  public:
172  KOKKOS_INLINE_FUNCTION
173  Comparator(const local_matrix_type2& A_, const diag_view_type2& diag_, const local_ordinal_type rlid_, const results_view& results_)
174  : A(A_)
175  , diag(diag_)
176  , rlid(rlid_)
177  , offset(A_.graph.row_map(rlid_))
178  , results(results_) {}
179 
180  KOKKOS_INLINE_FUNCTION
181  magnitudeType get_value(size_t x) const {
182  if constexpr (measure == Misc::SmoothedAggregationMeasure) {
183  auto x_aij = ATS::magnitude(A.values(offset + x) * A.values(offset + x));
184  auto x_aiiajj = ATS::magnitude(diag(rlid) * diag(A.graph.entries(offset + x)));
185  return (x_aij / x_aiiajj);
186  } else if constexpr (measure == Misc::SignedRugeStuebenMeasure) {
187  auto val = A.values(offset + x);
188  auto neg_aij = -ATS::real(val);
189  auto max_neg_aik = ATS::real(diag(rlid));
190  return ATS::magnitude(neg_aij / max_neg_aik);
191  } else if constexpr (measure == Misc::SignedSmoothedAggregationMeasure) {
192  auto val = A.values(offset + x);
193  auto x_aiiajj = ATS::magnitude(diag(rlid) * diag(A.graph.entries(offset + x)));
194  const bool is_nonpositive = ATS::real(val) <= mATS::zero();
195  magnitudeType aij2 = ATS::magnitude(val) * ATS::magnitude(val);
196  if (is_nonpositive)
197  aij2 = -aij2;
198  return (aij2 / x_aiiajj);
199  }
200  }
201 
202  KOKKOS_INLINE_FUNCTION
203  bool operator()(size_t x, size_t y) const {
204  if (results(offset + x) != UNDECIDED) {
205  if (results(offset + y) != UNDECIDED) {
206  // does not matter
207  return (x < y);
208  } else {
209  // sort undecided to the right
210  return true;
211  }
212  } else {
213  if (results(offset + y) != UNDECIDED) {
214  // sort undecided to the right
215  return false;
216  } else {
217  return get_value(x) > get_value(y);
218  }
219  }
220  }
221  };
222 
224 
225  KOKKOS_INLINE_FUNCTION
227  return comparator_type(A, diag, rlid, results);
228  }
229 };
230 
231 // helper function to allow partial template deduction
232 template <Misc::StrengthMeasure measure, class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
235  if constexpr (measure == Misc::UnscaledMeasure) {
237  return functor;
238  } else {
240  return functor;
241  }
242 }
243 
244 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node, class DistanceFunctorType>
246  public:
248  using local_matrix_type = typename matrix_type::local_matrix_type;
249  using scalar_type = typename local_matrix_type::value_type;
250  using local_ordinal_type = typename local_matrix_type::ordinal_type;
251  using memory_space = typename local_matrix_type::memory_space;
253  using diag_view_type = typename Kokkos::DualView<const scalar_type*, Kokkos::LayoutStride, typename Node::device_type, Kokkos::MemoryUnmanaged>::t_dev;
254  using results_view = Kokkos::View<DecisionType*, memory_space>;
255 
258 
259  private:
260  using ATS = Kokkos::ArithTraits<scalar_type>;
261  using magnitudeType = typename ATS::magnitudeType;
262 
265  DistanceFunctorType dist2;
266 
267  public:
268  UnscaledDistanceLaplacianComparison(matrix_type& A_, DistanceFunctorType& dist2_, results_view& results_)
269  : A(A_.getLocalMatrixDevice())
270  , results(results_)
271  , dist2(dist2_) {
272  // Construct ghosted distance Laplacian diagonal
274  auto lclDiag2d = diagVec->getLocalViewDevice(Xpetra::Access::ReadOnly);
275  diag = Kokkos::subview(lclDiag2d, Kokkos::ALL(), 0);
276  }
277 
278  template <class local_matrix_type2, class DistanceFunctorType2, class diag_view_type2>
279  struct Comparator {
280  private:
281  using scalar_type = typename local_matrix_type2::value_type;
282  using local_ordinal_type = typename local_matrix_type2::ordinal_type;
283  using memory_space = typename local_matrix_type2::memory_space;
284  using results_view = Kokkos::View<DecisionType*, memory_space>;
285 
286  using ATS = Kokkos::ArithTraits<scalar_type>;
287  using magnitudeType = typename ATS::magnitudeType;
288 
289  const local_matrix_type2 A;
290  const diag_view_type2 diag;
291  const DistanceFunctorType2* dist2;
295 
296  const scalar_type one = ATS::one();
297 
298  public:
299  KOKKOS_INLINE_FUNCTION
300  Comparator(const local_matrix_type2& A_, const diag_view_type2& diag_, const DistanceFunctorType2* dist2_, local_ordinal_type rlid_, const results_view& results_)
301  : A(A_)
302  , diag(diag_)
303  , dist2(dist2_)
304  , rlid(rlid_)
305  , offset(A_.graph.row_map(rlid_))
306  , results(results_) {}
307 
308  KOKKOS_INLINE_FUNCTION
309  magnitudeType get_value(size_t x) const {
310  auto clid = A.graph.entries(offset + x);
311  scalar_type val;
312  if (rlid != clid) {
313  val = one / dist2->distance2(rlid, clid);
314  } else {
315  val = diag(rlid);
316  }
317  auto aij2 = ATS::magnitude(val) * ATS::magnitude(val); // |a_ij|^2
318  return aij2;
319  }
320 
321  KOKKOS_INLINE_FUNCTION
322  bool operator()(size_t x, size_t y) const {
323  if (results(offset + x) != UNDECIDED) {
324  if (results(offset + y) != UNDECIDED) {
325  // does not matter
326  return (x < y);
327  } else {
328  // sort undecided to the right
329  return true;
330  }
331  } else {
332  if (results(offset + y) != UNDECIDED) {
333  // sort undecided to the right
334  return false;
335  } else {
336  return get_value(x) > get_value(y);
337  }
338  }
339  }
340  };
341 
343 
344  KOKKOS_INLINE_FUNCTION
346  return comparator_type(A, diag, &dist2, rlid, results);
347  }
348 };
349 
354 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node, class DistanceFunctorType, Misc::StrengthMeasure measure>
356  public:
358  using local_matrix_type = typename matrix_type::local_matrix_type;
359  using scalar_type = typename local_matrix_type::value_type;
360  using local_ordinal_type = typename local_matrix_type::ordinal_type;
361  using memory_space = typename local_matrix_type::memory_space;
363  using diag_view_type = typename Kokkos::DualView<const scalar_type*, Kokkos::LayoutStride, typename Node::device_type, Kokkos::MemoryUnmanaged>::t_dev;
364  using results_view = Kokkos::View<DecisionType*, memory_space>;
365 
368 
369  private:
370  using ATS = Kokkos::ArithTraits<scalar_type>;
371  using magnitudeType = typename ATS::magnitudeType;
372 
375  DistanceFunctorType dist2;
376 
377  public:
378  ScaledDistanceLaplacianComparison(matrix_type& A_, DistanceFunctorType& dist2_, results_view& results_)
379  : A(A_.getLocalMatrixDevice())
380  , results(results_)
381  , dist2(dist2_) {
382  // Construct ghosted distance Laplacian diagonal
383  if constexpr ((measure == Misc::SmoothedAggregationMeasure) || (measure == Misc::SignedSmoothedAggregationMeasure)) {
385  auto lclDiag2d = diagVec->getLocalViewDevice(Xpetra::Access::ReadOnly);
386  diag = Kokkos::subview(lclDiag2d, Kokkos::ALL(), 0);
387  } else if constexpr (measure == Misc::SignedRugeStuebenMeasure) {
389  auto lclDiag2d = diagVec->getLocalViewDevice(Xpetra::Access::ReadOnly);
390  diag = Kokkos::subview(lclDiag2d, Kokkos::ALL(), 0);
391  }
392  }
393 
394  template <class local_matrix_type2, class DistanceFunctorType2, class diag_view_type2>
395  struct Comparator {
396  private:
397  using scalar_type = typename local_matrix_type2::value_type;
398  using local_ordinal_type = typename local_matrix_type2::ordinal_type;
399  using memory_space = typename local_matrix_type2::memory_space;
400  using results_view = Kokkos::View<DecisionType*, memory_space>;
401 
402  using ATS = Kokkos::ArithTraits<scalar_type>;
403  using magnitudeType = typename ATS::magnitudeType;
404  using mATS = Kokkos::ArithTraits<magnitudeType>;
405 
406  const local_matrix_type2 A;
407  const diag_view_type2 diag;
408  const DistanceFunctorType2* dist2;
412 
413  const scalar_type one = ATS::one();
414  const scalar_type zero = ATS::zero();
415  const magnitudeType mzero = mATS::zero();
416 
417  public:
418  KOKKOS_INLINE_FUNCTION
419  Comparator(const local_matrix_type2& A_, const diag_view_type2& diag_, const DistanceFunctorType2* dist2_, local_ordinal_type rlid_, const results_view& results_)
420  : A(A_)
421  , diag(diag_)
422  , dist2(dist2_)
423  , rlid(rlid_)
424  , offset(A_.graph.row_map(rlid_))
425  , results(results_) {}
426 
427  KOKKOS_INLINE_FUNCTION
428  magnitudeType get_value(size_t x) const {
429  auto clid = A.graph.entries(offset + x);
430  scalar_type val;
431  if (rlid != clid) {
432  val = one / dist2->distance2(rlid, clid);
433  } else {
434  val = diag(rlid);
435  }
436 
437  if constexpr (measure == Misc::SmoothedAggregationMeasure) {
438  auto aiiajj = ATS::magnitude(diag(rlid)) * ATS::magnitude(diag(clid)); // |a_ii|*|a_jj|
439  auto aij2 = ATS::magnitude(val) * ATS::magnitude(val); // |a_ij|^2
440  return (aij2 / aiiajj);
441  } else if constexpr (measure == Misc::SignedRugeStuebenMeasure) {
442  auto neg_aij = -ATS::real(val);
443  auto max_neg_aik = ATS::real(diag(rlid));
444  if (ATS::real(neg_aij) >= mzero)
445  return ATS::magnitude(neg_aij / max_neg_aik);
446  else
447  return -ATS::magnitude(neg_aij / max_neg_aik);
448  } else if constexpr (measure == Misc::SignedSmoothedAggregationMeasure) {
449  auto aiiajj = ATS::magnitude(diag(rlid)) * ATS::magnitude(diag(clid)); // |a_ii|*|a_jj|
450  const bool is_nonpositive = ATS::real(val) <= mATS::zero();
451  magnitudeType aij2 = ATS::magnitude(val) * ATS::magnitude(val); // |a_ij|^2
452  // + |a_ij|^2, if a_ij < 0, - |a_ij|^2 if a_ij >=0
453  if (is_nonpositive)
454  aij2 = -aij2;
455  return aij2 / aiiajj;
456  }
457  }
458 
459  KOKKOS_INLINE_FUNCTION
460  bool operator()(size_t x, size_t y) const {
461  if (results(offset + x) != UNDECIDED) {
462  if (results(offset + y) != UNDECIDED) {
463  // does not matter
464  return (x < y);
465  } else {
466  // sort undecided to the right
467  return true;
468  }
469  } else {
470  if (results(offset + y) != UNDECIDED) {
471  // sort undecided to the right
472  return false;
473  } else {
474  return get_value(x) > get_value(y);
475  }
476  }
477  }
478  };
479 
481 
482  KOKKOS_INLINE_FUNCTION
484  return comparator_type(A, diag, &dist2, rlid, results);
485  }
486 };
487 
488 // helper function to allow partial template deduction
489 template <Misc::StrengthMeasure measure, class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node, class DistanceFunctorType>
491  DistanceFunctorType& dist2_,
493  if constexpr (measure == Misc::UnscaledMeasure) {
495  return functor;
496  } else {
498  return functor;
499  }
500 }
501 
506 template <class comparison_type>
508  private:
509  using local_matrix_type = typename comparison_type::local_matrix_type;
510  using scalar_type = typename local_matrix_type::value_type;
511  using local_ordinal_type = typename local_matrix_type::ordinal_type;
512  using memory_space = typename local_matrix_type::memory_space;
513  using results_view = Kokkos::View<DecisionType*, memory_space>;
514 
515  using ATS = Kokkos::ArithTraits<scalar_type>;
516  using magnitudeType = typename ATS::magnitudeType;
517  using boundary_nodes_view = Kokkos::View<const bool*, memory_space>;
518 
520  comparison_type comparison;
523  Kokkos::View<local_ordinal_type*, memory_space> index;
524 
525  public:
526  CutDropFunctor(comparison_type& comparison_, magnitudeType threshold)
527  : A(comparison_.A)
528  , comparison(comparison_)
529  , eps(threshold)
530  , results(comparison_.results) {
531  index = Kokkos::View<local_ordinal_type*, memory_space>("indices", A.nnz());
532  }
533 
534  KOKKOS_FORCEINLINE_FUNCTION
535  void operator()(const local_ordinal_type& rlid) const {
536  auto row = A.rowConst(rlid);
537  size_t nnz = row.length;
538 
539  auto drop_view = Kokkos::subview(results, Kokkos::make_pair(A.graph.row_map(rlid), A.graph.row_map(rlid + 1)));
540  auto row_permutation = Kokkos::subview(index, Kokkos::make_pair(A.graph.row_map(rlid), A.graph.row_map(rlid + 1)));
541 
542  auto comparator = comparison.getComparator(rlid);
543 
544  for (size_t i = 0; i < nnz; ++i) {
545  row_permutation(i) = i;
546  }
547  Misc::serialHeapSort(row_permutation, comparator);
548 
549  size_t keepStart = 0;
550  size_t dropStart = nnz;
551  // find index where dropping starts
552  for (size_t i = 1; i < nnz; ++i) {
553  auto const& x = row_permutation(i - 1);
554  auto const& y = row_permutation(i);
555  if ((drop_view(x) != UNDECIDED) && (drop_view(y) == UNDECIDED))
556  keepStart = i;
557  if ((drop_view(x) != UNDECIDED) || (drop_view(y) != UNDECIDED))
558  continue;
559  magnitudeType x_aij = comparator.get_value(x);
560  magnitudeType y_aij = comparator.get_value(y);
561  if (eps * eps * x_aij > y_aij) {
562  if (i < dropStart) {
563  dropStart = i;
564  }
565  }
566  }
567 
568  // drop everything to the right of where values stop passing threshold
569  for (size_t i = keepStart; i < nnz; ++i) {
570  drop_view(row_permutation(i)) = Kokkos::max(dropStart <= i ? DROP : KEEP, drop_view(row_permutation(i)));
571  }
572  }
573 };
574 
575 } // namespace MueLu::CutDrop
576 
577 #endif
Kokkos::View< const bool *, memory_space > boundary_nodes_view
KOKKOS_INLINE_FUNCTION bool operator()(size_t x, size_t y) const
typename local_matrix_type::memory_space memory_space
auto make_comparison_functor(Xpetra::Matrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A_, typename ScaledComparison< Scalar, LocalOrdinal, GlobalOrdinal, Node, measure >::results_view &results_)
static Teuchos::RCP< Vector > GetMatrixMaxMinusOffDiagonal(const Xpetra::Matrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A)
Return vector containing: max_{i=k}(-a_ik), for each for i in the matrix.
typename local_matrix_type::ordinal_type local_ordinal_type
UnscaledComparison(matrix_type &A_, results_view &results_)
Comparator< local_matrix_type, diag_view_type > comparator_type
ScaledDistanceLaplacianComparison(matrix_type &A_, DistanceFunctorType &dist2_, results_view &results_)
KOKKOS_INLINE_FUNCTION magnitudeType get_value(size_t x) const
typename local_matrix_type2::ordinal_type local_ordinal_type
KOKKOS_INLINE_FUNCTION comparator_type getComparator(local_ordinal_type rlid) const
KOKKOS_INLINE_FUNCTION comparator_type getComparator(local_ordinal_type rlid) const
Kokkos::View< DecisionType *, memory_space > results_view
typename local_matrix_type2::memory_space memory_space
Kokkos::View< DecisionType *, memory_space > results_view
typename matrix_type::local_matrix_type local_matrix_type
Teuchos::RCP< diag_vec_type > diagVec
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_)
Kokkos::View< local_ordinal_type *, memory_space > index
Kokkos::View< DecisionType *, memory_space > results_view
typename local_matrix_type::ordinal_type local_ordinal_type
typename local_matrix_type::ordinal_type local_ordinal_type
Teuchos::RCP< Xpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > getMaxMinusOffDiagonal(Xpetra::Matrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A, DistanceFunctorType &distFunctor)
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
Orders entries of row by .
typename local_matrix_type::memory_space memory_space
ScaledComparison(matrix_type &A_, results_view &results_)
KOKKOS_INLINE_FUNCTION comparator_type getComparator(local_ordinal_type rlid) const
Orders entries of row by where is the distance Laplacian.
Comparator< local_matrix_type > comparator_type
typename local_matrix_type::ordinal_type local_ordinal_type
typename ATS::magnitudeType magnitudeType
typename matrix_type::local_matrix_type local_matrix_type
typename comparison_type::local_matrix_type local_matrix_type
Kokkos::View< DecisionType *, memory_space > results_view
Comparator< local_matrix_type, DistanceFunctorType, diag_view_type > comparator_type
typename local_matrix_type::value_type scalar_type
typename local_matrix_type::value_type scalar_type
typename local_matrix_type::ordinal_type local_ordinal_type
KOKKOS_INLINE_FUNCTION void serialHeapSort(view_type &v, comparator_type comparator)
typename local_matrix_type2::ordinal_type local_ordinal_type
KOKKOS_INLINE_FUNCTION bool operator()(size_t x, size_t y) const
Kokkos::ArithTraits< scalar_type > ATS
Kokkos::ArithTraits< magnitudeType > mATS
typename local_matrix_type2::ordinal_type local_ordinal_type
UnscaledDistanceLaplacianComparison(matrix_type &A_, DistanceFunctorType &dist2_, results_view &results_)
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
Kokkos::ArithTraits< scalar_type > ATS
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
Kokkos::ArithTraits< scalar_type > ATS
typename ATS::magnitudeType magnitudeType
Order each row by a criterion, compare the ratio of values and drop all entries once the ratio is bel...
KOKKOS_INLINE_FUNCTION magnitudeType get_value(size_t x) const
typename local_matrix_type::memory_space memory_space
typename local_matrix_type::value_type scalar_type
static RCP< Vector > GetMatrixOverlappedDiagonal(const Matrix &A)
Extract Overlapped Matrix Diagonal.
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_)
typename matrix_type::local_matrix_type local_matrix_type
KOKKOS_FORCEINLINE_FUNCTION void operator()(const local_ordinal_type &rlid) const
typename local_matrix_type::value_type scalar_type
typename local_matrix_type2::value_type scalar_type
KOKKOS_INLINE_FUNCTION comparator_type getComparator(local_ordinal_type rlid) const
KOKKOS_INLINE_FUNCTION bool operator()(size_t x, size_t y) const
typename local_matrix_type2::ordinal_type local_ordinal_type
typename local_matrix_type2::memory_space memory_space
Kokkos::ArithTraits< scalar_type > ATS
Kokkos::ArithTraits< scalar_type > ATS
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(size_t x) const
Kokkos::ArithTraits< scalar_type > ATS
Teuchos::RCP< Xpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > getDiagonal(Xpetra::Matrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A, DistanceFunctorType &distFunctor)
KOKKOS_INLINE_FUNCTION Comparator(const local_matrix_type2 &A_, const diag_view_type2 &diag_, const local_ordinal_type rlid_, const results_view &results_)
KOKKOS_INLINE_FUNCTION Comparator(const local_matrix_type2 &A_, local_ordinal_type rlid_, const results_view &results_)
typename ATS::magnitudeType magnitudeType
Comparator< local_matrix_type, DistanceFunctorType, diag_view_type > comparator_type
KOKKOS_INLINE_FUNCTION magnitudeType get_value(size_t x) const
CutDropFunctor(comparison_type &comparison_, magnitudeType threshold)
typename matrix_type::local_matrix_type local_matrix_type
Kokkos::View< DecisionType *, memory_space > results_view
typename local_matrix_type::memory_space memory_space
Orders entries of row by .
typename local_matrix_type::memory_space memory_space
Kokkos::View< DecisionType *, memory_space > results_view
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_)
typename local_matrix_type::value_type scalar_type
typename local_matrix_type2::value_type scalar_type
typename local_matrix_type2::memory_space memory_space