Skip to content
Snippets Groups Projects
Commit c91c3078 authored by Dmitri Naumov's avatar Dmitri Naumov
Browse files

New add() function for global matrices using RowColumnIndices.

parent 8bc555bc
No related branches found
No related tags found
No related merge requests found
...@@ -20,6 +20,8 @@ ...@@ -20,6 +20,8 @@
#include "DenseMatrix.h" #include "DenseMatrix.h"
#include "DenseVector.h" #include "DenseVector.h"
#include "MathLib/LinAlg/RowColumnIndices.h"
namespace MathLib namespace MathLib
{ {
...@@ -80,6 +82,14 @@ public: ...@@ -80,6 +82,14 @@ public:
this->add(row_pos, row_pos, sub_matrix, fkt); this->add(row_pos, row_pos, sub_matrix, fkt);
} }
template<class T_DENSE_MATRIX>
void add(RowColumnIndices<IDX_TYPE> const& indices,
const T_DENSE_MATRIX &sub_matrix,
FP_TYPE fkt = static_cast<FP_TYPE>(1.0))
{
this->add(indices.rows, indices.columns, sub_matrix, fkt);
}
template<class T_DENSE_MATRIX> template<class T_DENSE_MATRIX>
void add(std::vector<IDX_TYPE> const& row_pos, void add(std::vector<IDX_TYPE> const& row_pos,
std::vector<IDX_TYPE> const& col_pos, const T_DENSE_MATRIX &sub_matrix, std::vector<IDX_TYPE> const& col_pos, const T_DENSE_MATRIX &sub_matrix,
......
...@@ -19,6 +19,8 @@ ...@@ -19,6 +19,8 @@
#include <cmath> #include <cmath>
#include <vector> #include <vector>
#include "MathLib/LinAlg/RowColumnIndices.h"
#include "lis.h" #include "lis.h"
#include "LisOption.h" #include "LisOption.h"
...@@ -92,6 +94,15 @@ public: ...@@ -92,6 +94,15 @@ public:
this->add(row_pos, row_pos, sub_matrix, fkt); this->add(row_pos, row_pos, sub_matrix, fkt);
} }
/// Add sub-matrix at positions given by \c indices.
template<class T_DENSE_MATRIX>
void add(RowColumnIndices<std::size_t> const& indices,
const T_DENSE_MATRIX &sub_matrix,
double fkt = 1.0)
{
this->add(indices.rows, indices.columns, sub_matrix, fkt);
}
/// ///
template <class T_DENSE_MATRIX> template <class T_DENSE_MATRIX>
void add(std::vector<std::size_t> const& row_pos, void add(std::vector<std::size_t> const& row_pos,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment