Flow123d  JS_before_hm-913-g695b665
Classes | Typedefs
Armor Namespace Reference

Classes

class  Array
 

Typedefs

template<class Type , uint nr, uint nc>
using ArmaMat = typename arma::Mat< Type >::template fixed< nr, nc >
 
template<class Type , uint nr>
using ArmaVec = typename arma::Col< Type >::template fixed< nr >
 
template<uint N>
using vec = ArmaVec< double, N >
 
template<uint N, uint M>
using mat = ArmaMat< double, N, M >
 
using array = Array< double >
 

Detailed Description

The Mat class template is used for small vectors and matricies. It is just a wrapper class for an actual storage, for calculations the armadillo library is used, in combination with inlining and expression templates all auxiliary constructors and data copy are usually optimized out leaving just optimal code for the desired calculation.

When deducing template parameters for the function templates the compiler consider only exact type match with possible const conversion and conversion to the parent. In particular implicit conversions are not considered. This makes transition between Armor and armadillo a bit complicated. In order to make everythink as smooth as possible we use several tricks: 1) defining a friend function inside of the class template creates an explicit function instance. As the instance is already created the implicit conversion is considered. See: https://stackoverflow.com/questions/9787593/implicit-type-conversion-with-template At least with GCC it seems, that this approach works for operators. Argument dependent lookup (ADL) finds the operator or function if at least one of its parameters is Mat template. However for operators the implicit conversion of the other argument is applied, while for the function it is not.

2) In order to consturct Mat<Type, nr, 1> and Mat<Type, 1, 1> also from arma::Col and from the Type variable, we use specialization that is derived from the generic case with nr>1, nc>1.

3) In order to prevent ambiguous method resolution, we can have just single TODO: try to transpose storage format used in Armor (prefered row first) and Armadillo (column first).

Typedef Documentation

template<class Type , uint nr, uint nc>
using Armor::ArmaMat = typedef typename arma::Mat<Type>::template fixed<nr, nc>

Check for close vectors or matrices. |a - b| < a_tol or |a-b| < r_tol * |a|

Note: Similar function arma::approx_equal.dot operator + operator - operator * scalar * and /

Definition at line 502 of file armor.hh.

template<class Type , uint nr>
using Armor::ArmaVec = typedef typename arma::Col<Type>::template fixed<nr>

Definition at line 505 of file armor.hh.

using Armor::array = typedef Array<double>

Definition at line 866 of file armor.hh.

template<uint N, uint M>
using Armor::mat = typedef ArmaMat<double, N, M>

Definition at line 864 of file armor.hh.

template<uint N>
using Armor::vec = typedef ArmaVec<double, N>

Definition at line 861 of file armor.hh.