Classes | Functions

linalg.h File Reference

Contains commonly used definitions and functions for linear algebra in 3 dimensions. More...

#include <cmath>

Go to the source code of this file.

Classes

struct  vec_t
 Defines simple 3D vector and matrices. 3. More...
struct  mat_t
 Defines a 3-by-3 Matrix. More...

Functions

vec_t make_vec (double x, double y, double z)
vec_t make_vec (double th, double phi)
vec_t make_vec_s (double *sph)
vec_t make_vec_c (double *m)
void vec2sph (vec_t m, double *sph)
void vec2mem (vec_t v, double *m)
vec_t operator- (vec_t a)
vec_t operator+ (vec_t a, vec_t b)
vec_t operator+ (vec_t a, double b)
vec_t operator+ (double a, vec_t b)
void operator+= (vec_t &a, double b)
vec_t operator- (vec_t a, vec_t b)
vec_t operator- (vec_t a, double b)
vec_t operator- (double a, vec_t b)
void operator-= (vec_t &a, double b)
vec_t operator* (vec_t a, double b)
vec_t operator* (double a, vec_t b)
void operator*= (vec_t &a, double b)
vec_t operator/ (vec_t a, double b)
vec_t operator/ (double a, vec_t b)
void operator/= (vec_t &a, double b)
double norm (vec_t a)
double norm2 (vec_t a)
double dot (vec_t a, vec_t b)
mat_t make_mat (double a, double b, double c, double d, double e, double f, double g, double h, double i)
mat_t diag (double a, double b, double c)
mat_t t (mat_t m)
mat_t operator* (mat_t a, double b)
mat_t operator* (double a, mat_t b)
vec_t operator* (mat_t a, vec_t b)
mat_t operator* (mat_t a, mat_t b)
double det (mat_t M)
mat_t ct (mat_t M)
mat_t inv (mat_t M)
mat_t diffusion (vec_t m, double l1, double l2)
mat_t rotation (double theta, double phi, double psi)
vec_t rotation_main_dir (double theta, double phi, double psi)
mat_t diffusion_euler (double theta, double phi, double psi, double l1, double l2, double l3)

Detailed Description

Contains commonly used definitions and functions for linear algebra in 3 dimensions.


Function Documentation

mat_t ct ( mat_t  M  )  [inline]

Conjugate transpose of a 3-by-3 matrix

double det ( mat_t  M  )  [inline]

Calculate the determinant of a 3-by-3 matrix

mat_t diag ( double  a,
double  b,
double  c 
) [inline]

Make a diagonal matrix

mat_t diffusion ( vec_t  m,
double  l1,
double  l2 
) [inline]

Make a diffusion tensor matrix from one principal direction, and major and minor EV

mat_t diffusion_euler ( double  theta,
double  phi,
double  psi,
double  l1,
double  l2,
double  l3 
) [inline]

Calculate a diffusion matrix from euler angles

double dot ( vec_t  a,
vec_t  b 
) [inline]

Calculate the dot product of two vectors

mat_t inv ( mat_t  M  )  [inline]

Inversion of a 3-by-3 matrix

mat_t make_mat ( double  a,
double  b,
double  c,
double  d,
double  e,
double  f,
double  g,
double  h,
double  i 
) [inline]

Make a matrix

vec_t make_vec ( double  th,
double  phi 
) [inline]

Make a 3D vector from two angles

vec_t make_vec ( double  x,
double  y,
double  z 
) [inline]

Make a 3D vector

vec_t make_vec_c ( double *  m  )  [inline]

Make a 3D vector from a double array of three

vec_t make_vec_s ( double *  sph  )  [inline]

Make a 3D vector from a double array of two with angles

double norm ( vec_t  a  )  [inline]

Calculate the euler-norm of a vector

double norm2 ( vec_t  a  )  [inline]

Calculate the 2-norm of a vector

mat_t operator* ( mat_t  a,
mat_t  b 
) [inline]

Mutliply two 3-by-3 Matrices

vec_t operator* ( vec_t  a,
double  b 
) [inline]

Scaling of a vector by a scalar

vec_t operator* ( double  a,
vec_t  b 
) [inline]

Scaling of a vector by a scalar

mat_t operator* ( mat_t  a,
double  b 
) [inline]

Scale all elements of a matrix

mat_t operator* ( double  a,
mat_t  b 
) [inline]

Scale all elements of a matrix

vec_t operator* ( mat_t  a,
vec_t  b 
) [inline]

Multiply a matrix (a) with vector (b)

void operator*= ( vec_t a,
double  b 
) [inline]

Compound assignment scaling

vec_t operator+ ( vec_t  a,
vec_t  b 
) [inline]

Addition two vectors

vec_t operator+ ( vec_t  a,
double  b 
) [inline]

Addition, add scalar to each vector element

vec_t operator+ ( double  a,
vec_t  b 
) [inline]

Addition, add scalar to each vector element

void operator+= ( vec_t a,
double  b 
) [inline]

Agumented assignment of scalar to vector

vec_t operator- ( vec_t  a  )  [inline]

Negation

vec_t operator- ( vec_t  a,
vec_t  b 
) [inline]

Substraction of two vectors

vec_t operator- ( vec_t  a,
double  b 
) [inline]

Substract a scalar from each vector element

vec_t operator- ( double  a,
vec_t  b 
) [inline]

Substract each vector element from a scalar

void operator-= ( vec_t a,
double  b 
) [inline]

Substraction compound assignment

vec_t operator/ ( vec_t  a,
double  b 
) [inline]

Scaling of a vector by division

vec_t operator/ ( double  a,
vec_t  b 
) [inline]

Scaling of a vector by division

void operator/= ( vec_t a,
double  b 
) [inline]

Compound assignment scaling by division

mat_t rotation ( double  theta,
double  phi,
double  psi 
) [inline]

Assemble rotation matrix given the rotation angles

vec_t rotation_main_dir ( double  theta,
double  phi,
double  psi 
) [inline]

Calculate main direction of the diffusion from euler angles

mat_t t ( mat_t  m  )  [inline]

Transpose a matrix

void vec2mem ( vec_t  v,
double *  m 
) [inline]

Make a double array of three from a 3D vector

void vec2sph ( vec_t  m,
double *  sph 
) [inline]

Make a double array of angles from a 3D vector

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Defines