42 #include "Teuchos_UnitTestHelpers.hpp" 46 #include "Kokkos_Sparse.hpp" 54 #include "Kokkos_Core.hpp" 57 template<
typename IntType >
64 return k + N * (
j + N * i );
67 template <
typename ordinal >
70 std::vector< std::vector<ordinal> >& graph )
72 graph.resize( N * N * N, std::vector<ordinal>() );
76 for (
int i = 0; i < (
int) N; ++i ) {
77 for (
int j = 0;
j < (
int) N; ++
j ) {
78 for (
int k = 0; k < (
int) N; ++k ) {
82 graph[row].reserve(27);
84 for (
int ii = -1; ii < 2; ++ii ) {
85 for (
int jj = -1; jj < 2; ++jj ) {
86 for (
int kk = -1; kk < 2; ++kk ) {
87 if ( 0 <= i + ii && i + ii < (
int) N &&
88 0 <=
j + jj &&
j + jj < (
int) N &&
89 0 <= k + kk && k + kk < (
int) N ) {
92 graph[row].push_back(col);
95 total += graph[row].size();
101 template <
typename scalar,
typename ordinal>
104 const ordinal nStoch,
105 const ordinal iRowFEM,
106 const ordinal iColFEM,
107 const ordinal iStoch )
109 const scalar A_fem = ( 10.0 + scalar(iRowFEM) / scalar(nFEM) ) +
110 ( 5.0 + scalar(iColFEM) / scalar(nFEM) );
112 const scalar A_stoch = ( 1.0 + scalar(iStoch) / scalar(nStoch) );
114 return A_fem + A_stoch;
118 template <
typename scalar,
typename ordinal>
121 const ordinal nStoch,
122 const ordinal iColFEM,
123 const ordinal iStoch )
125 const scalar X_fem = 100.0 + scalar(iColFEM) / scalar(nFEM);
126 const scalar X_stoch = 1.0 + scalar(iStoch) / scalar(nStoch);
127 return X_fem + X_stoch;
131 template <
typename kokkos_cijk_type,
typename ordinal_type>
137 using Teuchos::Array;
147 Array< RCP<const one_d_basis> > bases(
stoch_dim);
149 bases[i] = rcp(
new legendre_basis(
poly_ord,
true));
150 RCP<const product_basis> basis = rcp(
new product_basis(bases));
153 RCP<Cijk>
cijk = basis->computeTripleProductTensor();
156 kokkos_cijk_type kokkos_cijk =
157 Stokhos::create_product_tensor<execution_space>(*basis, *
cijk);
163 template <
typename Scalar>
struct ScalarTol {};
164 template <>
struct ScalarTol<float> {
static float tol() {
return 1e-4; } };
168 template <
typename array_type,
typename scalar_type>
170 const array_type& y_exp,
173 Teuchos::FancyOStream& out)
175 typedef typename array_type::size_type size_type;
181 size_type num_rows =
y.dimension_0();
182 size_type num_cols =
y.dimension_1();
184 for (size_type i=0; i<num_rows; ++i) {
185 for (size_type
j=0;
j<num_cols; ++
j) {
189 out <<
"y_expected(" << i <<
"," <<
j <<
") - " 190 <<
"y(" << i <<
"," <<
j <<
") = " << hy_exp(i,
j)
191 <<
" - " << hy(i,
j) <<
" == " 192 << diff <<
" < " << tol <<
" : ";
198 success = success && s;
205 template <
typename vector_type,
typename scalar_type>
207 const vector_type& y_exp,
210 Teuchos::FancyOStream& out)
212 typedef typename vector_type::size_type size_type;
218 size_type num_rows =
y.dimension_0();
220 for (size_type i=0; i<num_rows; ++i) {
225 out <<
"y_expected(" << i <<
").coeff(" <<
j <<
") - " 226 <<
"y(" << i <<
").coeff(" <<
j <<
") = " << hy_exp(i).fastAccessCoeff(
j)
227 <<
" - " << hy(i).fastAccessCoeff(
j) <<
" == " 228 << diff <<
" < " << tol <<
" : ";
234 success = success && s;
240 template <
typename vector_type,
typename scalar_type>
242 const vector_type& y_exp,
245 Teuchos::FancyOStream& out)
247 typedef typename vector_type::size_type size_type;
253 size_type num_rows =
y.dimension_0();
254 size_type num_cols =
y.dimension_1();
257 for (size_type col = 0; col < num_cols; ++col){
258 for (size_type i=0; i<num_rows; ++i) {
263 out <<
"y_expected(" << i <<
").coeff(" <<
j <<
") - " 264 <<
"y(" << i <<
").coeff(" <<
j <<
") = " << hy_exp(i,col).fastAccessCoeff(
j)
265 <<
" - " << hy(i,col).fastAccessCoeff(
j) <<
" == " 266 << diff <<
" < " << tol <<
" : ";
272 success = success && s;
283 template <
typename MatrixType,
typename CijkType>
287 const CijkType&
cijk) {
289 typedef typename MatrixType::StaticCrsGraphType matrix_graph_type;
290 typedef typename MatrixType::values_type matrix_values_type;
292 std::vector< std::vector<ordinal_type> > graph(nrow);
294 graph[i] = std::vector<ordinal_type>(1, i);
297 matrix_graph_type matrix_graph =
298 Kokkos::create_staticcrsgraph<matrix_graph_type>(
"graph", graph);
299 matrix_values_type matrix_values =
300 Kokkos::make_view<matrix_values_type>(
"values",
cijk, graph_length, pce_size);
302 MatrixType matrix(
"matrix", nrow, matrix_values, matrix_graph);
311 template <
typename MatrixType>
322 KOKKOS_INLINE_FUNCTION
327 m_matrix.replaceValues(row, &col, 1, &
val,
false,
true);
331 static void apply(
const MatrixType matrix) {
337 static bool check(
const MatrixType matrix,
338 Teuchos::FancyOStream& out) {
339 typedef typename MatrixType::values_type matrix_values_type;
340 typename matrix_values_type::HostMirror host_matrix_values =
350 "matrix_values(row)",
354 success = success && s;
361 template <
typename MatrixType>
372 KOKKOS_INLINE_FUNCTION
377 m_matrix.sumIntoValues(row, &col, 1, &
val,
false,
true);
381 static void apply(
const MatrixType matrix) {
387 static bool check(
const MatrixType matrix,
388 Teuchos::FancyOStream& out) {
389 typedef typename MatrixType::values_type matrix_values_type;
390 typename matrix_values_type::HostMirror host_matrix_values =
400 "matrix_values(row)",
404 success = success && s;
412 template <
typename MatrixType>
423 KOKKOS_INLINE_FUNCTION
428 m_matrix.sumIntoValues(row, &col, 1, &
val,
false,
true);
432 static void apply(
const MatrixType matrix) {
438 static bool check(
const MatrixType matrix,
439 Teuchos::FancyOStream& out) {
440 typedef typename MatrixType::values_type matrix_values_type;
441 typename matrix_values_type::HostMirror host_matrix_values =
451 val_expected = nrow*(nrow-1)/2;
455 "matrix_values(row)",
459 success = success && s;
466 Kokkos_CrsMatrix_PCE, ReplaceValues, MatrixScalar )
470 typedef typename MatrixScalar::cijk_type Cijk;
471 typedef KokkosSparse::CrsMatrix<MatrixScalar,Ordinal,Device> Matrix;
481 Matrix matrix = buildDiagonalMatrix<Matrix>(nrow, pce_size,
cijk);
485 kernel::apply(matrix);
488 success = kernel::check(matrix, out);
492 Kokkos_CrsMatrix_PCE, SumIntoValues, MatrixScalar )
496 typedef typename MatrixScalar::cijk_type Cijk;
497 typedef KokkosSparse::CrsMatrix<MatrixScalar,Ordinal,Device> Matrix;
507 Matrix matrix = buildDiagonalMatrix<Matrix>(nrow, pce_size,
cijk);
511 kernel::apply(matrix);
514 success = kernel::check(matrix, out);
518 Kokkos_CrsMatrix_PCE, SumIntoValuesAtomic, MatrixScalar )
522 typedef typename MatrixScalar::cijk_type Cijk;
523 typedef KokkosSparse::CrsMatrix<MatrixScalar,Ordinal,Device> Matrix;
533 Matrix matrix = buildDiagonalMatrix<Matrix>(nrow, pce_size,
cijk);
537 kernel::apply(matrix);
540 success = kernel::check(matrix, out);
543 template <
typename PCEType,
typename Multiply>
547 Kokkos::DeviceConfig dev_config,
548 Multiply multiply_op,
549 Teuchos::FancyOStream& out)
554 typedef typename PCEType::cijk_type cijk_type;
556 typedef Kokkos::LayoutLeft Layout;
557 typedef Kokkos::View< PCEType*, Layout, execution_space > block_vector_type;
558 typedef KokkosSparse::CrsMatrix< PCEType, ordinal_type, execution_space > block_matrix_type;
559 typedef typename block_matrix_type::StaticCrsGraphType matrix_graph_type;
560 typedef typename block_matrix_type::values_type matrix_values_type;
570 TEUCHOS_TEST_FOR_EXCEPTION(
571 storage_type::is_static && storage_type::static_size != stoch_length,
573 "Static storage size must equal pce size");
577 std::vector< std::vector<ordinal_type> > fem_graph;
584 block_vector_type
x =
585 Kokkos::make_view<block_vector_type>(
"x",
cijk, fem_length, stoch_length_aligned);
586 block_vector_type
y =
587 Kokkos::make_view<block_vector_type>(
"y",
cijk, fem_length, stoch_length_aligned);
593 typename block_vector_type::HostMirror::array_type hax = hx ;
594 typename block_vector_type::HostMirror::array_type hay = hy ;
596 for (
ordinal_type iRowFEM=0; iRowFEM<fem_length; ++iRowFEM) {
597 for (
ordinal_type iRowStoch=0; iRowStoch<stoch_length; ++iRowStoch) {
598 hax(iRowStoch, iRowFEM) =
599 generate_vector_coefficient<scalar_type>(
600 fem_length, stoch_length, iRowFEM, iRowStoch );
601 hay(iRowStoch, iRowFEM) = 0.0;
611 matrix_graph_type matrix_graph =
612 Kokkos::create_staticcrsgraph<matrix_graph_type>(
613 std::string(
"test crs graph"), fem_graph);
614 matrix_values_type matrix_values =
615 Kokkos::make_view<matrix_values_type>(
616 Kokkos::ViewAllocateWithoutInitializing(
"matrix"),
cijk, fem_graph_length, stoch_length_aligned);
617 block_matrix_type matrix(
618 "block_matrix", fem_length, matrix_values, matrix_graph);
619 matrix.dev_config = dev_config;
621 typename matrix_values_type::HostMirror hM =
624 typename matrix_values_type::HostMirror::array_type haM = hM ;
626 for (
ordinal_type iRowFEM=0, iEntryFEM=0; iRowFEM<fem_length; ++iRowFEM) {
627 const ordinal_type row_size = fem_graph[iRowFEM].size();
628 for (
ordinal_type iRowEntryFEM=0; iRowEntryFEM<row_size;
629 ++iRowEntryFEM, ++iEntryFEM) {
630 const ordinal_type iColFEM = fem_graph[iRowFEM][iRowEntryFEM];
634 generate_matrix_coefficient<scalar_type>(
635 fem_length, stoch_length, iRowFEM, iColFEM, k);
645 multiply_op( matrix,
x,
y );
650 typedef typename block_vector_type::array_type array_type;
651 array_type ay_expected =
652 array_type(
"ay_expected", stoch_length_aligned, fem_length);
653 typename array_type::HostMirror hay_expected =
655 typename cijk_type::HostMirror host_cijk =
658 for (
ordinal_type iRowFEM=0, iEntryFEM=0; iRowFEM<fem_length; ++iRowFEM) {
659 const ordinal_type row_size = fem_graph[iRowFEM].size();
660 for (
ordinal_type iRowEntryFEM=0; iRowEntryFEM<row_size;
661 ++iRowEntryFEM, ++iEntryFEM) {
662 const ordinal_type iColFEM = fem_graph[iRowFEM][iRowEntryFEM];
665 const ordinal_type entry_beg = host_cijk.entry_begin(i);
668 for (
ordinal_type entry = entry_beg; entry < entry_end; ++entry) {
672 generate_matrix_coefficient<scalar_type>(
673 fem_length, stoch_length, iRowFEM, iColFEM,
j);
675 generate_matrix_coefficient<scalar_type>(
676 fem_length, stoch_length, iRowFEM, iColFEM, k);
678 generate_vector_coefficient<scalar_type>(
679 fem_length, stoch_length, iColFEM,
j);
681 generate_vector_coefficient<scalar_type>(
682 fem_length, stoch_length, iColFEM, k);
683 tmp += host_cijk.value(entry) * ( a_j * x_k + a_k * x_j );
685 hay_expected(i, iRowFEM) += tmp;
694 typename block_vector_type::array_type ay =
y;
703 Kokkos_CrsMatrix_PCE, Multiply,
Scalar, MultiplyOp )
710 Kokkos::DeviceConfig dev_config;
712 success = test_embedded_pce<Scalar>(
717 template <
typename Matrix,
typename InputVector,
typename OutputVector>
719 const InputVector&
x,
720 OutputVector&
y)
const {
725 template <
typename Tag>
730 template <
typename Matrix,
typename InputVector,
typename OutputVector>
732 const InputVector&
x,
733 OutputVector&
y)
const {
739 Kokkos_CrsMatrix_PCE, MeanMultiplyRank1,
Scalar )
746 Kokkos::DeviceConfig dev_config;
751 typedef typename Scalar::cijk_type cijk_type;
753 typedef Kokkos::LayoutLeft Layout;
754 typedef Kokkos::View< Scalar*, Layout, execution_space > block_vector_type;
755 typedef KokkosSparse::CrsMatrix< Scalar, ordinal_type, execution_space > block_matrix_type;
756 typedef typename block_matrix_type::StaticCrsGraphType matrix_graph_type;
757 typedef typename block_matrix_type::values_type matrix_values_type;
763 const ordinal_type stoch_length_aligned = (stoch_length+align-1) & ~(align-1);
767 std::vector< std::vector<ordinal_type> > fem_graph;
770 block_vector_type
x =
771 Kokkos::make_view<block_vector_type>(
"x",
cijk, fem_length, stoch_length_aligned);
772 block_vector_type
y =
773 Kokkos::make_view<block_vector_type>(
"y",
cijk, fem_length, stoch_length_aligned);
775 block_vector_type y_expected =
776 Kokkos::make_view<block_vector_type>(
"y",
cijk, fem_length, stoch_length_aligned);
780 typename block_vector_type::HostMirror hy_expected =
784 typename block_vector_type::HostMirror::array_type hax = hx ;
785 typename block_vector_type::HostMirror::array_type hay = hy ;
786 typename block_vector_type::HostMirror::array_type hay_expected =
789 for (
ordinal_type iRowFEM=0; iRowFEM<fem_length; ++iRowFEM) {
790 for (
ordinal_type iRowStoch=0; iRowStoch<stoch_length; ++iRowStoch) {
791 hax(iRowStoch,iRowFEM) =
792 generate_vector_coefficient<scalar_type>(
793 fem_length, stoch_length, iRowFEM, iRowStoch );
794 hay(iRowStoch,iRowFEM) = 0.0;
795 hay_expected(iRowStoch,iRowFEM) = 0.0;
804 matrix_graph_type matrix_graph =
805 Kokkos::create_staticcrsgraph<matrix_graph_type>(
806 std::string(
"test crs graph"), fem_graph);
807 matrix_values_type matrix_values =
808 Kokkos::make_view<matrix_values_type>(
809 Kokkos::ViewAllocateWithoutInitializing(
"matrix"),
cijk, fem_graph_length,
ordinal_type(1));
810 block_matrix_type matrix(
811 "block_matrix", fem_length, matrix_values, matrix_graph);
812 matrix.dev_config = dev_config;
814 typename matrix_values_type::HostMirror hM =
816 typename matrix_values_type::HostMirror::array_type haM = hM ;
818 for (
ordinal_type iRowFEM=0, iEntryFEM=0; iRowFEM<fem_length; ++iRowFEM) {
819 const ordinal_type row_size = fem_graph[iRowFEM].size();
820 for (
ordinal_type iRowEntryFEM=0; iRowEntryFEM<row_size;
821 ++iRowEntryFEM, ++iEntryFEM) {
822 const ordinal_type iColFEM = fem_graph[iRowFEM][iRowEntryFEM];
825 generate_matrix_coefficient<scalar_type>(
826 fem_length, 1, iRowFEM, iColFEM, 0);
827 for (
ordinal_type iRowStoch=0; iRowStoch<stoch_length; ++iRowStoch) {
828 hay_expected(iRowStoch,iRowFEM) +=
829 haM(iEntryFEM, 0) * hax(iRowStoch,iColFEM);
883 success =
compareRank1(
y, y_expected, rel_tol, abs_tol, out);
888 Kokkos_CrsMatrix_PCE, MeanMultiplyRank2,
Scalar )
893 typedef typename Scalar::cijk_type cijk_type;
895 typedef Kokkos::LayoutLeft Layout;
896 typedef Kokkos::View< Scalar**, Layout, execution_space > block_vector_type;
897 typedef KokkosSparse::CrsMatrix< Scalar, ordinal_type, execution_space > block_matrix_type;
898 typedef typename block_matrix_type::StaticCrsGraphType matrix_graph_type;
899 typedef typename block_matrix_type::values_type matrix_values_type;
905 Kokkos::DeviceConfig dev_config;
911 const ordinal_type stoch_length_aligned = (stoch_length+align-1) & ~(align-1);
915 std::vector< std::vector<ordinal_type> > fem_graph;
918 block_vector_type
x =
919 Kokkos::make_view<block_vector_type>(
"x",
cijk, fem_length, num_cols, stoch_length_aligned);
920 block_vector_type
y =
921 Kokkos::make_view<block_vector_type>(
"y",
cijk, fem_length, num_cols, stoch_length_aligned);
923 block_vector_type y_expected =
924 Kokkos::make_view<block_vector_type>(
"y_expected",
cijk, fem_length, num_cols, stoch_length_aligned);
928 typename block_vector_type::HostMirror hy_expected =
932 for (
ordinal_type iRowFEM=0; iRowFEM<fem_length; ++iRowFEM) {
933 for (
ordinal_type iRowStoch=0; iRowStoch<stoch_length; ++iRowStoch) {
934 hx(iRowFEM,i).fastAccessCoeff(iRowStoch) =
935 generate_vector_coefficient<scalar_type>(
936 fem_length, stoch_length, iRowFEM, iRowStoch );
937 hy(iRowFEM,i).fastAccessCoeff(iRowStoch) = 0.0;
938 hy_expected(iRowFEM,i).fastAccessCoeff(iRowStoch) = 0.0;
948 matrix_graph_type matrix_graph =
949 Kokkos::create_staticcrsgraph<matrix_graph_type>(
950 std::string(
"test crs graph"), fem_graph);
951 matrix_values_type matrix_values =
952 Kokkos::make_view<matrix_values_type>(
953 Kokkos::ViewAllocateWithoutInitializing(
"matrix"),
cijk, fem_graph_length,
ordinal_type(1));
954 block_matrix_type matrix(
955 "block_matrix", fem_length, matrix_values, matrix_graph);
956 matrix.dev_config = dev_config;
958 typename matrix_values_type::HostMirror hM =
961 typename matrix_values_type::HostMirror::array_type haM = hM ;
963 for (
ordinal_type iRowFEM=0, iEntryFEM=0; iRowFEM<fem_length; ++iRowFEM) {
964 const ordinal_type row_size = fem_graph[iRowFEM].size();
965 for (
ordinal_type iRowEntryFEM=0; iRowEntryFEM<row_size;
966 ++iRowEntryFEM, ++iEntryFEM) {
967 const ordinal_type iColFEM = fem_graph[iRowFEM][iRowEntryFEM];
970 generate_matrix_coefficient<scalar_type>(
971 fem_length, 1, iRowFEM, iColFEM, 0);
973 for (
ordinal_type iRowStoch=0; iRowStoch<stoch_length; ++iRowStoch) {
974 hy_expected(iRowFEM,i).fastAccessCoeff(iRowStoch) +=
975 haM(iEntryFEM, 0) * hx(iColFEM,i).fastAccessCoeff(iRowStoch);
1033 success =
compareRank2(
y, y_expected, rel_tol, abs_tol, out);
1039 #define CRSMATRIX_UQ_PCE_TESTS_MATRIXSCALAR( SCALAR ) \ 1040 TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT( \ 1041 Kokkos_CrsMatrix_PCE, ReplaceValues, SCALAR ) \ 1042 TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT( \ 1043 Kokkos_CrsMatrix_PCE, SumIntoValues, SCALAR ) \ 1044 TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT( \ 1045 Kokkos_CrsMatrix_PCE, SumIntoValuesAtomic, SCALAR ) 1046 #define CRSMATRIX_UQ_PCE_MEAN_MULTIPLY_TESTS( SCALAR ) \ 1047 TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT( \ 1048 Kokkos_CrsMatrix_PCE, MeanMultiplyRank1, SCALAR ) \ 1049 TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT( \ 1050 Kokkos_CrsMatrix_PCE, MeanMultiplyRank2, SCALAR ) 1051 #define CRS_MATRIX_UQ_PCE_MULTIPLY_TESTS_SCALAR_OP( SCALAR, OP ) \ 1052 TEUCHOS_UNIT_TEST_TEMPLATE_2_INSTANT( \ 1053 Kokkos_CrsMatrix_PCE, Multiply, SCALAR, OP ) 1055 #define CRS_MATRIX_UQ_PCE_MULTIPLY_TESTS_SCALAR( SCALAR ) \ 1056 CRS_MATRIX_UQ_PCE_MULTIPLY_TESTS_SCALAR_OP( SCALAR, KokkosMultiply ) 1058 #define CRSMATRIX_UQ_PCE_TESTS_STORAGE( STORAGE ) \ 1059 typedef Sacado::UQ::PCE<STORAGE> UQ_PCE_ ## STORAGE; \ 1060 CRSMATRIX_UQ_PCE_TESTS_MATRIXSCALAR( UQ_PCE_ ## STORAGE ) \ 1061 CRS_MATRIX_UQ_PCE_MULTIPLY_TESTS_SCALAR( UQ_PCE_ ## STORAGE ) \ 1062 CRSMATRIX_UQ_PCE_MEAN_MULTIPLY_TESTS( UQ_PCE_ ## STORAGE ) 1064 #define CRSMATRIX_UQ_PCE_TESTS_ORDINAL_SCALAR_DEVICE( ORDINAL, SCALAR, DEVICE ) \ 1065 typedef Stokhos::DynamicStorage<ORDINAL,SCALAR,DEVICE> DS; \ 1066 CRSMATRIX_UQ_PCE_TESTS_STORAGE( DS ) 1068 #define CRSMATRIX_UQ_PCE_TESTS_DEVICE( DEVICE ) \ 1069 CRSMATRIX_UQ_PCE_TESTS_ORDINAL_SCALAR_DEVICE( int, double, DEVICE )
MatrixType::execution_space execution_space
Stokhos::StandardStorage< int, double > storage_type
MatrixType::size_type size_type
const MatrixType m_matrix
MatrixType::value_type value_type
bool compareVecs(const VectorType1 &a1, const std::string &a1_name, const VectorType2 &a2, const std::string &a2_name, const ValueType &rel_tol, const ValueType &abs_tol, Teuchos::FancyOStream &out)
Data structure storing a sparse 3-tensor C(i,j,k) in a a compressed format.
void operator()(const Matrix &A, const InputVector &x, OutputVector &y) const
static bool check(const MatrixType matrix, Teuchos::FancyOStream &out)
KOKKOS_INLINE_FUNCTION void operator()(const size_type i) const
Kokkos::DefaultExecutionSpace execution_space
MatrixType::execution_space execution_space
MatrixType::ordinal_type ordinal_type
KOKKOS_INLINE_FUNCTION void operator()(const size_type i) const
static void apply(const MatrixType matrix)
MatrixType buildDiagonalMatrix(typename MatrixType::ordinal_type nrow, typename MatrixType::ordinal_type pce_size, const CijkType &cijk)
bool compareRank2(const vector_type &y, const vector_type &y_exp, const scalar_type rel_tol, const scalar_type abs_tol, Teuchos::FancyOStream &out)
IntType map_fem_graph_coord(const IntType &N, const IntType &i, const IntType &j, const IntType &k)
TEUCHOS_UNIT_TEST_TEMPLATE_1_DECL(Kokkos_CrsMatrix_PCE, ReplaceValues, MatrixScalar)
Kokkos_MV_Multiply_Op KokkosMultiply
MatrixType::value_type value_type
MatrixType::ordinal_type ordinal_type
ReplaceDiagonalValuesKernel(const MatrixType matrix)
MatrixType::size_type size_type
void multiply(const CrsMatrix< MatrixValue, Device, Layout > &A, const InputMultiVectorType &x, OutputMultiVectorType &y, const std::vector< OrdinalType > &col_indices, SingleColumnMultivectorMultiply)
scalar generate_vector_coefficient(const ordinal nFEM, const ordinal nStoch, const ordinal iColFEM, const ordinal iStoch)
scalar generate_matrix_coefficient(const ordinal nFEM, const ordinal nStoch, const ordinal iRowFEM, const ordinal iColFEM, const ordinal iStoch)
static bool check(const MatrixType matrix, Teuchos::FancyOStream &out)
AddDiagonalValuesAtomicKernel(const MatrixType matrix)
const IndexType const IndexType const IndexType const IndexType const ValueType const ValueType * x
MatrixType::execution_space execution_space
static void apply(const MatrixType matrix)
MatrixType::size_type size_type
static bool check(const MatrixType matrix, Teuchos::FancyOStream &out)
KOKKOS_INLINE_FUNCTION void operator()(const size_type i) const
KOKKOS_INLINE_FUNCTION constexpr std::enable_if< is_view_uq_pce< View< T, P... > >::value, unsigned >::type dimension_scalar(const View< T, P... > &view)
Stokhos_MV_Multiply_Op(const Tag &tg=Tag())
bool compare_rank_2_views(const array_type &y, const array_type &y_exp, const scalar_type rel_tol, const scalar_type abs_tol, Teuchos::FancyOStream &out)
bool test_embedded_pce(const typename PCEType::ordinal_type nGrid, const typename PCEType::ordinal_type stoch_dim, const typename PCEType::ordinal_type poly_ord, Kokkos::DeviceConfig dev_config, Multiply multiply_op, Teuchos::FancyOStream &out)
void deep_copy(const Stokhos::CrsMatrix< ValueType, DstDevice, Layout > &dst, const Stokhos::CrsMatrix< ValueType, SrcDevice, Layout > &src)
KOKKOS_INLINE_FUNCTION PCE< Storage > abs(const PCE< Storage > &a)
Multivariate orthogonal polynomial basis generated from a total-order complete-polynomial tensor prod...
kokkos_cijk_type build_cijk(ordinal_type stoch_dim, ordinal_type poly_ord)
KOKKOS_INLINE_FUNCTION constexpr std::enable_if< is_view_uq_pce< view_type >::value, typename CijkType< view_type >::type >::type cijk(const view_type &view)
Legendre polynomial basis.
TEUCHOS_UNIT_TEST_TEMPLATE_2_DECL(Kokkos_CrsMatrix_PCE, Multiply, Scalar, MultiplyOp)
const MatrixType m_matrix
Abstract base class for 1-D orthogonal polynomials.
AddDiagonalValuesKernel(const MatrixType matrix)
ordinal generate_fem_graph(ordinal N, std::vector< std::vector< ordinal > > &graph)
MatrixType::ordinal_type ordinal_type
const MatrixType m_matrix
bool compareRank1(const vector_type &y, const vector_type &y_exp, const scalar_type rel_tol, const scalar_type abs_tol, Teuchos::FancyOStream &out)
static void apply(const MatrixType matrix)
MatrixType::value_type value_type
const IndexType const IndexType const IndexType const IndexType const ValueType const ValueType ValueType * y
std::enable_if< Kokkos::is_view_uq_pce< Kokkos::View< InputType, InputP... > >::value &&Kokkos::is_view_uq_pce< Kokkos::View< OutputType, OutputP... > >::value >::type spmv(const char mode[], const AlphaType &a, const MatrixType &A, const Kokkos::View< InputType, InputP... > &x, const BetaType &b, const Kokkos::View< OutputType, OutputP... > &y, const RANK_ONE)
Stokhos::CrsMatrix< ValueType, Device, Layout >::HostMirror create_mirror_view(const Stokhos::CrsMatrix< ValueType, Device, Layout > &A)
void operator()(const Matrix &A, const InputVector &x, OutputVector &y) const