9#include <kernel/lafem/dense_vector.hpp> 
   10#include <kernel/lafem/dense_vector_blocked.hpp> 
   20      template<
typename DT_, 
typename IT_, 
int size_>
 
   21      struct BlockedVectorHelper
 
   23        static_assert(size_ > 1, 
"invalid block size");
 
   24        typedef DenseVectorBlocked<DT_, IT_, size_> VectorType;
 
   27      template<
typename DT_, 
typename IT_>
 
   28      struct BlockedVectorHelper<DT_, IT_, 1>
 
   30        typedef DenseVector<DT_, IT_> VectorType;
 
   54    template<
typename DT_, 
typename IT_, 
int BlockHeight_ = 1, 
int BlockW
idth_ = 1>
 
   57      static_assert(BlockHeight_ > 0, 
"invalid block size");
 
   58      static_assert(BlockWidth_ > 0, 
"invalid block size");
 
   76      template <
typename DT2_ = DT_, 
typename IT2_ = IT_>
 
   80      template <
typename DataType2_, 
typename IndexType2_>
 
   84      typedef typename Intern::BlockedVectorHelper<DT_, IT_, BlockHeight_>::VectorType 
VectorTypeL;
 
   86      typedef typename Intern::BlockedVectorHelper<DT_, IT_, BlockWidth_>::VectorType 
VectorTypeR;
 
   88      static constexpr bool is_global = 
false;
 
   89      static constexpr bool is_local = 
true;
 
  116        _num_rows(rows_in), _num_cols(columns_in)
 
  141        this->_num_rows = other._num_rows;
 
  142        this->_num_cols = other._num_cols;
 
  168      template<
typename DT2_, 
typename IT2_>
 
  173        this->_num_rows = other.rows();
 
  174        this->_num_cols = other.columns();
 
  184      template <
typename DT2_, 
typename IT2_>
 
  187        this->_num_rows = other.rows();
 
  188        this->_num_cols = other.columns();
 
  197      template <Perspective perspective_ = Perspective::native>
 
  200        Index result(this->_num_rows);
 
  203            result *= 
Index(BlockHeight_);
 
  214      template <Perspective perspective_ = Perspective::native>
 
  217        Index result(this->_num_cols);
 
  220            result *= 
Index(BlockWidth_);
 
  231      template <Perspective perspective_ = Perspective::native>
 
  255        this->_num_rows = rows_in;
 
  256        this->_num_cols = columns_in;
 
  266        return std::size_t(0);
 
  304                const DT_ DOXY(alpha) = DT_(1))
 
  307        XASSERTM(x.
rows() == this->rows(), 
"Matrix rows do not match!");
 
  309        XASSERTM(x.
columns() == this->columns(), 
"Matrix columns do not match!");
 
  324        XASSERTM(x.
rows() == this->rows(), 
"Row count does not match!");
 
  325        XASSERTM(x.
columns() == this->columns(), 
"Column count does not match!");
 
  349        XASSERTM(row_norms.size() == this->rows(), 
"Matrix/Vector dimension mismatch");
 
  362        XASSERTM(row_norms.size() == this->rows(), 
"Matrix/Vector dimension mismatch");
 
  388        XASSERTM(row_norms.size() == this->rows(), 
"Matrix/Vector dimension mismatch");
 
  389        XASSERTM(scal.size() == this->columns(), 
"Matrix/scalings dimension mismatch");
 
  452        XASSERTM(r.
size() == this->rows(), 
"Vector size of r does not match!");
 
  466        XASSERTM(r.
size() == this->columns(), 
"Vector size of r does not match!");
 
  481        XASSERTM(x.
size() == this->columns(), 
"Vector size of x does not match!");
 
  495        XASSERTM(x.
size() == this->rows(), 
"Vector size of x does not match!");
 
  508        XASSERTM(r.
size() == this->rows(), 
"Vector size of r does not match!");
 
  509        XASSERTM(x.
size() == this->columns(), 
"Vector size of x does not match!");
 
  522        XASSERTM(r.
size() == this->columns(), 
"Vector size of r does not match!");
 
  523        XASSERTM(x.
size() == this->rows(), 
"Vector size of x does not match!");
 
  540                 const DT_ DOXY(alpha) = DT_(1))
 const 
  561        const DT_ DOXY(alpha) = DT_(1))
 const 
  582                 const DT_ DOXY(alpha) = DT_(1))
 const 
  584        XASSERTM(r.
size() == this->rows(), 
"Vector size of r does not match!");
 
  586        XASSERTM(y.
size() == this->rows(), 
"Vector size of y does not match!");
 
  602        const DT_ DOXY(alpha) = DT_(1))
 const 
  604        XASSERTM(r.
size() == this->columns(), 
"Vector size of r does not match!");
 
  606        XASSERTM(y.
size() == this->columns(), 
"Vector size of y does not match!");
 
  624                 const DT_ DOXY(alpha) = DT_(1))
 const 
  627        XASSERTM(x.
size() == this->columns(), 
"Vector size of x does not match!");
 
  645        const DT_ DOXY(alpha) = DT_(1))
 const 
  648        XASSERTM(x.
size() == this->rows(), 
"Vector size of x does not match!");
 
  666                 const DT_ DOXY(alpha) = DT_(1))
 const 
  668        XASSERTM(r.
size() == this->rows(), 
"Vector size of r does not match!");
 
  669        XASSERTM(x.
size() == this->columns(), 
"Vector size of x does not match!");
 
  670        XASSERTM(y.
size() == this->rows(), 
"Vector size of y does not match!");
 
  687        const DT_ DOXY(alpha) = DT_(1))
 const 
  689        XASSERTM(r.
size() == this->columns(), 
"Vector size of r does not match!");
 
  690        XASSERTM(x.
size() == this->rows(), 
"Vector size of x does not match!");
 
  691        XASSERTM(y.
size() == this->columns(), 
"Vector size of y does not match!");
 
  708                 const DT_ DOXY(alpha) = DT_(1))
 const 
  710        XASSERTM(r.
size() == this->rows(), 
"Vector size of r does not match!");
 
  711        XASSERTM(x.
size() == this->columns(), 
"Vector size of x does not match!");
 
  729        const DT_ DOXY(alpha) = DT_(1))
 const 
  731        XASSERTM(r.
size() == this->columns(), 
"Vector size of r does not match!");
 
  732        XASSERTM(x.
size() == this->rows(), 
"Vector size of x does not match!");
 
  743        XASSERTM(lump.size() == 
rows(), 
"lump vector size does not match matrix row count!");
 
  767        XASSERTM(diag.size() == 
rows(), 
"diag size does not match matrix row count!");
 
  788      VectorTypeR create_vector_r()
 const 
  800      void set_line(
const Index, DT_ * 
const, IT_ * 
const, 
const Index, 
const Index = 1)
 const 
  805      void set_line_reverse(
const Index, DT_ * 
const, 
const Index = 1)
 
  848        XASSERTM(domain_node < 
rows(), 
"Domain node index out of range");
 
  855        XASSERTM(domain_node < 
rows(), 
"Domain node index out of range");
 
#define XASSERTM(expr, msg)
Assertion macro definition with custom message.
Index size() const
Returns the containers size.
void format(DT_ value=DT_(0))
Reset all elements of the container to a given value or zero if missing.
Blocked Dense data vector class template.
void copy(const DenseVectorBlocked &x, bool full=false)
Performs .
Index size() const
The number of elements.
Dense data vector class template.
void copy(const VT_ &a)
Performs .
Null Matrix implementation.
void apply_transposed(DenseVector< DT_, IT_ > &r, const DenseVector< DT_, IT_ > &x, const DenseVector< DT_, IT_ > &y, const DT_ alpha=DT_(1)) const
Calculate .
Index columns() const
Retrieve matrix column count.
void apply(DenseVectorBlocked< DT_, IT_, BlockHeight_ > &r, const DenseVectorBlocked< DT_, IT_, BlockWidth_ > &x, const DenseVector< DT_, IT_ > &y, const DT_ alpha=DT_(1)) const
Calculate .
VectorTypeL lump_rows() const
Returns the lumped rows vector.
void apply(DenseVector< DT_, IT_ > &r, const DenseVectorBlocked< DT_, IT_, BlockWidth_ > &x, const DenseVector< DT_, IT_ > &y, const DT_ alpha=DT_(1)) const
Calculate .
void copy(const NullMatrix &x, bool full=false)
Performs .
void apply_transposed(DenseVector< DT_, IT_ > &r, const DenseVectorBlocked< DT_, IT_, BlockHeight_ > &x, const DenseVector< DT_, IT_ > &y, const DT_ alpha=DT_(1)) const
Calculate .
static String name()
Returns a descriptive string.
void apply(DenseVector< DT_, IT_ > &r, const DenseVector< DT_, IT_ > &x, const DenseVector< DT_, IT_ > &y, const DT_ alpha=DT_(1)) const
Calculate .
void apply(DenseVectorBlocked< DT_, IT_, BlockHeight_ > &r, const DenseVectorBlocked< DT_, IT_, BlockWidth_ > &x, const DenseVectorBlocked< DT_, IT_, BlockHeight_ > &y, const DT_ alpha=DT_(1)) const
Calculate .
NullMatrix(NullMatrix &&other)
Move Constructor.
void restore_from_checkpoint_data(std::vector< char > &)
Extract object from checkpoint.
void resize(Index rows_in, Index columns_in)
Resizes the matrix to different dimensions.
void apply_transposed(DenseVectorBlocked< DT_, IT_, BlockWidth_ > &r, const DenseVectorBlocked< DT_, IT_, BlockHeight_ > &x, const DenseVector< DT_, IT_ > &y, const DT_ alpha=DT_(1)) const
Calculate .
void row_norm2sqr(VectorTypeL &row_norms, const VectorTypeR &scal) const
Computes the square of the 2-norm for every row, where every row is scaled by a vector.
void apply_transposed(DenseVector< DT_, IT_ > &r, const DenseVector< DT_, IT_ > &x) const
Calculate .
void apply(DenseVectorBlocked< DT_, IT_, BlockHeight_ > &r, const DenseVector< DT_, IT_ > &x) const
Calculate .
void apply_transposed(DenseVectorBlocked< DT_, IT_, BlockWidth_ > &r, const DenseVector< DT_, IT_ > &x, const DenseVectorBlocked< DT_, IT_, BlockWidth_ > &y, const DT_ alpha=DT_(1)) const
Calculate .
void axpy(const NullMatrix &x, const NullMatrix &y, const DT_ alpha=DT_(1))
Calculate .
Tiny::Matrix< DataType, BlockHeight, BlockWidth > ValueType
Value type, meaning the type of each block.
NullMatrix< DT_, IT_, BlockWidth_, BlockHeight_ > transpose() const
Calculate .
const IT_ * ImageIterator
ImageIterator typedef for Adjactor interface implementation.
void apply_transposed(DenseVectorBlocked< DT_, IT_, BlockWidth_ > &r, const DenseVector< DT_, IT_ > &x) const
Calculate .
void apply_transposed(DenseVector< DT_, IT_ > &r, const DenseVectorBlocked< DT_, IT_, BlockHeight_ > &x) const
Calculate .
void apply(DenseVectorBlocked< DT_, IT_, BlockHeight_ > &r, const DenseVector< DT_, IT_ > &x, const DenseVectorBlocked< DT_, IT_, BlockHeight_ > &y, const DT_ alpha=DT_(1)) const
Calculate .
static constexpr int BlockHeight
Our block height.
Intern::BlockedVectorHelper< DT_, IT_, BlockWidth_ >::VectorType VectorTypeR
Compatible R-vector type.
Index get_num_nodes_domain() const
void apply_transposed(DenseVectorBlocked< DT_, IT_, BlockWidth_ > &r, const DenseVectorBlocked< DT_, IT_, BlockHeight_ > &x, const DenseVectorBlocked< DT_, IT_, BlockWidth_ > &y, const DT_ alpha=DT_(1)) const
Calculate .
void apply(DenseVector< DT_, IT_ > &r, const DenseVector< DT_, IT_ > &x) const
Calculate .
Index rows() const
Retrieve matrix row count.
IT_ IndexType
Our indextype.
void apply_transposed(DenseVectorBlocked< DT_, IT_, BlockWidth_ > &r, const DenseVectorBlocked< DT_, IT_, BlockHeight_ > &x) const
Calculate .
void format(const DT_ value=DT_(0))
Reset all elements of the container to a given value or zero if missing.
uint64_t get_checkpoint_size()
Calculate size.
void lump_rows(VectorTypeL &lump) const
void apply(DenseVectorBlocked< DT_, IT_, BlockHeight_ > &r, const DenseVectorBlocked< DT_, IT_, BlockWidth_ > &x) const
Calculate .
void clone(const NullMatrix< DT2_, IT2_, BlockHeight_, BlockWidth_ > &other, CloneMode clone_mode=CloneMode::Weak)
Clone operation.
Intern::BlockedVectorHelper< DT_, IT_, BlockHeight_ >::VectorType VectorTypeL
Compatible L-vector type.
NullMatrix & operator=(NullMatrix &&other)
Move operator.
ImageIterator image_end(Index domain_node) const
VectorTypeL extract_diag() const
extract main diagonal vector from matrix
void set_checkpoint_data(std::vector< char > &)
Index get_num_nodes_image() const
void scale(const NullMatrix &x, const DT_ alpha)
Calculate .
void row_norm2sqr(VectorTypeL &row_norms) const
Computes the square of the 2-norm for every row.
Index used_elements() const
Retrieve non zero element count.
DT_ norm_frobenius() const
Calculates the Frobenius norm of this matrix.
NullMatrix clone(CloneMode clone_mode=CloneMode::Weak) const
Clone operation.
void row_norm2(VectorTypeL &row_norms) const
Computes the 2-norm for every row.
void convert(const NullMatrix< DT2_, IT2_, BlockHeight_, BlockWidth_ > &other)
Conversion method.
void transpose(const NullMatrix< DT_, IT_, BlockWidth_, BlockHeight_ > &x)
Calculate .
Index _num_rows
matrix dimensions
static constexpr int BlockWidth
Our block width.
std::size_t bytes() const
Returns the total amount of bytes allocated.
void apply(DenseVector< DT_, IT_ > &r, const DenseVectorBlocked< DT_, IT_, BlockWidth_ > &x) const
Calculate .
DT_ DataType
Our datatype.
NullMatrix(Index rows_in, Index columns_in)
Constructor.
void extract_diag(VectorTypeL &diag) const
ImageIterator image_begin(Index domain_node) const
String class implementation.
Tiny Matrix class template.
LAFEM common type definitions.
@ value
specifies whether the space should supply basis function values
std::uint64_t Index
Index data type.