MEPP2 Project
Classes | Namespaces | Macros | Functions
MatrixOperations.hpp File Reference
#include "degree_rad_conversion.h"
#include <iostream>
#include <vector>
#include <limits>
#include <algorithm>
#include <cassert>
#include <cmath>
Include dependency graph for MatrixOperations.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  FEVV::Math::Vector::Stats::IndexCmp< T >
 

Namespaces

 FEVV
 Interfaces for plugins These interfaces will be used for different plugins.
 
 FEVV::Math
 
 FEVV::Math::Vector
 
 FEVV::Math::Vector::Stats
 
 FEVV::Math::Matrix
 
 FEVV::Math::Matrix::Square
 

Macros

#define ABS_GUY   fabs
 
#define SQRT_GUY   sqrt
 
#define MACH_EPS_DOUBLE   2e-16
 
#define MACH_EPS_FLOAT   2e-7
 

Functions

template<class ElementType >
static std::vector< ElementType > FEVV::Math::Vector::Stats::unique (const std::vector< ElementType > &v)
 
template<typename ElementType , int DIM>
static ElementType FEVV::Math::Vector::Stats::maximum (const ElementType v[DIM])
 
template<typename ElementType >
static ElementType FEVV::Math::Vector::Stats::maximum (const std::vector< ElementType > &v)
 
template<typename ElementType , int DIM>
static ElementType FEVV::Math::Vector::Stats::minimum (const ElementType v[DIM])
 
template<typename ElementType >
static ElementType FEVV::Math::Vector::Stats::minimum (const std::vector< ElementType > &v)
 
template<typename ElementType , int DIM>
static ElementType FEVV::Math::Vector::Stats::mean (const ElementType v[DIM])
 
template<typename ElementType >
static ElementType FEVV::Math::Vector::Stats::mean (const std::vector< ElementType > &v)
 
template<typename ElementType >
static ElementType FEVV::Math::Vector::Stats::mean2 (const std::vector< ElementType > &v)
 
template<typename ElementType >
static ElementType FEVV::Math::Vector::Stats::mean4 (const std::vector< ElementType > &v)
 
template<typename ElementType >
static ElementType FEVV::Math::Vector::Stats::mean_sqrt (const std::vector< ElementType > &v)
 Be careful, this function will not work if any of the values is negative. More...
 
template<typename ElementType >
static ElementType FEVV::Math::Vector::Stats::mean_sqrt_sqrt (const std::vector< ElementType > &v)
 Be careful, this function will not work if any of the values is negative. More...
 
template<typename ElementType , int DIM>
static ElementType FEVV::Math::Vector::Stats::weighted_mean (const ElementType v[DIM], const ElementType weights[DIM])
 
template<typename ElementType >
static ElementType FEVV::Math::Vector::Stats::weighted_mean (const std::vector< ElementType > &v, const std::vector< ElementType > &weights)
 
template<class ElementType >
static ElementType FEVV::Math::Vector::Stats::median (std::vector< ElementType > v)
 
template<class ElementType >
static ElementType FEVV::Math::Vector::Stats::percentile (std::vector< ElementType > v, float k)
 
template<class T >
std::vector< unsigned int > FEVV::Math::Vector::Stats::sort_vector_indices (std::vector< T > &v)
 
template<class ElementType >
static ElementType FEVV::Math::Vector::Stats::weightedmedian (const std::vector< ElementType > &v, const std::vector< ElementType > &weights)
 
template<class ElementType >
static ElementType FEVV::Math::Vector::Stats::variance (const std::vector< ElementType > &v, ElementType mean_value, bool unbiased=true)
 
template<class ElementType >
ElementType FEVV::Math::Vector::Stats::skewness (const std::vector< ElementType > &v, ElementType mean_value, ElementType biased_variance_value)
 
template<class ElementType >
ElementType FEVV::Math::Vector::Stats::kurtosis (const std::vector< ElementType > &v, ElementType mean_value, ElementType biased_variance_value)
 
template<typename ElementType , int DIM>
static ElementType FEVV::Math::Vector::dot_product (const ElementType v1[DIM], const ElementType v2[DIM])
 Compute v1 * v2 scalar product. More...
 
template<typename ElementType >
static ElementType FEVV::Math::Vector::dot_product (const std::vector< ElementType > &v1, const std::vector< ElementType > &v2)
 Compute v1 * v2 scalar product. More...
 
template<typename GeometryTraits >
static GeometryTraits::Scalar FEVV::Math::Vector::dot_product (const typename GeometryTraits::Vector &v1, const typename GeometryTraits::Vector &v2, const GeometryTraits &gt)
 
template<typename ElementType , int DIM>
static std::vector< ElementType > FEVV::Math::Vector::cross_product (const ElementType v1[DIM], const ElementType v2[DIM])
 
template<typename ElementType >
static std::vector< ElementType > FEVV::Math::Vector::cross_product (const std::vector< ElementType > &v1, const std::vector< ElementType > &v2)
 Compute v1 x v2 cross product. More...
 
template<typename GeometryTraits >
static GeometryTraits::Vector FEVV::Math::Vector::cross_product (const typename GeometryTraits::Vector &v1, const typename GeometryTraits::Vector &v2, const GeometryTraits &gt)
 
template<typename ElementType , int DIM>
static std::vector< ElementType > FEVV::Math::Vector::sub (const ElementType v1[DIM], const ElementType v2[DIM])
 Compute v1 - v2 (subtraction) More...
 
template<typename ElementType >
static std::vector< ElementType > FEVV::Math::Vector::sub (const std::vector< ElementType > &v1, const std::vector< ElementType > &v2)
 Compute v1 - v2 (subtraction) More...
 
template<typename GeometryTraits >
static GeometryTraits::Vector FEVV::Math::Vector::sub (const typename GeometryTraits::Point &p1, const typename GeometryTraits::Point &p2, const GeometryTraits &gt)
 Compute p1 - p2 (subtraction) More...
 
template<typename ElementType , int DIM>
static std::vector< ElementType > FEVV::Math::Vector::add (const ElementType v1[DIM], const ElementType v2[DIM])
 Compute v1 + v2 (addition) More...
 
template<typename ElementType >
static std::vector< ElementType > FEVV::Math::Vector::add (const std::vector< ElementType > &v1, const std::vector< ElementType > &v2)
 Compute v1 + v2 (addition) More...
 
template<typename GeometryTraits >
static GeometryTraits::Point FEVV::Math::Vector::add (const typename GeometryTraits::Point &p, const typename GeometryTraits::Vector &v, const GeometryTraits &gt)
 Compute p + v (addition) More...
 
template<typename ElementType , int DIM>
static double FEVV::Math::Vector::l2_distance (const ElementType v1[DIM], const ElementType v2[DIM])
 Compute ||v1 - v2||_L2 norm (distance between v1 and v2) More...
 
template<typename ElementType , int DIM>
static double FEVV::Math::Vector::l2_distance (const ElementType v[DIM])
 Compute ||V||_L2 norm (distance between v1 and v2) More...
 
template<typename GeometryTraits >
static double FEVV::Math::Vector::l2_distance (const typename GeometryTraits::Point &p1, const typename GeometryTraits::Point &p2, const GeometryTraits &gt)
 Compute ||p1 - p2||_L2 norm (distance between p1 and p2) More...
 
template<typename ElementType >
static double FEVV::Math::Vector::l2_distance (const std::vector< ElementType > &v1, const std::vector< ElementType > &v2)
 Compute ||v1 - v2||_L2 norm (distance between v1 and v2) More...
 
template<typename GeometryTraits >
static double FEVV::Math::Vector::l2_distance (const typename GeometryTraits::Vector &v, const GeometryTraits &gt)
 Compute ||V||_L2 norm (distance between v1 and v2) More...
 
template<typename ElementType >
static double FEVV::Math::Vector::l2_distance (const std::vector< ElementType > &v)
 Compute ||V||_L2 norm (distance between v1 and v2) More...
 
template<typename GeometryTraits >
static GeometryTraits::Vector FEVV::Math::Vector::normalize (const typename GeometryTraits::Vector &v, const GeometryTraits &gt)
 
template<typename ElementType >
static bool FEVV::Math::Vector::are_collinear (const std::vector< ElementType > &v1, const std::vector< ElementType > &v2)
 Tells if 2 nD vectors are collinear or not. More...
 
template<typename GeometryTraits >
static bool FEVV::Math::Vector::are_collinear (const typename GeometryTraits::Vector &v1, const typename GeometryTraits::Vector &v2)
 
template<typename ElementType >
static bool FEVV::Math::Vector::are_aligned (const std::vector< ElementType > &p1, const std::vector< ElementType > &p2, const std::vector< ElementType > &p3)
 Tells if 3 nD points are aligned or not. More...
 
template<typename GeometryTraits >
static bool FEVV::Math::Vector::are_aligned (const typename GeometryTraits::Point &p1, const typename GeometryTraits::Point &p2, const typename GeometryTraits::Point &p3)
 
template<typename ElementType >
static std::vector< ElementType > FEVV::Math::Vector::scalar_mult (const std::vector< ElementType > &v1, ElementType coef)
 Compute v1 * coef. More...
 
template<typename GeometryTraits >
static GeometryTraits::Vector FEVV::Math::Vector::scalar_mult (const typename GeometryTraits::Vector &v, double coef, const GeometryTraits &gt)
 
template<typename ElementType , int DIM>
static double FEVV::Math::Vector::get_angle_from_unit_vectors (const ElementType v1[DIM], const ElementType v2[DIM])
 V1 and V2 must be unit vectors! More...
 
template<typename ElementType , int DIM>
static double FEVV::Math::Vector::get_angle_in_degree_from_unit_vectors (const ElementType v1[DIM], const ElementType v2[DIM])
 
template<typename ElementType >
static double FEVV::Math::Vector::get_angle_from_unit_vectors (const std::vector< ElementType > &v1, const std::vector< ElementType > &v2)
 V1 and V2 must be unit vectors! More...
 
template<typename ElementType >
static double FEVV::Math::Vector::get_angle_in_degree_from_unit_vectors (const std::vector< ElementType > &v1, const std::vector< ElementType > &v2)
 
template<class ElementType >
static double FEVV::Math::Vector::get_angle_from_non_unit_vectors (const std::vector< ElementType > &v1, const std::vector< ElementType > &v2)
 V1 and V2 does not need to be unit vectors! More...
 
template<typename ElementType >
static double FEVV::Math::Vector::get_angle_in_degree_from_non_unit_vectors (const std::vector< ElementType > &v1, const std::vector< ElementType > &v2)
 
template<class ElementType >
static double FEVV::Math::Vector::get_angle_from3positions (const std::vector< ElementType > &p1, const std::vector< ElementType > &p2, const std::vector< ElementType > &p3)
 
template<typename ElementType >
static double FEVV::Math::Vector::get_angle_in_degree_from3positions (const std::vector< ElementType > &p1, const std::vector< ElementType > &p2, const std::vector< ElementType > &p3)
 
template<typename ElementType >
static void FEVV::Math::Vector::rot_coord_sys (const std::vector< ElementType > &old_u, const std::vector< ElementType > &old_v, const std::vector< ElementType > &new_norm, std::vector< ElementType > &new_u, std::vector< ElementType > &new_v)
 
template<typename ElementType >
void FEVV::Math::Vector::proj_curv (const std::vector< ElementType > &old_u, const std::vector< ElementType > &old_v, ElementType old_ku, ElementType old_kuv, ElementType old_kv, const std::vector< ElementType > &new_u, const std::vector< ElementType > &new_v, ElementType &new_ku, ElementType &new_kuv, ElementType &new_kv)
 
template<typename CoordinateType , size_t N>
static std::vector< CoordinateType > FEVV::Math::Matrix::Square::covar (const CoordinateType point_coords[3 *N])
 
template<typename CoordinateType >
static std::vector< CoordinateType > FEVV::Math::Matrix::Square::covar (const std::vector< CoordinateType > &point_coords)
 
template<typename ElementType , int DIM = 3>
static void FEVV::Math::Matrix::Square::vector_times_transpose_mult (const ElementType *p_vector, ElementType pp_matrix[][DIM], ElementType coeff)
 Compute coef * V x V^t (V is a vertical DIM-D vector) More...
 
template<typename ElementType , int DIM = 3>
static void FEVV::Math::Matrix::Square::transformation (const ElementType pp_matrix[DIM][DIM], const ElementType in_vertex[DIM], ElementType out_vertex[DIM])
 
template<typename ElementType , int DIM, int N>
static void FEVV::Math::Matrix::Square::transformation (const ElementType pp_matrix[DIM][DIM], const ElementType in_vertices[DIM][N], ElementType out_vertices[DIM][N])
 
template<typename ElementType , int DIM>
static void FEVV::Math::Matrix::Square::add (const ElementType p_matrix[][DIM], ElementType p_matrix_sum[][DIM])
 add two matrices More...
 
template<typename ElementType , int DIM>
static bool FEVV::Math::Matrix::Square::is_diagonal (const ElementType p_matrix[DIM][DIM])
 

Macro Definition Documentation

◆ ABS_GUY

#define ABS_GUY   fabs

Definition at line 23 of file MatrixOperations.hpp.

◆ MACH_EPS_DOUBLE

#define MACH_EPS_DOUBLE   2e-16

Definition at line 29 of file MatrixOperations.hpp.

◆ MACH_EPS_FLOAT

#define MACH_EPS_FLOAT   2e-7

Definition at line 32 of file MatrixOperations.hpp.

◆ SQRT_GUY

#define SQRT_GUY   sqrt

Definition at line 26 of file MatrixOperations.hpp.