A square nxn matrix.
More...
template<class T>
class dg::Operator< T >
A square nxn matrix.
An enhanced square dynamic matrix for which arithmetic operators are overloaded. It is not meant for performance critical code but is very convenient for example for the assembly of matrices.
- See also
dg::create::inverse
, dg::create::lu_pivot
, dg::create::lu_solve
- Template Parameters
-
◆ value_type
typically double or float
◆ Operator() [1/5]
◆ Operator() [2/5]
allocate storage for nxn matrix
- Parameters
-
◆ Operator() [3/5]
template<class T >
dg::Operator< T >::Operator |
( |
const unsigned |
n, |
|
|
const T & |
value |
|
) |
| |
|
inline |
Initialize elements.
- Parameters
-
n | matrix is of size n x n |
value | Every element is initialized to. |
◆ Operator() [4/5]
template<class T >
template<class InputIterator >
dg::Operator< T >::Operator |
( |
InputIterator |
first, |
|
|
InputIterator |
last, |
|
|
std::enable_if_t<!std::is_integral< InputIterator >::value > * |
= 0 |
|
) |
| |
|
inline |
Construct from iterators.
- Template Parameters
-
- Parameters
-
◆ Operator() [5/5]
Copy from existing data.
- Parameters
-
src | size must be a square number |
◆ data()
access underlying data
- Returns
◆ operator!=()
two Matrices are considered equal if elements are equal
- Parameters
-
rhs | Matrix to be compared to this |
- Returns
- true if rhs does not equal this
◆ operator()() [1/2]
template<class T >
T & dg::Operator< T >::operator() |
( |
const size_t |
i, |
|
|
const size_t |
j |
|
) |
| |
|
inline |
access operator
A range check is performed if DG_DEBUG is defined
- Parameters
-
- Returns
- reference to value at that location
◆ operator()() [2/2]
template<class T >
const T & dg::Operator< T >::operator() |
( |
const size_t |
i, |
|
|
const size_t |
j |
|
) |
| const |
|
inline |
const access operator
- Parameters
-
- Returns
- const value at that location
◆ operator*=()
scalar multiply
- Parameters
-
- Returns
◆ operator+=()
◆ operator-()
◆ operator-=()
subtract
- Parameters
-
- Returns
◆ operator==()
two Matrices are considered equal if elements are equal
- Parameters
-
rhs | Matrix to be compared to this |
- Returns
- true if rhs equals this
◆ resize()
Resize.
- Parameters
-
m | new size |
val | if m is greater than the current size new elements are initialized with val |
◆ size()
◆ swap_lines()
template<class T >
void dg::Operator< T >::swap_lines |
( |
const size_t |
i, |
|
|
const size_t |
k |
|
) |
| |
|
inline |
Swap two lines in the square matrix.
- Parameters
-
◆ transpose()
Transposition.
- Returns
- A newly generated Operator containing the transpose.
◆ zero()
Assign zero to all elements.
◆ operator* [1/3]
matrix multiplication
- Parameters
-
- Returns
◆ operator* [2/3]
scalar multiplication
- Parameters
-
- Returns
◆ operator* [3/3]
scalar multiplication
- Parameters
-
- Returns
◆ operator+
◆ operator-
subtract
- Parameters
-
- Returns
◆ operator<<
template<class T >
template<class Ostream >
Ostream & operator<< |
( |
Ostream & |
os, |
|
|
const Operator< T > & |
mat |
|
) |
| |
|
friend |
puts a matrix linewise in output stream
- Template Parameters
-
Ostream | The stream e.g. std::cout |
- Parameters
-
os | the outstream |
mat | the matrix to output |
- Returns
- the outstream
◆ operator>>
template<class T >
template<class Istream >
Istream & operator>> |
( |
Istream & |
is, |
|
|
Operator< T > & |
mat |
|
) |
| |
|
friend |
Read values into a Matrix from given istream.
The values are filled linewise into the matrix. Values are seperated by whitespace characters. (i.e. newline, blank, etc)
- Template Parameters
-
Istream | The stream e.g. std::cin |
- Parameters
-
is | The istream |
mat | The Matrix into which the values are written |
- Returns
- The istream
The documentation for this class was generated from the following file: