Thrill  0.1
Matrix< Type > Class Template Reference

Detailed Description

template<typename Type>
class thrill::common::Matrix< Type >

A simple m x n dense matrix for generating statistics.

Definition at line 29 of file matrix.hpp.

#include <matrix.hpp>

Public Member Functions

 Matrix ()=default
 empty matrix constructor More...
 
 Matrix (size_t rows, size_t columns, const Type &initial=Type())
 constructor of m times n matrix. More...
 
 Matrix (size_t rows_columns, const Type &initial=Type())
 constructor of square n times n matrix. More...
 
 Matrix (size_t rows, size_t columns, std::vector< Type > &&data)
 constructor of m times n matrix from appropriate vector More...
 
const Type & at (size_t row, size_t column) const
 return const reference to element at cell More...
 
Type & at (size_t row, size_t column)
 return reference to element at cell More...
 
size_t columns () const
 number of columns in matrix More...
 
Type * data () const
 raw data of matrix More...
 
bool operator!= (const Matrix &b) const noexcept
 inequality operator More...
 
const Type & operator() (size_t row, size_t column) const
 return const reference to element at cell More...
 
Type & operator() (size_t row, size_t column)
 return reference to element at cell More...
 
Matrixoperator*= (const Type &s)
 multiply matrix with a scalar More...
 
Matrix operator+ (const Matrix &b) const
 add matrix to this one, returning result as a new matrix More...
 
Matrixoperator+= (const Matrix &b)
 add matrix to this one More...
 
bool operator== (const Matrix &b) const noexcept
 equality operator More...
 
size_t rows () const
 number of rows in matrix More...
 
size_t size () const
 size of matrix raw data (rows * columns) More...
 
template<typename Archive >
void ThrillSerialize (Archive &ar) const
 serialization with Thrill's serializer More...
 

Static Public Member Functions

template<typename Archive >
static Matrix ThrillDeserialize (Archive &ar)
 deserialization with Thrill's serializer More...
 

Static Public Attributes

static constexpr size_t thrill_fixed_size = 0
 
static constexpr bool thrill_is_fixed_size = false
 

Private Attributes

size_t columns_ = 0
 number of columns in matrix More...
 
std::vector< Type > data_
 data of matrix. More...
 
size_t rows_ = 0
 number of rows in matrix More...
 

Constructor & Destructor Documentation

◆ Matrix() [1/4]

Matrix ( )
default

empty matrix constructor

Referenced by Matrix< Type >::ThrillDeserialize().

◆ Matrix() [2/4]

Matrix ( size_t  rows,
size_t  columns,
const Type &  initial = Type() 
)
inline

constructor of m times n matrix.

Definition at line 36 of file matrix.hpp.

◆ Matrix() [3/4]

Matrix ( size_t  rows_columns,
const Type &  initial = Type() 
)
inlineexplicit

constructor of square n times n matrix.

Definition at line 41 of file matrix.hpp.

◆ Matrix() [4/4]

Matrix ( size_t  rows,
size_t  columns,
std::vector< Type > &&  data 
)
inline

constructor of m times n matrix from appropriate vector

Definition at line 45 of file matrix.hpp.

References Matrix< Type >::columns_, Matrix< Type >::data_, and Matrix< Type >::rows_.

Member Function Documentation

◆ at() [1/2]

const Type& at ( size_t  row,
size_t  column 
) const
inline

return const reference to element at cell

Definition at line 64 of file matrix.hpp.

References Matrix< Type >::columns_, Matrix< Type >::data_, and Matrix< Type >::rows_.

Referenced by Matrix< Type >::operator()().

◆ at() [2/2]

Type& at ( size_t  row,
size_t  column 
)
inline

return reference to element at cell

Definition at line 71 of file matrix.hpp.

References Matrix< Type >::columns_, Matrix< Type >::data_, and Matrix< Type >::rows_.

◆ columns()

size_t columns ( ) const
inline

◆ data()

Type* data ( ) const
inline

raw data of matrix

Definition at line 58 of file matrix.hpp.

References Matrix< Type >::data_.

Referenced by Matrix< Type >::ThrillDeserialize().

◆ operator!=()

bool operator!= ( const Matrix< Type > &  b) const
inlinenoexcept

inequality operator

Definition at line 115 of file matrix.hpp.

References Matrix< Type >::operator==().

◆ operator()() [1/2]

const Type& operator() ( size_t  row,
size_t  column 
) const
inline

return const reference to element at cell

Definition at line 78 of file matrix.hpp.

References Matrix< Type >::at().

◆ operator()() [2/2]

Type& operator() ( size_t  row,
size_t  column 
)
inline

return reference to element at cell

Definition at line 83 of file matrix.hpp.

References Matrix< Type >::at().

◆ operator*=()

Matrix& operator*= ( const Type &  s)
inline

multiply matrix with a scalar

Definition at line 103 of file matrix.hpp.

References Matrix< Type >::data_.

◆ operator+()

Matrix operator+ ( const Matrix< Type > &  b) const
inline

add matrix to this one, returning result as a new matrix

Definition at line 96 of file matrix.hpp.

References Matrix< Type >::columns(), and Matrix< Type >::rows().

◆ operator+=()

Matrix& operator+= ( const Matrix< Type > &  b)
inline

add matrix to this one

Definition at line 88 of file matrix.hpp.

References Matrix< Type >::columns(), Matrix< Type >::data_, and Matrix< Type >::rows().

◆ operator==()

bool operator== ( const Matrix< Type > &  b) const
inlinenoexcept

equality operator

Definition at line 109 of file matrix.hpp.

References Matrix< Type >::columns(), Matrix< Type >::data_, and Matrix< Type >::rows().

Referenced by Matrix< Type >::operator!=().

◆ rows()

size_t rows ( ) const
inline

number of rows in matrix

Definition at line 52 of file matrix.hpp.

References Matrix< Type >::rows_.

Referenced by Matrix< Type >::operator+(), Matrix< Type >::operator+=(), and Matrix< Type >::operator==().

◆ size()

size_t size ( ) const
inline

size of matrix raw data (rows * columns)

Definition at line 61 of file matrix.hpp.

References Matrix< Type >::data_.

◆ ThrillDeserialize()

static Matrix ThrillDeserialize ( Archive &  ar)
inlinestatic

deserialization with Thrill's serializer

Definition at line 137 of file matrix.hpp.

References Matrix< Type >::columns(), Matrix< Type >::data(), and Matrix< Type >::Matrix().

◆ ThrillSerialize()

void ThrillSerialize ( Archive &  ar) const
inline

serialization with Thrill's serializer

Definition at line 126 of file matrix.hpp.

References Matrix< Type >::columns_, Matrix< Type >::data_, and Matrix< Type >::rows_.

Member Data Documentation

◆ columns_

size_t columns_ = 0
private

number of columns in matrix

Definition at line 154 of file matrix.hpp.

Referenced by Matrix< Type >::at(), Matrix< Type >::columns(), Matrix< Type >::Matrix(), and Matrix< Type >::ThrillSerialize().

◆ data_

◆ rows_

size_t rows_ = 0
private

number of rows in matrix

Definition at line 152 of file matrix.hpp.

Referenced by Matrix< Type >::at(), Matrix< Type >::Matrix(), Matrix< Type >::rows(), and Matrix< Type >::ThrillSerialize().

◆ thrill_fixed_size

constexpr size_t thrill_fixed_size = 0
static

Definition at line 122 of file matrix.hpp.

◆ thrill_is_fixed_size

constexpr bool thrill_is_fixed_size = false
static

Definition at line 121 of file matrix.hpp.


The documentation for this class was generated from the following file: