Skip to content

Commit

Permalink
Merge pull request #1147 from uhetmaniuk/1146-fix-values-size
Browse files Browse the repository at this point in the history
Fix values dimension for block sparse matrices
  • Loading branch information
lucbv authored Oct 25, 2021
2 parents 7f72a92 + 57c02d6 commit 533517b
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 18 deletions.
20 changes: 11 additions & 9 deletions src/sparse/KokkosSparse_BlockCrsMatrix.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -510,12 +510,17 @@ class BlockCrsMatrix {

/// \brief Construct with a graph that will be shared.
///
/// \param[in] arg_label The sparse matrix's label.
/// \param[in] arg_graph The graph between the blocks.
/// \param[in] blockDimIn The block size.
///
/// Allocate the values array for subsequent fill.
BlockCrsMatrix(const std::string& arg_label,
const staticcrsgraph_type& arg_graph,
const OrdinalType& blockDimIn)
: graph(arg_graph),
values(arg_label, arg_graph.entries.extent(0)),
values(arg_label,
arg_graph.entries.extent(0) * blockDimIn * blockDimIn),
numCols_(maximum_entry(arg_graph) + 1),
blockDim_(blockDimIn) {}

Expand Down Expand Up @@ -600,14 +605,11 @@ class BlockCrsMatrix {
/// The matrix will store and use the row map, indices, and values
/// directly (by view, not by deep copy).
///
/// \param label [in] The sparse matrix's label.
/// \param nrows [in] The number of rows.
/// \param ncols [in] The number of columns.
/// \param annz [in] The number of entries.
/// \param vals [in/out] The entries.
/// \param rows [in/out] The row map (containing the offsets to the
/// data in each row).
/// \param cols [in/out] The column indices.
/// \param[in] label The sparse matrix's label.
/// \param[in] ncols The number of columns.
/// \param[in] vals The entries.
/// \param[in] graph_ The graph between the blocks.
/// \param[in] blockDimIn The block size.
BlockCrsMatrix(const std::string& /*label*/, const OrdinalType& ncols,
const values_type& vals, const staticcrsgraph_type& graph_,
const OrdinalType& blockDimIn)
Expand Down
20 changes: 11 additions & 9 deletions src/sparse/KokkosSparse_BsrMatrix.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -443,11 +443,16 @@ class BsrMatrix {

/// \brief Construct with a graph that will be shared.
///
/// \param[in] arg_label The sparse matrix's label.
/// \param[in] arg_graph The graph between the blocks.
/// \param[in] blockDimIn The block size.
///
/// Allocate the values array for subsequent fill.
BsrMatrix(const std::string& arg_label, const staticcrsgraph_type& arg_graph,
const OrdinalType& blockDimIn)
: graph(arg_graph),
values(arg_label, arg_graph.entries.extent(0)),
values(arg_label,
arg_graph.entries.extent(0) * blockDimIn * blockDimIn),
numCols_(maximum_entry(arg_graph) + 1),
blockDim_(blockDimIn) {}

Expand Down Expand Up @@ -625,14 +630,11 @@ class BsrMatrix {
/// The matrix will store and use the row map, indices, and values
/// directly (by view, not by deep copy).
///
/// \param label [in] The sparse matrix's label.
/// \param nrows [in] The number of rows.
/// \param ncols [in] The number of columns.
/// \param annz [in] The number of entries.
/// \param vals [in/out] The entries.
/// \param rows [in/out] The row map (containing the offsets to the
/// data in each row).
/// \param cols [in/out] The column indices.
/// \param[in] label The sparse matrix's label.
/// \param[in] ncols The number of columns.
/// \param[in] vals The entries.
/// \param[in] graph_ The graph between the blocks.
/// \param[in] blockDimIn The block size.
BsrMatrix(const std::string& /*label*/, const OrdinalType& ncols,
const values_type& vals, const staticcrsgraph_type& graph_,
const OrdinalType& blockDimIn)
Expand Down

0 comments on commit 533517b

Please sign in to comment.