Developer documentation
Version 3.0.3-105-gd3941f44
math.h File Reference
#include <cmath>
#include <cstdlib>
#include "app.h"
#include "exception.h"
#include "mrtrix.h"
#include "types.h"
#include "file/key_value.h"
#include "file/ofstream.h"
#include "file/path.h"

Go to the source code of this file.

Classes

class  MR::is_eigen_type< Cont >
 convenience functions for SFINAE on std:: / Eigen containers More...
 
class  MR::container_value_type< Cont, ReturnType >
 Get the underlying scalar value type for both std:: containers and Eigen. More...
 
class  MR::container_value_type< Cont, typename std::enable_if< is_eigen_type< Cont >::value, int >::type >
 

Namespaces

namespace  MR
 
namespace  MR::Math
 

Functions

template<typename T >
constexpr T MR::Math::pow2 (const T &v)
 
template<typename T >
constexpr T MR::Math::pow3 (const T &v)
 
template<typename T >
constexpr T MR::Math::pow4 (const T &v)
 
template<typename T >
constexpr T MR::Math::pow5 (const T &v)
 
template<typename T >
constexpr T MR::Math::pow6 (const T &v)
 
template<typename T >
constexpr T MR::Math::pow7 (const T &v)
 
template<typename T >
constexpr T MR::Math::pow8 (const T &v)
 
template<typename T >
constexpr T MR::Math::pow9 (const T &v)
 
template<typename T >
constexpr T MR::Math::pow10 (const T &v)
 
template<typename I , typename T >
constexpr I MR::Math::round (const T x) throw ()
 
template<typename I , typename T >
constexpr I MR::Math::floor (const T x) throw ()
 template function with cast to different type More...
 
template<typename I , typename T >
constexpr I MR::Math::ceil (const T x) throw ()
 template function with cast to different type More...
 
template<typename Derived >
bool MR::is_finite (const Eigen::MatrixBase< Derived > &x)
 check if all elements of an Eigen MatrixBase object are finite More...
 
template<typename Derived >
bool MR::is_nan (const Eigen::MatrixBase< Derived > &x)
 check if all elements of an Eigen MatrixBase object are a number More...
 
template<class MatrixType >
void MR::save_matrix (const MatrixType &M, const std::string &filename, const KeyValues &keyvals=KeyValues(), const bool add_to_command_history=true)
 write the matrix M to file More...
 
template<class ValueType = default_type>
vector< vector< ValueType > > MR::load_matrix_2D_vector (const std::string &filename, vector< std::string > *comments=nullptr)
 read matrix data into a 2D vector filename More...
 
template<class ValueType = default_type>
Eigen::Matrix< ValueType, Eigen::Dynamic, Eigen::Dynamic > MR::load_matrix (const std::string &filename)
 read matrix data into an Eigen::Matrix filename More...
 
template<class ValueType = default_type>
Eigen::Matrix< ValueType, Eigen::Dynamic, Eigen::Dynamic > MR::parse_matrix (const std::string &spec)
 read matrix data from a text string spec More...
 
template<class VectorType >
transform_type MR::load_transform (const std::string &filename, VectorType &centre)
 read matrix data from filename into an Eigen::Tranform class More...
 
transform_type MR::load_transform (const std::string &filename)
 
void MR::save_transform (const transform_type &M, const std::string &filename, const KeyValues &keyvals=KeyValues(), const bool add_to_command_history=true)
 write the transform M to file More...
 
template<class Derived >
void MR::save_transform (const transform_type &M, const Eigen::MatrixBase< Derived > &centre, const std::string &filename, const KeyValues &keyvals=KeyValues(), const bool add_to_command_history=true)
 
template<class VectorType >
void MR::save_vector (const VectorType &V, const std::string &filename, const KeyValues &keyvals=KeyValues(), const bool add_to_command_history=true)
 write the vector V to file More...
 
template<class ValueType = default_type>
Eigen::Matrix< ValueType, Eigen::Dynamic, 1 > MR::load_vector (const std::string &filename)
 read the vector data from filename More...
 

Variables

constexpr double MR::Math::e = 2.71828182845904523536
 
constexpr double MR::Math::pi = 3.14159265358979323846
 
constexpr double MR::Math::pi_2 = pi / 2.0
 
constexpr double MR::Math::pi_4 = pi / 4.0
 
constexpr double MR::Math::sqrt2 = 1.41421356237309504880
 
constexpr double MR::Math::sqrt1_2 = 1.0 / sqrt2