42 #include "Teuchos_UnitTestHelpers.hpp" 46 #include "KokkosSparse_CrsMatrix.hpp" 47 #include "KokkosSparse_spmv.hpp" 55 #include "Kokkos_Core.hpp" 58 template<
typename IntType >
65 return k + N * (
j + N * i );
68 template <
typename ordinal >
71 std::vector< std::vector<ordinal> >& graph )
73 graph.resize( N * N * N, std::vector<ordinal>() );
77 for (
int i = 0; i < (
int) N; ++i ) {
78 for (
int j = 0;
j < (
int) N; ++
j ) {
79 for (
int k = 0; k < (
int) N; ++k ) {
83 graph[row].reserve(27);
85 for (
int ii = -1; ii < 2; ++ii ) {
86 for (
int jj = -1; jj < 2; ++jj ) {
87 for (
int kk = -1; kk < 2; ++kk ) {
88 if ( 0 <= i + ii && i + ii < (
int) N &&
89 0 <=
j + jj &&
j + jj < (
int) N &&
90 0 <= k + kk && k + kk < (
int) N ) {
93 graph[row].push_back(col);
96 total += graph[row].size();
102 template <
typename scalar,
typename ordinal>
105 const ordinal nStoch,
106 const ordinal iRowFEM,
107 const ordinal iColFEM,
108 const ordinal iStoch )
110 const scalar A_fem = ( 10.0 + scalar(iRowFEM) / scalar(nFEM) ) +
111 ( 5.0 + scalar(iColFEM) / scalar(nFEM) );
113 const scalar A_stoch = ( 1.0 + scalar(iStoch) / scalar(nStoch) );
115 return A_fem + A_stoch;
119 template <
typename scalar,
typename ordinal>
122 const ordinal nStoch,
123 const ordinal iColFEM,
124 const ordinal iStoch )
126 const scalar X_fem = 100.0 + scalar(iColFEM) / scalar(nFEM);
127 const scalar X_stoch = 1.0 + scalar(iStoch) / scalar(nStoch);
128 return X_fem + X_stoch;
132 template <
typename kokkos_cijk_type,
typename ordinal_type>
138 using Teuchos::Array;
148 Array< RCP<const one_d_basis> > bases(
stoch_dim);
150 bases[i] = rcp(
new legendre_basis(
poly_ord,
true));
151 RCP<const product_basis> basis = rcp(
new product_basis(bases));
154 RCP<Cijk>
cijk = basis->computeTripleProductTensor();
157 kokkos_cijk_type kokkos_cijk =
158 Stokhos::create_product_tensor<execution_space>(*basis, *
cijk);
164 template <
typename Scalar>
struct ScalarTol {};
165 template <>
struct ScalarTol<float> {
static float tol() {
return 1e-4; } };
169 template <
typename array_type,
typename scalar_type>
171 const array_type& y_exp,
174 Teuchos::FancyOStream& out)
176 typedef typename array_type::size_type size_type;
182 size_type num_rows =
y.extent(0);
183 size_type num_cols =
y.extent(1);
185 for (size_type i=0; i<num_rows; ++i) {
186 for (size_type
j=0;
j<num_cols; ++
j) {
190 out <<
"y_expected(" << i <<
"," <<
j <<
") - " 191 <<
"y(" << i <<
"," <<
j <<
") = " << hy_exp(i,
j)
192 <<
" - " << hy(i,
j) <<
" == " 193 << diff <<
" < " << tol <<
" : ";
199 success = success && s;
206 template <
typename vector_type,
typename scalar_type>
208 const vector_type& y_exp,
211 Teuchos::FancyOStream& out)
213 typedef typename vector_type::size_type size_type;
219 size_type num_rows =
y.extent(0);
221 for (size_type i=0; i<num_rows; ++i) {
226 out <<
"y_expected(" << i <<
").coeff(" <<
j <<
") - " 227 <<
"y(" << i <<
").coeff(" <<
j <<
") = " << hy_exp(i).fastAccessCoeff(
j)
228 <<
" - " << hy(i).fastAccessCoeff(
j) <<
" == " 229 << diff <<
" < " << tol <<
" : ";
235 success = success && s;
241 template <
typename vector_type,
typename scalar_type>
243 const vector_type& y_exp,
246 Teuchos::FancyOStream& out)
248 typedef typename vector_type::size_type size_type;
254 size_type num_rows =
y.extent(0);
255 size_type num_cols =
y.extent(1);
258 for (size_type col = 0; col < num_cols; ++col){
259 for (size_type i=0; i<num_rows; ++i) {
264 out <<
"y_expected(" << i <<
").coeff(" <<
j <<
") - " 265 <<
"y(" << i <<
").coeff(" <<
j <<
") = " << hy_exp(i,col).fastAccessCoeff(
j)
266 <<
" - " << hy(i,col).fastAccessCoeff(
j) <<
" == " 267 << diff <<
" < " << tol <<
" : ";
273 success = success && s;
284 template <
typename MatrixType,
typename CijkType>
288 const CijkType&
cijk) {
290 typedef typename MatrixType::StaticCrsGraphType matrix_graph_type;
291 typedef typename MatrixType::values_type matrix_values_type;
293 std::vector< std::vector<ordinal_type> > graph(nrow);
295 graph[i] = std::vector<ordinal_type>(1, i);
298 matrix_graph_type matrix_graph =
299 Kokkos::create_staticcrsgraph<matrix_graph_type>(
"graph", graph);
300 matrix_values_type matrix_values =
301 Kokkos::make_view<matrix_values_type>(
"values",
cijk, graph_length, pce_size);
303 MatrixType matrix(
"matrix", nrow, matrix_values, matrix_graph);
312 template <
typename MatrixType>
323 KOKKOS_INLINE_FUNCTION
328 m_matrix.replaceValues(row, &col, 1, &
val,
false,
true);
332 static void apply(
const MatrixType matrix) {
338 static bool check(
const MatrixType matrix,
339 Teuchos::FancyOStream& out) {
340 typedef typename MatrixType::values_type matrix_values_type;
341 typename matrix_values_type::HostMirror host_matrix_values =
351 "matrix_values(row)",
355 success = success && s;
362 template <
typename MatrixType>
373 KOKKOS_INLINE_FUNCTION
378 m_matrix.sumIntoValues(row, &col, 1, &
val,
false,
true);
382 static void apply(
const MatrixType matrix) {
388 static bool check(
const MatrixType matrix,
389 Teuchos::FancyOStream& out) {
390 typedef typename MatrixType::values_type matrix_values_type;
391 typename matrix_values_type::HostMirror host_matrix_values =
401 "matrix_values(row)",
405 success = success && s;
413 template <
typename MatrixType>
424 KOKKOS_INLINE_FUNCTION
429 m_matrix.sumIntoValues(row, &col, 1, &
val,
false,
true);
433 static void apply(
const MatrixType matrix) {
439 static bool check(
const MatrixType matrix,
440 Teuchos::FancyOStream& out) {
441 typedef typename MatrixType::values_type matrix_values_type;
442 typename matrix_values_type::HostMirror host_matrix_values =
452 val_expected = nrow*(nrow-1)/2;
456 "matrix_values(row)",
460 success = success && s;
467 Kokkos_CrsMatrix_PCE, ReplaceValues, MatrixScalar )
471 typedef typename MatrixScalar::cijk_type Cijk;
472 typedef KokkosSparse::CrsMatrix<MatrixScalar,Ordinal,Device> Matrix;
482 Matrix matrix = buildDiagonalMatrix<Matrix>(nrow, pce_size,
cijk);
486 kernel::apply(matrix);
489 success = kernel::check(matrix, out);
493 Kokkos_CrsMatrix_PCE, SumIntoValues, MatrixScalar )
497 typedef typename MatrixScalar::cijk_type Cijk;
498 typedef KokkosSparse::CrsMatrix<MatrixScalar,Ordinal,Device> Matrix;
508 Matrix matrix = buildDiagonalMatrix<Matrix>(nrow, pce_size,
cijk);
512 kernel::apply(matrix);
515 success = kernel::check(matrix, out);
519 Kokkos_CrsMatrix_PCE, SumIntoValuesAtomic, MatrixScalar )
523 typedef typename MatrixScalar::cijk_type Cijk;
524 typedef KokkosSparse::CrsMatrix<MatrixScalar,Ordinal,Device> Matrix;
534 Matrix matrix = buildDiagonalMatrix<Matrix>(nrow, pce_size,
cijk);
538 kernel::apply(matrix);
541 success = kernel::check(matrix, out);
544 template <
typename PCEType,
typename Multiply>
548 KokkosSparse::DeviceConfig dev_config,
549 Multiply multiply_op,
550 Teuchos::FancyOStream& out)
555 typedef typename PCEType::cijk_type cijk_type;
557 typedef Kokkos::LayoutLeft Layout;
558 typedef Kokkos::View< PCEType*, Layout, execution_space > block_vector_type;
559 typedef KokkosSparse::CrsMatrix< PCEType, ordinal_type, execution_space > block_matrix_type;
560 typedef typename block_matrix_type::StaticCrsGraphType matrix_graph_type;
561 typedef typename block_matrix_type::values_type matrix_values_type;
571 TEUCHOS_TEST_FOR_EXCEPTION(
572 storage_type::is_static && storage_type::static_size != stoch_length,
574 "Static storage size must equal pce size");
578 std::vector< std::vector<ordinal_type> > fem_graph;
585 block_vector_type
x =
586 Kokkos::make_view<block_vector_type>(
"x",
cijk, fem_length, stoch_length_aligned);
587 block_vector_type
y =
588 Kokkos::make_view<block_vector_type>(
"y",
cijk, fem_length, stoch_length_aligned);
594 typename block_vector_type::HostMirror::array_type hax = hx ;
595 typename block_vector_type::HostMirror::array_type hay = hy ;
597 for (
ordinal_type iRowFEM=0; iRowFEM<fem_length; ++iRowFEM) {
598 for (
ordinal_type iRowStoch=0; iRowStoch<stoch_length; ++iRowStoch) {
599 hax(iRowStoch, iRowFEM) =
600 generate_vector_coefficient<scalar_type>(
601 fem_length, stoch_length, iRowFEM, iRowStoch );
602 hay(iRowStoch, iRowFEM) = 0.0;
612 matrix_graph_type matrix_graph =
613 Kokkos::create_staticcrsgraph<matrix_graph_type>(
614 std::string(
"test crs graph"), fem_graph);
615 matrix_values_type matrix_values =
616 Kokkos::make_view<matrix_values_type>(
617 Kokkos::ViewAllocateWithoutInitializing(
"matrix"),
cijk, fem_graph_length, stoch_length_aligned);
618 block_matrix_type matrix(
619 "block_matrix", fem_length, matrix_values, matrix_graph);
620 matrix.dev_config = dev_config;
622 typename matrix_values_type::HostMirror hM =
625 typename matrix_values_type::HostMirror::array_type haM = hM ;
627 for (
ordinal_type iRowFEM=0, iEntryFEM=0; iRowFEM<fem_length; ++iRowFEM) {
628 const ordinal_type row_size = fem_graph[iRowFEM].size();
629 for (
ordinal_type iRowEntryFEM=0; iRowEntryFEM<row_size;
630 ++iRowEntryFEM, ++iEntryFEM) {
631 const ordinal_type iColFEM = fem_graph[iRowFEM][iRowEntryFEM];
635 generate_matrix_coefficient<scalar_type>(
636 fem_length, stoch_length, iRowFEM, iColFEM, k);
646 multiply_op( matrix,
x,
y );
651 typedef typename block_vector_type::array_type array_type;
652 array_type ay_expected =
653 array_type(
"ay_expected", stoch_length_aligned, fem_length);
654 typename array_type::HostMirror hay_expected =
656 typename cijk_type::HostMirror host_cijk =
659 for (
ordinal_type iRowFEM=0, iEntryFEM=0; iRowFEM<fem_length; ++iRowFEM) {
660 const ordinal_type row_size = fem_graph[iRowFEM].size();
661 for (
ordinal_type iRowEntryFEM=0; iRowEntryFEM<row_size;
662 ++iRowEntryFEM, ++iEntryFEM) {
663 const ordinal_type iColFEM = fem_graph[iRowFEM][iRowEntryFEM];
666 const ordinal_type entry_beg = host_cijk.entry_begin(i);
669 for (
ordinal_type entry = entry_beg; entry < entry_end; ++entry) {
673 generate_matrix_coefficient<scalar_type>(
674 fem_length, stoch_length, iRowFEM, iColFEM,
j);
676 generate_matrix_coefficient<scalar_type>(
677 fem_length, stoch_length, iRowFEM, iColFEM, k);
679 generate_vector_coefficient<scalar_type>(
680 fem_length, stoch_length, iColFEM,
j);
682 generate_vector_coefficient<scalar_type>(
683 fem_length, stoch_length, iColFEM, k);
684 tmp += host_cijk.value(entry) * ( a_j * x_k + a_k * x_j );
686 hay_expected(i, iRowFEM) += tmp;
695 typename block_vector_type::array_type ay =
y;
704 Kokkos_CrsMatrix_PCE, Multiply,
Scalar, MultiplyOp )
711 KokkosSparse::DeviceConfig dev_config;
713 success = test_embedded_pce<Scalar>(
718 template <
typename Matrix,
typename InputVector,
typename OutputVector>
720 const InputVector&
x,
721 OutputVector&
y)
const {
726 template <
typename Tag>
731 template <
typename Matrix,
typename InputVector,
typename OutputVector>
733 const InputVector&
x,
734 OutputVector&
y)
const {
740 Kokkos_CrsMatrix_PCE, MeanMultiplyRank1,
Scalar )
747 KokkosSparse::DeviceConfig dev_config;
752 typedef typename Scalar::cijk_type cijk_type;
754 typedef Kokkos::LayoutLeft Layout;
755 typedef Kokkos::View< Scalar*, Layout, execution_space > block_vector_type;
756 typedef KokkosSparse::CrsMatrix< Scalar, ordinal_type, execution_space > block_matrix_type;
757 typedef typename block_matrix_type::StaticCrsGraphType matrix_graph_type;
758 typedef typename block_matrix_type::values_type matrix_values_type;
762 cijk_type mean_cijk =
763 Stokhos::create_mean_based_product_tensor<execution_space, ordinal_type, scalar_type>();
766 const ordinal_type stoch_length_aligned = (stoch_length+align-1) & ~(align-1);
770 std::vector< std::vector<ordinal_type> > fem_graph;
773 block_vector_type
x =
774 Kokkos::make_view<block_vector_type>(
"x",
cijk, fem_length, stoch_length_aligned);
775 block_vector_type
y =
776 Kokkos::make_view<block_vector_type>(
"y",
cijk, fem_length, stoch_length_aligned);
778 block_vector_type y_expected =
779 Kokkos::make_view<block_vector_type>(
"y",
cijk, fem_length, stoch_length_aligned);
783 typename block_vector_type::HostMirror hy_expected =
787 typename block_vector_type::HostMirror::array_type hax = hx ;
788 typename block_vector_type::HostMirror::array_type hay = hy ;
789 typename block_vector_type::HostMirror::array_type hay_expected =
792 for (
ordinal_type iRowFEM=0; iRowFEM<fem_length; ++iRowFEM) {
793 for (
ordinal_type iRowStoch=0; iRowStoch<stoch_length; ++iRowStoch) {
794 hax(iRowStoch,iRowFEM) =
795 generate_vector_coefficient<scalar_type>(
796 fem_length, stoch_length, iRowFEM, iRowStoch );
797 hay(iRowStoch,iRowFEM) = 0.0;
798 hay_expected(iRowStoch,iRowFEM) = 0.0;
807 matrix_graph_type matrix_graph =
808 Kokkos::create_staticcrsgraph<matrix_graph_type>(
809 std::string(
"test crs graph"), fem_graph);
810 matrix_values_type matrix_values =
811 Kokkos::make_view<matrix_values_type>(
812 Kokkos::ViewAllocateWithoutInitializing(
"matrix"), mean_cijk, fem_graph_length,
ordinal_type(1));
813 block_matrix_type matrix(
814 "block_matrix", fem_length, matrix_values, matrix_graph);
815 matrix.dev_config = dev_config;
817 typename matrix_values_type::HostMirror hM =
819 typename matrix_values_type::HostMirror::array_type haM = hM ;
821 for (
ordinal_type iRowFEM=0, iEntryFEM=0; iRowFEM<fem_length; ++iRowFEM) {
822 const ordinal_type row_size = fem_graph[iRowFEM].size();
823 for (
ordinal_type iRowEntryFEM=0; iRowEntryFEM<row_size;
824 ++iRowEntryFEM, ++iEntryFEM) {
825 const ordinal_type iColFEM = fem_graph[iRowFEM][iRowEntryFEM];
828 generate_matrix_coefficient<scalar_type>(
829 fem_length, 1, iRowFEM, iColFEM, 0);
830 for (
ordinal_type iRowStoch=0; iRowStoch<stoch_length; ++iRowStoch) {
831 hay_expected(iRowStoch,iRowFEM) +=
832 haM(iEntryFEM, 0) * hax(iRowStoch,iColFEM);
886 success =
compareRank1(
y, y_expected, rel_tol, abs_tol, out);
891 Kokkos_CrsMatrix_PCE, MeanMultiplyRank2,
Scalar )
896 typedef typename Scalar::cijk_type cijk_type;
898 typedef Kokkos::LayoutLeft Layout;
899 typedef Kokkos::View< Scalar**, Layout, execution_space > block_vector_type;
900 typedef KokkosSparse::CrsMatrix< Scalar, ordinal_type, execution_space > block_matrix_type;
901 typedef typename block_matrix_type::StaticCrsGraphType matrix_graph_type;
902 typedef typename block_matrix_type::values_type matrix_values_type;
908 KokkosSparse::DeviceConfig dev_config;
912 cijk_type mean_cijk =
913 Stokhos::create_mean_based_product_tensor<execution_space, ordinal_type, scalar_type>();
916 const ordinal_type stoch_length_aligned = (stoch_length+align-1) & ~(align-1);
920 std::vector< std::vector<ordinal_type> > fem_graph;
923 block_vector_type
x =
924 Kokkos::make_view<block_vector_type>(
"x",
cijk, fem_length, num_cols, stoch_length_aligned);
925 block_vector_type
y =
926 Kokkos::make_view<block_vector_type>(
"y",
cijk, fem_length, num_cols, stoch_length_aligned);
928 block_vector_type y_expected =
929 Kokkos::make_view<block_vector_type>(
"y_expected",
cijk, fem_length, num_cols, stoch_length_aligned);
933 typename block_vector_type::HostMirror hy_expected =
937 for (
ordinal_type iRowFEM=0; iRowFEM<fem_length; ++iRowFEM) {
938 for (
ordinal_type iRowStoch=0; iRowStoch<stoch_length; ++iRowStoch) {
939 hx(iRowFEM,i).fastAccessCoeff(iRowStoch) =
940 generate_vector_coefficient<scalar_type>(
941 fem_length, stoch_length, iRowFEM, iRowStoch );
942 hy(iRowFEM,i).fastAccessCoeff(iRowStoch) = 0.0;
943 hy_expected(iRowFEM,i).fastAccessCoeff(iRowStoch) = 0.0;
953 matrix_graph_type matrix_graph =
954 Kokkos::create_staticcrsgraph<matrix_graph_type>(
955 std::string(
"test crs graph"), fem_graph);
956 matrix_values_type matrix_values =
957 Kokkos::make_view<matrix_values_type>(
958 Kokkos::ViewAllocateWithoutInitializing(
"matrix"), mean_cijk, fem_graph_length,
ordinal_type(1));
959 block_matrix_type matrix(
960 "block_matrix", fem_length, matrix_values, matrix_graph);
961 matrix.dev_config = dev_config;
963 typename matrix_values_type::HostMirror hM =
966 typename matrix_values_type::HostMirror::array_type haM = hM ;
968 for (
ordinal_type iRowFEM=0, iEntryFEM=0; iRowFEM<fem_length; ++iRowFEM) {
969 const ordinal_type row_size = fem_graph[iRowFEM].size();
970 for (
ordinal_type iRowEntryFEM=0; iRowEntryFEM<row_size;
971 ++iRowEntryFEM, ++iEntryFEM) {
972 const ordinal_type iColFEM = fem_graph[iRowFEM][iRowEntryFEM];
975 generate_matrix_coefficient<scalar_type>(
976 fem_length, 1, iRowFEM, iColFEM, 0);
978 for (
ordinal_type iRowStoch=0; iRowStoch<stoch_length; ++iRowStoch) {
979 hy_expected(iRowFEM,i).fastAccessCoeff(iRowStoch) +=
980 haM(iEntryFEM, 0) * hx(iColFEM,i).fastAccessCoeff(iRowStoch);
1038 success =
compareRank2(
y, y_expected, rel_tol, abs_tol, out);
1044 #define CRSMATRIX_UQ_PCE_TESTS_MATRIXSCALAR( SCALAR ) \ 1045 TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT( \ 1046 Kokkos_CrsMatrix_PCE, ReplaceValues, SCALAR ) \ 1047 TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT( \ 1048 Kokkos_CrsMatrix_PCE, SumIntoValues, SCALAR ) \ 1049 TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT( \ 1050 Kokkos_CrsMatrix_PCE, SumIntoValuesAtomic, SCALAR ) 1051 #define CRSMATRIX_UQ_PCE_MEAN_MULTIPLY_TESTS( SCALAR ) \ 1052 TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT( \ 1053 Kokkos_CrsMatrix_PCE, MeanMultiplyRank1, SCALAR ) \ 1054 TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT( \ 1055 Kokkos_CrsMatrix_PCE, MeanMultiplyRank2, SCALAR ) 1056 #define CRS_MATRIX_UQ_PCE_MULTIPLY_TESTS_SCALAR_OP( SCALAR, OP ) \ 1057 TEUCHOS_UNIT_TEST_TEMPLATE_2_INSTANT( \ 1058 Kokkos_CrsMatrix_PCE, Multiply, SCALAR, OP ) 1060 #define CRS_MATRIX_UQ_PCE_MULTIPLY_TESTS_SCALAR( SCALAR ) \ 1061 CRS_MATRIX_UQ_PCE_MULTIPLY_TESTS_SCALAR_OP( SCALAR, KokkosMultiply ) 1063 #define CRSMATRIX_UQ_PCE_TESTS_STORAGE( STORAGE ) \ 1064 typedef Sacado::UQ::PCE<STORAGE> UQ_PCE_ ## STORAGE; \ 1065 CRSMATRIX_UQ_PCE_TESTS_MATRIXSCALAR( UQ_PCE_ ## STORAGE ) \ 1066 CRS_MATRIX_UQ_PCE_MULTIPLY_TESTS_SCALAR( UQ_PCE_ ## STORAGE ) \ 1067 CRSMATRIX_UQ_PCE_MEAN_MULTIPLY_TESTS( UQ_PCE_ ## STORAGE ) 1069 #define CRSMATRIX_UQ_PCE_TESTS_ORDINAL_SCALAR_DEVICE( ORDINAL, SCALAR, DEVICE ) \ 1070 typedef Stokhos::DynamicStorage<ORDINAL,SCALAR,DEVICE> DS; \ 1071 CRSMATRIX_UQ_PCE_TESTS_STORAGE( DS ) 1073 #define CRSMATRIX_UQ_PCE_TESTS_DEVICE( DEVICE ) \ 1074 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.
bool test_embedded_pce(const typename PCEType::ordinal_type nGrid, const typename PCEType::ordinal_type stoch_dim, const typename PCEType::ordinal_type poly_ord, KokkosSparse::DeviceConfig dev_config, Multiply multiply_op, Teuchos::FancyOStream &out)
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
expr1 expr1 expr1 expr2 expr1 expr1 c expr2 expr1 c fastAccessCoeff(j) - expr2.val(j)
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)
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