DAMASK with grid solvers  Revision: v2.0.3-2204-gdb1f2151
The Düsseldorf Advanced Material Simulation Kit with Grid Solvers
quaternions Module Reference

general quaternion math, not limited to unit quaternions More...

Data Types

interface  abs
 
interface  aimag
 
interface  assignment(=)
 
interface  conjg
 
interface  dot_product
 
interface  exp
 
interface  log
 
interface  quaternion
 
interface  real
 

Functions/Subroutines

subroutine, public quaternions_init
 do self test More...
 
type(quaternion) pure function init__ (array)
 construct a quaternion from a 4-vector More...
 
elemental pure subroutine assign_quat__ (self, other)
 assign a quaternion More...
 
pure subroutine assign_vec__ (self, other)
 assign a 4-vector More...
 
type(quaternion) elemental pure function add__ (self, other)
 add a quaternion More...
 
type(quaternion) elemental pure function pos__ (self)
 return (unary positive operator) More...
 
type(quaternion) elemental pure function sub__ (self, other)
 subtract a quaternion More...
 
type(quaternion) elemental pure function neg__ (self)
 negate (unary negative operator) More...
 
type(quaternion) elemental pure function mul_quat__ (self, other)
 multiply with a quaternion More...
 
type(quaternion) elemental pure function mul_scal__ (self, scal)
 multiply with a scalar More...
 
type(quaternion) elemental pure function div_quat__ (self, other)
 divide by a quaternion More...
 
type(quaternion) elemental pure function div_scal__ (self, scal)
 divide by a scalar More...
 
logical elemental pure function eq__ (self, other)
 test equality More...
 
logical elemental pure function neq__ (self, other)
 test inequality More...
 
type(quaternion) elemental pure function pow_quat__ (self, expon)
 raise to the power of a quaternion More...
 
type(quaternion) elemental pure function pow_scal__ (self, expon)
 raise to the power of a scalar More...
 
type(quaternion) elemental pure function exp__ (a)
 take exponential More...
 
type(quaternion) elemental pure function log__ (a)
 take logarithm More...
 
real(preal) elemental pure function abs__ (self)
 return norm More...
 
real(preal) elemental pure function dot_product__ (a, b)
 calculate dot product More...
 
type(quaternion) elemental pure function conjg__ (self)
 take conjugate complex More...
 
type(quaternion) elemental pure function homomorphed (self)
 homomorph More...
 
pure real(preal) function, dimension(4) asarray (self)
 return as plain array More...
 
pure real(preal) function real__ (self)
 real part (scalar) More...
 
pure real(preal) function, dimension(3) aimag__ (self)
 imaginary part (3-vector) More...
 
type(quaternion) elemental pure function inverse (self)
 inverse More...
 
subroutine unittest
 check correctness of some quaternions functions More...
 

Variables

real(preal), parameter, public p = -1.0_pReal
 parameter for orientation conversion. More...
 

Detailed Description

general quaternion math, not limited to unit quaternions

Author
Martin Diehl, Max-Planck-Institut für Eisenforschung GmbH
Philip Eisenlohr, Michigan State University

w is the real part, (x, y, z) are the imaginary parts.

https://en.wikipedia.org/wiki/Quaternion

Function/Subroutine Documentation

◆ abs__()

real(preal) elemental pure function quaternions::abs__ ( class(quaternion), intent(in)  self)
private

return norm

Definition at line 366 of file quaternions.f90.

◆ add__()

type(quaternion) elemental pure function quaternions::add__ ( class(quaternion), intent(in)  self,
class(quaternion), intent(in)  other 
)
private

add a quaternion

Definition at line 172 of file quaternions.f90.

Referenced by quaternions::quaternion::operator().

+ Here is the caller graph for this function:

◆ aimag__()

pure real(preal) function, dimension(3) quaternions::aimag__ ( class(quaternion), intent(in)  self)
private

imaginary part (3-vector)

Definition at line 440 of file quaternions.f90.

◆ asarray()

pure real(preal) function, dimension(4) quaternions::asarray ( class(quaternion), intent(in)  self)
private

return as plain array

Definition at line 414 of file quaternions.f90.

◆ assign_quat__()

elemental pure subroutine quaternions::assign_quat__ ( type(quaternion), intent(out)  self,
type(quaternion), intent(in)  other 
)
private

assign a quaternion

Definition at line 143 of file quaternions.f90.

◆ assign_vec__()

pure subroutine quaternions::assign_vec__ ( type(quaternion), intent(out)  self,
real(preal), dimension(4), intent(in)  other 
)
private

assign a 4-vector

Definition at line 156 of file quaternions.f90.

◆ conjg__()

type(quaternion) elemental pure function quaternions::conjg__ ( class(quaternion), intent(in)  self)
private

take conjugate complex

Definition at line 390 of file quaternions.f90.

◆ div_quat__()

type(quaternion) elemental pure function quaternions::div_quat__ ( class(quaternion), intent(in)  self,
class(quaternion), intent(in)  other 
)
private

divide by a quaternion

Definition at line 250 of file quaternions.f90.

Referenced by quaternions::quaternion::operator().

+ Here is the caller graph for this function:

◆ div_scal__()

type(quaternion) elemental pure function quaternions::div_scal__ ( class(quaternion), intent(in)  self,
real(preal), intent(in)  scal 
)
private

divide by a scalar

Definition at line 262 of file quaternions.f90.

Referenced by quaternions::quaternion::operator().

+ Here is the caller graph for this function:

◆ dot_product__()

real(preal) elemental pure function quaternions::dot_product__ ( class(quaternion), intent(in)  a,
class(quaternion), intent(in)  b 
)
private

calculate dot product

Definition at line 378 of file quaternions.f90.

◆ eq__()

logical elemental pure function quaternions::eq__ ( class(quaternion), intent(in)  self,
class(quaternion), intent(in)  other 
)
private

test equality

Definition at line 275 of file quaternions.f90.

Referenced by quaternions::quaternion::operator().

+ Here is the caller graph for this function:

◆ exp__()

type(quaternion) elemental pure function quaternions::exp__ ( class(quaternion), intent(in)  a)
private

take exponential

Definition at line 326 of file quaternions.f90.

◆ homomorphed()

type(quaternion) elemental pure function quaternions::homomorphed ( class(quaternion), intent(in)  self)
private

homomorph

Definition at line 402 of file quaternions.f90.

◆ init__()

type(quaternion) pure function quaternions::init__ ( real(preal), dimension(4), intent(in)  array)
private

construct a quaternion from a 4-vector

Definition at line 128 of file quaternions.f90.

◆ inverse()

type(quaternion) elemental pure function quaternions::inverse ( class(quaternion), intent(in)  self)
private

inverse

Definition at line 453 of file quaternions.f90.

Referenced by unittest().

+ Here is the caller graph for this function:

◆ log__()

type(quaternion) elemental pure function quaternions::log__ ( class(quaternion), intent(in)  a)
private

take logarithm

Definition at line 346 of file quaternions.f90.

◆ mul_quat__()

type(quaternion) elemental pure function quaternions::mul_quat__ ( class(quaternion), intent(in)  self,
class(quaternion), intent(in)  other 
)
private

multiply with a quaternion

Definition at line 222 of file quaternions.f90.

References p.

Referenced by quaternions::quaternion::operator().

+ Here is the caller graph for this function:

◆ mul_scal__()

type(quaternion) elemental pure function quaternions::mul_scal__ ( class(quaternion), intent(in)  self,
real(preal), intent(in)  scal 
)
private

multiply with a scalar

Definition at line 237 of file quaternions.f90.

Referenced by quaternions::quaternion::operator().

+ Here is the caller graph for this function:

◆ neg__()

type(quaternion) elemental pure function quaternions::neg__ ( class(quaternion), intent(in)  self)
private

negate (unary negative operator)

Definition at line 210 of file quaternions.f90.

Referenced by quaternions::quaternion::operator().

+ Here is the caller graph for this function:

◆ neq__()

logical elemental pure function quaternions::neq__ ( class(quaternion), intent(in)  self,
class(quaternion), intent(in)  other 
)
private

test inequality

Definition at line 288 of file quaternions.f90.

Referenced by quaternions::quaternion::operator().

+ Here is the caller graph for this function:

◆ pos__()

type(quaternion) elemental pure function quaternions::pos__ ( class(quaternion), intent(in)  self)
private

return (unary positive operator)

Definition at line 185 of file quaternions.f90.

Referenced by quaternions::quaternion::operator().

+ Here is the caller graph for this function:

◆ pow_quat__()

type(quaternion) elemental pure function quaternions::pow_quat__ ( class(quaternion), intent(in)  self,
type(quaternion), intent(in)  expon 
)
private

raise to the power of a quaternion

Definition at line 300 of file quaternions.f90.

Referenced by quaternions::quaternion::operator().

+ Here is the caller graph for this function:

◆ pow_scal__()

type(quaternion) elemental pure function quaternions::pow_scal__ ( class(quaternion), intent(in)  self,
real(preal), intent(in)  expon 
)
private

raise to the power of a scalar

Definition at line 313 of file quaternions.f90.

Referenced by quaternions::quaternion::operator().

+ Here is the caller graph for this function:

◆ quaternions_init()

subroutine, public quaternions::quaternions_init

do self test

Definition at line 117 of file quaternions.f90.

References io::unittest().

Referenced by rotations::rotations_init().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ real__()

pure real(preal) function quaternions::real__ ( class(quaternion), intent(in)  self)
private

real part (scalar)

Definition at line 427 of file quaternions.f90.

◆ sub__()

type(quaternion) elemental pure function quaternions::sub__ ( class(quaternion), intent(in)  self,
class(quaternion), intent(in)  other 
)
private

subtract a quaternion

Definition at line 197 of file quaternions.f90.

Referenced by quaternions::quaternion::operator().

+ Here is the caller graph for this function:

◆ unittest()

subroutine quaternions::unittest
private

check correctness of some quaternions functions

Definition at line 465 of file quaternions.f90.

References inverse().

+ Here is the call graph for this function:

Variable Documentation

◆ p

real(preal), parameter, public quaternions::p = -1.0_pReal