45 #ifndef AMESOS2_KOKKOS_CRSMATRIX_MATRIXADAPTER_DEF_HPP
46 #define AMESOS2_KOKKOS_CRSMATRIX_MATRIXADAPTER_DEF_HPP
49 #include "Amesos2_MatrixAdapter_def.hpp"
50 #include "KokkosSparse_CrsMatrix.hpp"
51 #include <Tpetra_Core.hpp>
55 template <
typename Scalar,
typename LocalOrdinal,
typename ExecutionSpace>
56 ConcreteMatrixAdapter<KokkosSparse::CrsMatrix<Scalar,LocalOrdinal,ExecutionSpace>>::ConcreteMatrixAdapter(Teuchos::RCP<matrix_t> m)
57 : MatrixAdapter<KokkosSparse::CrsMatrix<Scalar,LocalOrdinal,ExecutionSpace>>(m)
62 template <
typename Scalar,
typename LocalOrdinal,
typename ExecutionSpace>
63 typename ConcreteMatrixAdapter<KokkosSparse::CrsMatrix<Scalar,LocalOrdinal,ExecutionSpace>>::global_size_t
64 ConcreteMatrixAdapter<KokkosSparse::CrsMatrix<Scalar,LocalOrdinal,ExecutionSpace>>::getRowIndexBase()
const
69 template <
typename Scalar,
typename LocalOrdinal,
typename ExecutionSpace>
70 typename ConcreteMatrixAdapter<KokkosSparse::CrsMatrix<Scalar,LocalOrdinal,ExecutionSpace>>::global_size_t
71 ConcreteMatrixAdapter<KokkosSparse::CrsMatrix<Scalar,LocalOrdinal,ExecutionSpace>>::getColumnIndexBase()
const
76 template <
typename Scalar,
typename LocalOrdinal,
typename ExecutionSpace>
77 const Teuchos::RCP<const Teuchos::Comm<int> >
78 ConcreteMatrixAdapter<KokkosSparse::CrsMatrix<Scalar,LocalOrdinal,ExecutionSpace>>::getComm_impl()
const
80 return Tpetra::getDefaultComm();
83 template <
typename Scalar,
typename LocalOrdinal,
typename ExecutionSpace>
84 const RCP<const Tpetra::Map<typename MatrixTraits<KokkosSparse::CrsMatrix<Scalar,LocalOrdinal,ExecutionSpace>>::local_ordinal_t,
85 typename MatrixTraits<KokkosSparse::CrsMatrix<Scalar,LocalOrdinal,ExecutionSpace>>::global_ordinal_t,
86 typename MatrixTraits<KokkosSparse::CrsMatrix<Scalar,LocalOrdinal,ExecutionSpace>>::node_t> >
87 ConcreteMatrixAdapter<KokkosSparse::CrsMatrix<Scalar,LocalOrdinal,ExecutionSpace>>::getRowMap_impl()
const
92 template <
typename Scalar,
typename LocalOrdinal,
typename ExecutionSpace>
93 const RCP<const Tpetra::Map<typename MatrixTraits<KokkosSparse::CrsMatrix<Scalar,LocalOrdinal,ExecutionSpace>>::local_ordinal_t,
94 typename MatrixTraits<KokkosSparse::CrsMatrix<Scalar,LocalOrdinal,ExecutionSpace>>::global_ordinal_t,
95 typename MatrixTraits<KokkosSparse::CrsMatrix<Scalar,LocalOrdinal,ExecutionSpace>>::node_t> >
96 ConcreteMatrixAdapter<KokkosSparse::CrsMatrix<Scalar,LocalOrdinal,ExecutionSpace>>::getColMap_impl()
const
101 template <
typename Scalar,
typename LocalOrdinal,
typename ExecutionSpace>
102 Teuchos::RCP<const MatrixAdapter<KokkosSparse::CrsMatrix<Scalar,LocalOrdinal,ExecutionSpace> > >
103 ConcreteMatrixAdapter<
104 KokkosSparse::CrsMatrix<Scalar,LocalOrdinal,ExecutionSpace>
105 >::get_impl(
const Teuchos::Ptr<
const Tpetra::Map<local_ordinal_t,global_ordinal_t,node_t> > map,
EDistribution distribution)
const
107 TEUCHOS_TEST_FOR_EXCEPTION(
true,
109 "get_impl() not implemented for the Kokkos CrsMatrix adapter yet. "
110 "Please contact the Amesos2 developers." );
113 template <
typename Scalar,
typename LocalOrdinal,
typename ExecutionSpace>
114 typename ConcreteMatrixAdapter<KokkosSparse::CrsMatrix<Scalar,LocalOrdinal,ExecutionSpace>>::global_size_t
115 ConcreteMatrixAdapter<
116 KokkosSparse::CrsMatrix<Scalar,LocalOrdinal,ExecutionSpace>>::getGlobalNumRows_impl()
const
118 return this->mat_->numRows();
121 template <
typename Scalar,
typename LocalOrdinal,
typename ExecutionSpace>
122 typename ConcreteMatrixAdapter<KokkosSparse::CrsMatrix<Scalar,LocalOrdinal,ExecutionSpace>>::global_size_t
123 ConcreteMatrixAdapter<
124 KokkosSparse::CrsMatrix<Scalar,LocalOrdinal,ExecutionSpace>>::getGlobalNumCols_impl()
const
126 return this->mat_->numCols();
129 template <
typename Scalar,
typename LocalOrdinal,
typename ExecutionSpace>
130 typename ConcreteMatrixAdapter<KokkosSparse::CrsMatrix<Scalar,LocalOrdinal,ExecutionSpace>>::global_size_t
131 ConcreteMatrixAdapter<
132 KokkosSparse::CrsMatrix<Scalar,LocalOrdinal,ExecutionSpace>>::getGlobalNNZ_impl()
const
134 return this->mat_->nnz();
137 template <
typename Scalar,
typename LocalOrdinal,
typename ExecutionSpace>
138 const Teuchos::RCP<const Tpetra::Map<typename MatrixTraits<KokkosSparse::CrsMatrix<Scalar,LocalOrdinal,ExecutionSpace>>::local_ordinal_t,
139 typename MatrixTraits<KokkosSparse::CrsMatrix<Scalar,LocalOrdinal,ExecutionSpace>>::global_ordinal_t,
140 typename MatrixTraits<KokkosSparse::CrsMatrix<Scalar,LocalOrdinal,ExecutionSpace>>::node_t> >
141 ConcreteMatrixAdapter<
142 KokkosSparse::CrsMatrix<Scalar,LocalOrdinal,ExecutionSpace>>::getMap_impl()
const
144 return( Teuchos::null );
147 template <
typename Scalar,
typename LocalOrdinal,
typename ExecutionSpace>
149 ConcreteMatrixAdapter<
150 KokkosSparse::CrsMatrix<Scalar,LocalOrdinal,ExecutionSpace>>::getGlobalRowNNZ_impl(global_ordinal_t row)
const
152 TEUCHOS_TEST_FOR_EXCEPTION(
true,
154 "getGlobalRowNNZ_impl() not implemented for the Kokkos CrsMatrix adapter yet. "
155 "Please contact the Amesos2 developers." );
158 template <
typename Scalar,
typename LocalOrdinal,
typename ExecutionSpace>
160 ConcreteMatrixAdapter<
161 KokkosSparse::CrsMatrix<Scalar,LocalOrdinal,ExecutionSpace>>::getLocalRowNNZ_impl(local_ordinal_t row)
const
163 TEUCHOS_TEST_FOR_EXCEPTION(
true,
165 "getLocalRowNNZ_impl() not implemented for the Kokkos CrsMatrix adapter yet. "
166 "Please contact the Amesos2 developers." );
169 template <
typename Scalar,
typename LocalOrdinal,
typename ExecutionSpace>
171 ConcreteMatrixAdapter<
172 KokkosSparse::CrsMatrix<Scalar,LocalOrdinal,ExecutionSpace>>::getGlobalColNNZ_impl(global_ordinal_t col)
const
174 TEUCHOS_TEST_FOR_EXCEPTION(
true,
176 "Column access to row-based object not yet supported. "
177 "Please contact the Amesos2 developers." );
180 template <
typename Scalar,
typename LocalOrdinal,
typename ExecutionSpace>
182 ConcreteMatrixAdapter<
183 KokkosSparse::CrsMatrix<Scalar,LocalOrdinal,ExecutionSpace>>::getLocalColNNZ_impl(local_ordinal_t col)
const
185 TEUCHOS_TEST_FOR_EXCEPTION(
true,
187 "Column access to row-based object not yet supported. "
188 "Please contact the Amesos2 developers." );
192 template <
typename Scalar,
typename LocalOrdinal,
typename ExecutionSpace>
194 ConcreteMatrixAdapter<
195 KokkosSparse::CrsMatrix<Scalar,LocalOrdinal,ExecutionSpace>>::getGlobalRowCopy_impl(global_ordinal_t row,
196 const ArrayView<global_ordinal_t>& indices,
197 const ArrayView<scalar_t>& vals,
200 TEUCHOS_TEST_FOR_EXCEPTION(
true,
202 "getGlobalRowCopy_impl not implemented for Kokkos CrsMatrix yet. "
203 "Please contact the Amesos2 developers." );
206 template <
typename Scalar,
typename LocalOrdinal,
typename ExecutionSpace>
208 ConcreteMatrixAdapter<
209 KokkosSparse::CrsMatrix<Scalar,LocalOrdinal,ExecutionSpace>>::getGlobalColCopy_impl(global_ordinal_t col,
210 const ArrayView<global_ordinal_t>& indices,
211 const ArrayView<scalar_t>& vals,
214 TEUCHOS_TEST_FOR_EXCEPTION(
true,
216 "Column access to row-based object not yet supported. "
217 "Please contact the Amesos2 developers." );
220 template <
typename Scalar,
typename LocalOrdinal,
typename ExecutionSpace>
221 typename ConcreteMatrixAdapter<KokkosSparse::CrsMatrix<Scalar,LocalOrdinal,ExecutionSpace>>::spmtx_ptr_t
222 ConcreteMatrixAdapter<KokkosSparse::CrsMatrix<Scalar,LocalOrdinal,ExecutionSpace>>::getSparseRowPtr()
const
224 return this->mat_->graph.row_map.data();
227 template <
typename Scalar,
typename LocalOrdinal,
typename ExecutionSpace>
228 typename ConcreteMatrixAdapter<KokkosSparse::CrsMatrix<Scalar,LocalOrdinal,ExecutionSpace>>::spmtx_idx_t
229 ConcreteMatrixAdapter<KokkosSparse::CrsMatrix<Scalar,LocalOrdinal,ExecutionSpace>>::getSparseColInd()
const
231 return this->mat_->graph.entries.data();
234 template <
typename Scalar,
typename LocalOrdinal,
typename ExecutionSpace>
235 typename ConcreteMatrixAdapter<KokkosSparse::CrsMatrix<Scalar,LocalOrdinal,ExecutionSpace>>::spmtx_vals_t
236 ConcreteMatrixAdapter<KokkosSparse::CrsMatrix<Scalar,LocalOrdinal,ExecutionSpace>>::getSparseValues()
const
238 return this->mat_->values.data();
243 #endif // AMESOS2_KOKKOS_CRSMATRIX_MATRIXADAPTER_DEF_HPP
Specialization of the ConcreteMatrixAdapter for KokkosSparse::CrsMatrix.
EDistribution
Definition: Amesos2_TypeDecl.hpp:123