Tpetra parallel linear algebra  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
TpetraExt_MatrixMatrix_decl.hpp
Go to the documentation of this file.
1 // @HEADER
2 // *****************************************************************************
3 // Tpetra: Templated Linear Algebra Services Package
4 //
5 // Copyright 2008 NTESS and the Tpetra contributors.
6 // SPDX-License-Identifier: BSD-3-Clause
7 // *****************************************************************************
8 // @HEADER
9 
10 #ifndef TPETRA_MATRIXMATRIX_DECL_HPP
11 #define TPETRA_MATRIXMATRIX_DECL_HPP
12 
13 #include <string>
14 #include <Teuchos_RCP.hpp>
15 #include <Teuchos_Array.hpp>
16 #include "Tpetra_ConfigDefs.hpp"
17 #include "Tpetra_CrsMatrix.hpp"
18 #include "Tpetra_BlockCrsMatrix.hpp"
19 #include "Tpetra_Vector.hpp"
20 #include "TpetraExt_MMHelpers.hpp"
21 #include "KokkosKernels_Handle.hpp"
22 
23 
29 namespace Tpetra {
30 
31 namespace MatrixMatrix {
32 
63 template <class Scalar,
64  class LocalOrdinal,
65  class GlobalOrdinal,
66  class Node>
67 void Multiply(
68  const CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>& A,
69  bool transposeA,
70  const CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>& B,
71  bool transposeB,
72  CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>& C,
73  bool call_FillComplete_on_result = true,
74  const std::string& label = std::string(),
75  const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null);
76 
92 template <class Scalar,
93  class LocalOrdinal,
94  class GlobalOrdinal,
95  class Node>
96 void Multiply(
97  const Teuchos::RCP<const BlockCrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> >& A,
98  bool transposeA,
99  const Teuchos::RCP<const BlockCrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> >& B,
100  bool transposeB,
101  Teuchos::RCP<BlockCrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> >& C,
102  const std::string& label = std::string());
103 
115 template <class Scalar,
116  class LocalOrdinal,
117  class GlobalOrdinal,
118  class Node>
119 void Add(
120  const CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>& A,
121  bool transposeA,
122  Scalar scalarA,
123  CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>& B,
124  Scalar scalarB );
125 
155 template <class Scalar,
156  class LocalOrdinal,
157  class GlobalOrdinal,
158  class Node>
159 Teuchos::RCP<CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> >
160 add (const Scalar& alpha,
161  const bool transposeA,
162  const CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>& A,
163  const Scalar& beta,
164  const bool transposeB,
165  const CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>& B,
166  const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> >& domainMap = Teuchos::null,
167  const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> >& rangeMap = Teuchos::null,
168  const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null);
169 
170 
206 template <class Scalar,
207  class LocalOrdinal,
208  class GlobalOrdinal,
209  class Node>
210 void
211 add (const Scalar& alpha,
212  const bool transposeA,
213  const CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>& A,
214  const Scalar& beta,
215  const bool transposeB,
216  const CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>& B,
217  CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> & C,
218  const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> >& domainMap = Teuchos::null,
219  const Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> >& rangeMap = Teuchos::null,
220  const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null);
221 
222 
257 template <class Scalar,
258  class LocalOrdinal,
259  class GlobalOrdinal,
260  class Node>
261 void Add(
262  const CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>& A,
263  bool transposeA,
264  Scalar scalarA,
265  const CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>& B,
266  bool transposeB,
267  Scalar scalarB,
268  Teuchos::RCP<CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> >& C);
269 
299 template <class Scalar,
300  class LocalOrdinal,
301  class GlobalOrdinal,
302  class Node>
303 void Add(
304  const CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>& A,
305  bool transposeA,
306  Scalar scalarA,
307  const CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>& B,
308  bool transposeB,
309  Scalar scalarB,
310  const Teuchos::RCP<CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> >& C);
311 
333  template <class Scalar,
334  class LocalOrdinal,
335  class GlobalOrdinal,
336  class Node>
337  void Jacobi(Scalar omega,
338  const Vector<Scalar, LocalOrdinal, GlobalOrdinal, Node> & Dinv,
339  const CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>& A,
340  const CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>& B,
341  CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>& C,
342  bool call_FillComplete_on_result = true,
343  const std::string& label = std::string(),
344  const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null);
345 
346 } // namespace MatrixMatrix
347 
348 namespace MMdetails{
349 
350  // Matrix multiplication functions
351 template<class Scalar,
352  class LocalOrdinal,
353  class GlobalOrdinal,
354  class Node>
355 void mult_AT_B_newmatrix(
356  const CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>& A,
357  const CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>& B,
358  CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>& C,
359  const std::string& label = std::string(),
360  const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null);
361 
362 
363 template<class Scalar,
364  class LocalOrdinal,
365  class GlobalOrdinal,
366  class Node>
367 void mult_A_B(
368  CrsMatrixStruct<Scalar, LocalOrdinal, GlobalOrdinal, Node>& Aview,
369  CrsMatrixStruct<Scalar, LocalOrdinal, GlobalOrdinal, Node>& Bview,
370  CrsWrapper<Scalar, LocalOrdinal, GlobalOrdinal, Node>& C,
371  const std::string& label = std::string(),
372  const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null);
373 
374 template<class Scalar,
375  class LocalOrdinal,
376  class GlobalOrdinal,
377  class Node>
378 void mult_A_B_newmatrix(
379  CrsMatrixStruct<Scalar, LocalOrdinal, GlobalOrdinal, Node>& Aview,
380  CrsMatrixStruct<Scalar, LocalOrdinal, GlobalOrdinal, Node>& Bview,
381  CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>& C,
382  const std::string& label = std::string(),
383  const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null);
384 
385 template<class Scalar,
386  class LocalOrdinal,
387  class GlobalOrdinal,
388  class Node>
389 void mult_A_B_newmatrix(
390  BlockCrsMatrixStruct<Scalar, LocalOrdinal, GlobalOrdinal, Node>& Aview,
391  BlockCrsMatrixStruct<Scalar, LocalOrdinal, GlobalOrdinal, Node>& Bview,
392  Teuchos::RCP<BlockCrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node> >& C);
393 
394 template<class Scalar,
395  class LocalOrdinal,
396  class GlobalOrdinal,
397  class Node>
398 void mult_A_B_reuse(
399  CrsMatrixStruct<Scalar, LocalOrdinal, GlobalOrdinal, Node>& Aview,
400  CrsMatrixStruct<Scalar, LocalOrdinal, GlobalOrdinal, Node>& Bview,
401  CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>& C,
402  const std::string& label = std::string(),
403  const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null);
404 
405 
406 
407 
408  // Matrix jacobi functions
409 template<class Scalar,
410  class LocalOrdinal,
411  class GlobalOrdinal,
412  class Node>
413 void jacobi_A_B_newmatrix(
414  Scalar omega,
415  const Vector<Scalar, LocalOrdinal, GlobalOrdinal, Node> & Dinv,
416  CrsMatrixStruct<Scalar, LocalOrdinal, GlobalOrdinal, Node>& Aview,
417  CrsMatrixStruct<Scalar, LocalOrdinal, GlobalOrdinal, Node>& Bview,
418  CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>& C,
419  const std::string & label = std::string(),
420  const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null);
421 
422 
423 template<class Scalar,
424  class LocalOrdinal,
425  class GlobalOrdinal,
426  class Node>
427 void jacobi_A_B_reuse(
428  Scalar omega,
429  const Vector<Scalar, LocalOrdinal, GlobalOrdinal, Node> & Dinv,
430  CrsMatrixStruct<Scalar, LocalOrdinal, GlobalOrdinal, Node>& Aview,
431  CrsMatrixStruct<Scalar, LocalOrdinal, GlobalOrdinal, Node>& Bview,
432  CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>& C,
433  const std::string & label = std::string(),
434  const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null);
435 
436  // Other functions
437 template<class Scalar,
438  class LocalOrdinal,
439  class GlobalOrdinal,
440  class Node>
441 void import_and_extract_views(
442  const CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>& M,
443  Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> > targetMap,
444  CrsMatrixStruct<Scalar, LocalOrdinal, GlobalOrdinal, Node>& Mview,
445  Teuchos::RCP<const Import<LocalOrdinal,GlobalOrdinal, Node> > prototypeImporter,
446  bool userAssertsThereAreNoRemotes,
447  const std::string& label,
448  const Teuchos::RCP<Teuchos::ParameterList>& params);
449 
450 template<class Scalar,
451  class LocalOrdinal,
452  class GlobalOrdinal,
453  class Node>
454 void import_and_extract_views(
455  const BlockCrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>& M,
456  Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> > targetMap,
457  BlockCrsMatrixStruct<Scalar, LocalOrdinal, GlobalOrdinal, Node>& Mview,
458  Teuchos::RCP<const Import<LocalOrdinal,GlobalOrdinal, Node> > prototypeImporter,
459  bool userAssertsThereAreNoRemotes);
460 
461 template<class Scalar,
462  class LocalOrdinal,
463  class GlobalOrdinal,
464  class Node>
465 void setMaxNumEntriesPerRow(
466  CrsMatrixStruct<Scalar, LocalOrdinal, GlobalOrdinal, Node>& Mview);
467 
468 
469  // MMM Kernel wrappers struct
470  // Because C++ doesn't support partial template specialization of functions.
471  template<class Scalar,
472  class LocalOrdinal,
473  class GlobalOrdinal,
474  class Node,
475  class LocalOrdinalViewType>
476  struct KernelWrappers {
477  static inline void mult_A_B_newmatrix_kernel_wrapper(CrsMatrixStruct<Scalar, LocalOrdinal, GlobalOrdinal, Node>& Aview,
478  CrsMatrixStruct<Scalar, LocalOrdinal, GlobalOrdinal, Node>& Bview,
479  const LocalOrdinalViewType & Acol2Brow,
480  const LocalOrdinalViewType & Acol2Irow,
481  const LocalOrdinalViewType & Bcol2Ccol,
482  const LocalOrdinalViewType & Icol2Ccol,
483  CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>& C,
484  Teuchos::RCP<const Import<LocalOrdinal,GlobalOrdinal,Node> > Cimport,
485  const std::string& label = std::string(),
486  const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null);
487 
488  static inline void mult_A_B_reuse_kernel_wrapper(CrsMatrixStruct<Scalar, LocalOrdinal, GlobalOrdinal, Node>& Aview,
489  CrsMatrixStruct<Scalar, LocalOrdinal, GlobalOrdinal, Node>& Bview,
490  const LocalOrdinalViewType & Acol2Brow,
491  const LocalOrdinalViewType & Acol2Irow,
492  const LocalOrdinalViewType & Bcol2Ccol,
493  const LocalOrdinalViewType & Icol2Ccol,
494  CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>& C,
495  Teuchos::RCP<const Import<LocalOrdinal,GlobalOrdinal,Node> > Cimport,
496  const std::string& label = std::string(),
497  const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null);
498  };
499 
500  // Jacobi Kernel wrappers struct
501  // Because C++ doesn't support partial template specialization of functions.
502 
503  template<class Scalar,
504  class LocalOrdinal,
505  class GlobalOrdinal,
506  class Node,
507  class LocalOrdinalViewType>
508  struct KernelWrappers2 {
509  static inline void jacobi_A_B_newmatrix_kernel_wrapper(Scalar omega,
510  const Vector<Scalar,LocalOrdinal,GlobalOrdinal,Node> & Dinv,
511  CrsMatrixStruct<Scalar, LocalOrdinal, GlobalOrdinal, Node>& Aview,
512  CrsMatrixStruct<Scalar, LocalOrdinal, GlobalOrdinal, Node>& Bview,
513  const LocalOrdinalViewType & Acol2Brow,
514  const LocalOrdinalViewType & Acol2Irow,
515  const LocalOrdinalViewType & Bcol2Ccol,
516  const LocalOrdinalViewType & Icol2Ccol,
517  CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>& C,
518  Teuchos::RCP<const Import<LocalOrdinal,GlobalOrdinal,Node> > Cimport,
519  const std::string& label = std::string(),
520  const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null);
521 
522  static inline void jacobi_A_B_reuse_kernel_wrapper(Scalar omega,
523  const Vector<Scalar,LocalOrdinal,GlobalOrdinal,Node> & Dinv,
524  CrsMatrixStruct<Scalar, LocalOrdinal, GlobalOrdinal, Node>& Aview,
525  CrsMatrixStruct<Scalar, LocalOrdinal, GlobalOrdinal, Node>& Bview,
526  const LocalOrdinalViewType & Acol2Brow,
527  const LocalOrdinalViewType & Acol2Irow,
528  const LocalOrdinalViewType & Bcol2Ccol,
529  const LocalOrdinalViewType & Icol2Ccol,
530  CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>& C,
531  Teuchos::RCP<const Import<LocalOrdinal,GlobalOrdinal,Node> > Cimport,
532  const std::string& label = std::string(),
533  const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null);
534  };
535 
536 
537  // Triple-Product Kernel wrappers struct
538  // Because C++ doesn't support partial template specialization of functions.
539  template<class Scalar,
540  class LocalOrdinal,
541  class GlobalOrdinal,
542  class Node,
543  class LocalOrdinalViewType>
544  struct KernelWrappers3 {
545  static inline void mult_R_A_P_newmatrix_kernel_wrapper(CrsMatrixStruct<Scalar, LocalOrdinal, GlobalOrdinal, Node>& Rview,
546  CrsMatrixStruct<Scalar, LocalOrdinal, GlobalOrdinal, Node>& Aview,
547  CrsMatrixStruct<Scalar, LocalOrdinal, GlobalOrdinal, Node>& Pview,
548  const LocalOrdinalViewType & Acol2Prow,
549  const LocalOrdinalViewType & Acol2PIrow,
550  const LocalOrdinalViewType & Pcol2Ccol,
551  const LocalOrdinalViewType & PIcol2Ccol,
552  CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>& Ac,
553  Teuchos::RCP<const Import<LocalOrdinal,GlobalOrdinal,Node> > Acimport,
554  const std::string& label = std::string(),
555  const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null);
556 
557  static inline void mult_R_A_P_reuse_kernel_wrapper(CrsMatrixStruct<Scalar, LocalOrdinal, GlobalOrdinal, Node>& Rview,
558  CrsMatrixStruct<Scalar, LocalOrdinal, GlobalOrdinal, Node>& Aview,
559  CrsMatrixStruct<Scalar, LocalOrdinal, GlobalOrdinal, Node>& Pview,
560  const LocalOrdinalViewType & Acol2Prow,
561  const LocalOrdinalViewType & Acol2PIrow,
562  const LocalOrdinalViewType & Pcol2Ccol,
563  const LocalOrdinalViewType & PIcol2Ccol,
564  CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>& Ac,
565  Teuchos::RCP<const Import<LocalOrdinal,GlobalOrdinal,Node> > Acimport,
566  const std::string& label = std::string(),
567  const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null);
568 
569 
570  static inline void mult_PT_A_P_newmatrix_kernel_wrapper(CrsMatrixStruct<Scalar, LocalOrdinal, GlobalOrdinal, Node>& Aview,
571  CrsMatrixStruct<Scalar, LocalOrdinal, GlobalOrdinal, Node>& Pview,
572  const LocalOrdinalViewType & Acol2Prow,
573  const LocalOrdinalViewType & Acol2PIrow,
574  const LocalOrdinalViewType & Pcol2Ccol,
575  const LocalOrdinalViewType & PIcol2Ccol,
576  CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>& Ac,
577  Teuchos::RCP<const Import<LocalOrdinal,GlobalOrdinal,Node> > Acimport,
578  const std::string& label = std::string(),
579  const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null);
580 
581  static inline void mult_PT_A_P_reuse_kernel_wrapper(CrsMatrixStruct<Scalar, LocalOrdinal, GlobalOrdinal, Node>& Aview,
582  CrsMatrixStruct<Scalar, LocalOrdinal, GlobalOrdinal, Node>& Pview,
583  const LocalOrdinalViewType & Acol2Prow,
584  const LocalOrdinalViewType & Acol2PIrow,
585  const LocalOrdinalViewType & Pcol2Ccol,
586  const LocalOrdinalViewType & PIcol2Ccol,
587  CrsMatrix<Scalar, LocalOrdinal, GlobalOrdinal, Node>& Ac,
588  Teuchos::RCP<const Import<LocalOrdinal,GlobalOrdinal,Node> > Acimport,
589  const std::string& label = std::string(),
590  const Teuchos::RCP<Teuchos::ParameterList>& params = Teuchos::null);
591  };
592 
593  // This only merges matrices that look like B & Bimport, aka, they have no overlapping rows
594  template<class Scalar,class LocalOrdinal,class GlobalOrdinal,class Node, class LocalOrdinalViewType>
596  merge_matrices(CrsMatrixStruct<Scalar, LocalOrdinal, GlobalOrdinal, Node>& Aview,
597  CrsMatrixStruct<Scalar, LocalOrdinal, GlobalOrdinal, Node>& Bview,
598  const LocalOrdinalViewType & Acol2Brow,
599  const LocalOrdinalViewType & Acol2Irow,
600  const LocalOrdinalViewType & Bcol2Ccol,
601  const LocalOrdinalViewType & Icol2Ccol,
602  const size_t mergedNodeNumCols);
603 
604  // This only merges matrices that look like B & Bimport, aka, they have no overlapping rows
605  template<class Scalar,class LocalOrdinal,class GlobalOrdinal,class Node, class LocalOrdinalViewType>
606  inline const typename Tpetra::BlockCrsMatrix<Scalar,LocalOrdinal,GlobalOrdinal,Node>::local_matrix_device_type
607  merge_matrices(BlockCrsMatrixStruct<Scalar, LocalOrdinal, GlobalOrdinal, Node>& Aview,
608  BlockCrsMatrixStruct<Scalar, LocalOrdinal, GlobalOrdinal, Node>& Bview,
609  const LocalOrdinalViewType & Acol2Brow,
610  const LocalOrdinalViewType & Acol2Irow,
611  const LocalOrdinalViewType & Bcol2Ccol,
612  const LocalOrdinalViewType & Icol2Ccol,
613  const size_t mergedNodeNumCols);
614 
615 
616 
617 
618 template<class CrsMatrixType>
619 size_t C_estimate_nnz(CrsMatrixType & A, CrsMatrixType &B);
620 
621 template<typename Scalar, typename LocalOrdinal, typename GlobalOrdinal, typename Node>
622 struct AddKernels
623 {
626  typedef typename Node::device_type device_type;
627  typedef typename device_type::execution_space execution_space;
628  typedef typename device_type::memory_space memory_space;
629  typedef typename crs_matrix_type::impl_scalar_type impl_scalar_type;
630  typedef typename crs_matrix_type::local_matrix_device_type KCRS;
631  typedef typename KCRS::values_type::non_const_type values_array;
632  typedef typename KCRS::row_map_type::non_const_type row_ptrs_array;
633  typedef typename KCRS::row_map_type row_ptrs_array_const;
634  typedef typename KCRS::index_type::non_const_type col_inds_array;
635  typedef typename map_type::local_map_type local_map_type;
636  typedef typename Kokkos::View<GlobalOrdinal*, device_type> global_col_inds_array;
637  typedef Kokkos::RangePolicy<execution_space> range_type;
638  typedef KokkosKernels::Experimental::KokkosKernelsHandle<size_t, LocalOrdinal, impl_scalar_type,
639  execution_space, memory_space, memory_space> KKH;
640 
655  static void addSorted(
656  const values_array& Avals,
657  const row_ptrs_array_const& Arowptrs,
658  const col_inds_array& Acolinds,
659  const impl_scalar_type scalarA,
660  const values_array& Bvals,
661  const row_ptrs_array_const& Browptrs,
662  const col_inds_array& Bcolinds,
663  const impl_scalar_type scalarB,
664 #if KOKKOSKERNELS_VERSION >= 40299
665  GlobalOrdinal numGlobalCols,
666 #endif
667  values_array& Cvals,
668  row_ptrs_array& Crowptrs,
669  col_inds_array& Ccolinds);
670 
682  static void convertToGlobalAndAdd(
683  const KCRS& A,
684  const impl_scalar_type scalarA,
685  const KCRS& B,
686  const impl_scalar_type scalarB,
687  const local_map_type& AcolMap,
688  const local_map_type& BcolMap,
689  values_array& Cvals,
690  row_ptrs_array& Crowptrs,
691  global_col_inds_array& Ccolinds);
692 
707  static void addUnsorted(
708  const values_array& Avals,
709  const row_ptrs_array_const& Arowptrs,
710  const col_inds_array& Acolinds,
711  const impl_scalar_type scalarA,
712  const values_array& Bvals,
713  const row_ptrs_array_const& Browptrs,
714  const col_inds_array& Bcolinds,
715  const impl_scalar_type scalarB,
716  GlobalOrdinal numGlobalCols,
717  values_array& Cvals,
718  row_ptrs_array& Crowptrs,
719  col_inds_array& Ccolinds);
720 };
721 
722 }//end namespace MMdetails
723 
724 } // end of Tpetra namespace
725 
726 #endif // TPETRA_MATRIXMATRIX_DECL_HPP
727 
Sparse matrix that presents a row-oriented interface that lets users read or modify entries...
void Jacobi(Scalar omega, const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &Dinv, const CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A, const CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > &B, CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > &C, bool call_FillComplete_on_result=true, const std::string &label=std::string(), const Teuchos::RCP< Teuchos::ParameterList > &params=Teuchos::null)
KokkosSparse::CrsMatrix< impl_scalar_type, local_ordinal_type, device_type, void, typename local_graph_device_type::size_type > local_matrix_device_type
The specialization of Kokkos::CrsMatrix that represents the part of the sparse matrix on each MPI pro...
void Add(const CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A, bool transposeA, Scalar scalarA, CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > &B, Scalar scalarB)
void Multiply(const CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A, bool transposeA, const CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > &B, bool transposeB, CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > &C, bool call_FillComplete_on_result=true, const std::string &label=std::string(), const Teuchos::RCP< Teuchos::ParameterList > &params=Teuchos::null)
Sparse matrix-matrix multiply.
typename row_matrix_type::impl_scalar_type impl_scalar_type
The type used internally in place of Scalar.
A parallel distribution of indices over processes.
Teuchos::RCP< CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > > add(const Scalar &alpha, const bool transposeA, const CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A, const Scalar &beta, const bool transposeB, const CrsMatrix< Scalar, LocalOrdinal, GlobalOrdinal, Node > &B, const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &domainMap=Teuchos::null, const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &rangeMap=Teuchos::null, const Teuchos::RCP< Teuchos::ParameterList > &params=Teuchos::null)
Compute the sparse matrix sum C = scalarA * Op(A) + scalarB * Op(B), where Op(X) is either X or its t...
::Tpetra::Details::LocalMap< local_ordinal_type, global_ordinal_type, device_type > local_map_type
Type of the &quot;local&quot; Map.