29 #ifndef _DENSE_PAR_MAT_H_ 30 #define _DENSE_PAR_MAT_H_ 45 template <
class IU,
class NU,
class DER>
48 template <
class IT,
class NT>
55 commGrid.reset(
new CommGrid(MPI_COMM_WORLD, 0, 0));
57 DenseParMat (NT value, std::shared_ptr<CommGrid> grid, IT rows, IT cols): m(rows), n(cols)
59 array = SpHelper::allocate2D<double>(rows, cols);
60 for(
int i=0; i< rows; ++i)
62 std::fill_n(array[i], cols, value);
66 DenseParMat (NT ** seqarr, std::shared_ptr<CommGrid> grid, IT rows, IT cols): array(seqarr), m(rows), n(cols)
75 array = SpHelper::allocate2D<NT>(m, n);
76 for(
int i=0; i< m; ++i)
78 std::copy(array[i], array[i]+n, rhs.array[i]);
81 commGrid.reset(
new CommGrid(*(rhs.commGrid)));
86 template <
typename DER>
89 template <
typename _BinaryOperation>
103 MPI_Allreduce(&m, &glrows, 1, MPIType<IT>(), MPI_SUM, commGrid->GetColWorld());
110 MPI_Allreduce(&n, &glcols, 1, MPIType<IT>(), MPI_SUM, commGrid->GetRowWorld());
115 std::shared_ptr<CommGrid> commGrid;
119 template <
class IU,
class NU,
class DER>
DenseParMat< IT, NT > & operator+=(const SpParMat< IT, NT, DER > &rhs)
DenseParMat(NT **seqarr, std::shared_ptr< CommGrid > grid, IT rows, IT cols)
std::shared_ptr< CommGrid > getcommgrid()
DenseParMat(const DenseParMat< IT, NT > &rhs)
DenseParMat< IT, NT > & operator=(const DenseParMat< IT, NT > &rhs)
DenseParMat(NT value, std::shared_ptr< CommGrid > grid, IT rows, IT cols)
static void deallocate2D(T **array, I m)
FullyDistVec< IT, NT > Reduce(Dim dim, _BinaryOperation __binary_op, NT identity) const