Classes | Public Member Functions | Static Public Member Functions | List of all members
hanalysis::stafield< T > Class Template Reference

represents spherical tensor fields (CPU version) More...

#include <stafield.h>

Inheritance diagram for hanalysis::stafield< T >:
hanalysis::_stafield< T >

Classes

class  fspecial_Exp
 
class  fspecial_Invert
 
class  fspecial_Pow
 
class  fspecial_Sqrt
 

Public Member Functions

stafieldoperator= (const stafield &f)
 
stafieldoperator+= (const stafield &a)
 
stafieldoperator-= (const stafield &a)
 
stafieldoperator*= (std::complex< T > alpha)
 
stafieldoperator/= (std::complex< T > alpha)
 
const stafield operator+ (const stafield &a) const
 
const stafield operator- (const stafield &a) const
 
const stafield operator* (std::complex< T > alpha) const
 
const stafield operator/ (std::complex< T > alpha) const
 
stafield operator[] (int l) const
 
 stafield (const std::size_t shape[], int L, hanalysis::STA_FIELD_STORAGE field_storage=hanalysis::STA_FIELD_STORAGE_R, hanalysis::STA_FIELD_TYPE field_type=hanalysis::STA_OFIELD_SINGLE, const T element_size[]=NULL)
 
 stafield (std::string kernelname, const std::size_t shape[], std::vector< T > param_v, bool centered=false, int L=0, hanalysis::STA_FIELD_STORAGE field_storage=hanalysis::STA_FIELD_STORAGE_R, const T element_size[]=NULL)
 
 stafield (const std::size_t shape[], int L, hanalysis::STA_FIELD_STORAGE field_storage, hanalysis::STA_FIELD_TYPE field_type, std::complex< T > *data, std::size_t stride=0, const T element_size[]=NULL)
 
bool createMemCopy ()
 
std::complex< T > * getData ()
 
const std::complex< T > * getDataConst () const
 
stafield get (int l) const
 
stafield fft (bool forward, bool conjugate=false, std::complex< T > alpha=T(1), int flag=0) const
 see FFT
 
stafield convolve (stafield &b, int J=0, int flag=0)
 see FFT
 
stafield mult (std::complex< T > alpha=T(1), bool conjugate=false) const
 see Mult
 
stafield norm () const
 see Norm
 
stafield deriv (int J, bool conjugate=false, std::complex< T > alpha=T(1), int accuracy=0) const
 see Deriv
 
stafield deriv2 (int J, bool conjugate=false, std::complex< T > alpha=T(1), int accuracy=0) const
 see Deriv2
 
stafield lap (std::complex< T > alpha=T(1), int type=1) const
 see Lap
 
stafield prod (const stafield &b, int J, bool normalize=false, std::complex< T > alpha=T(1)) const
 see Prod
 
stafield exp (std::complex< T > value=T(1)) const
 exp, component by component
 
stafield sqrt () const
 sqrt, component by component
 
stafield pow (T v=T(1)) const
 pow, component by component
 
stafield invert (T v=std::numeric_limits< T >::epsilon()) const
 invert, component by component
 
- Public Member Functions inherited from hanalysis::_stafield< T >
bool operator== (const _stafield &field) const
 
bool operator!= (const _stafield &field) const
 
const std::size_t * getShape () const
 
bool ownMemory () const
 
int getRank () const
 

Static Public Member Functions

static void FFT (const stafield &stIn, stafield &stOut, bool forward, bool conjugate=false, std::complex< T > alpha=T(1), int flag=0)
 tensor fft component by component More...
 
static void Mult (const stafield &stIn, stafield &stOut, std::complex< T > alpha=T(1), bool conjugate=false, bool clear_result=false)
 computes $ \alpha(\mathbf{stIn}) $ More...
 
static void Norm (const stafield &stIn, stafield &stOut, bool clear_result=false)
 returns lengths of vectors component by compnent
More...
 
static void Deriv (const stafield &stIn, stafield &stOut, int Jupdown, bool conjugate=false, std::complex< T > alpha=T(1), bool clear_result=false, int accuracy=0)
 spherical tensor derivative: $ \alpha( {\nabla} \bullet_{(J+b)} \mathbf{stIn}) , b \in \{-1,0,1\} $ More...
 
static void Deriv2 (const stafield &stIn, stafield &stOut, int Jupdown, bool conjugate=false, std::complex< T > alpha=T(1), bool clear_result=false)
 spherical tensor double-derivative: $ \alpha(({\nabla} \bullet_{2} {\nabla}) \bullet_{(J+b)} \mathbf{stIn}), b \in \{-2,0,2\} $ More...
 
static void Lap (const stafield &stIn, stafield &stOut, std::complex< T > alpha=T(1), bool clear_result=false, int type=1)
 Laplacian: $ \alpha\triangle(\mathbf{stIn}) \in \mathcal T_{J}$. More...
 
static void Prod (const stafield &stIn1, const stafield &stIn2, stafield &stOut, int J, bool normalize=false, std::complex< T > alpha=T(1), bool clear_result=false)
 spherical tensor product: $ \alpha(\mathbf{stIn1} \circ_{J} \mathbf{stIn2}) $ and $ \alpha(\mathbf{stIn1} \bullet_{J} \mathbf{stIn2}) $, respectively
More...
 

Additional Inherited Members

- Protected Attributes inherited from hanalysis::_stafield< T >
std::size_t shape [3]
 image shape
 
hanalysis::STA_FIELD_STORAGE field_storage
 must be either STA_FIELD_STORAGE_C, STA_FIELD_STORAGE_R or STA_FIELD_STORAGE_RF
 
hanalysis::STA_FIELD_TYPE field_type
 must be either STA_OFIELD_SINGLE, STA_OFIELD_FULL, STA_OFIELD_EVEN or STA_OFIELD_ODD
 
int L
 tensor rank $ \mathbf{stafield} \in \mathcal T_{L}$
 

Detailed Description

template<typename T>
class hanalysis::stafield< T >

represents spherical tensor fields (CPU version)

Constructor & Destructor Documentation

template<typename T >
hanalysis::stafield< T >::stafield ( const std::size_t  shape[],
int  L,
hanalysis::STA_FIELD_STORAGE  field_storage = hanalysis::STA_FIELD_STORAGE_R,
hanalysis::STA_FIELD_TYPE  field_type = hanalysis::STA_OFIELD_SINGLE,
const T  element_size[] = NULL 
)
inline

creates a spherical tensor field of order $ L \in \mathbb N $

Parameters
shape
L$ L \in \mathbb N $, the tensor rank
template<typename T >
hanalysis::stafield< T >::stafield ( std::string  kernelname,
const std::size_t  shape[],
std::vector< T >  param_v,
bool  centered = false,
int  L = 0,
hanalysis::STA_FIELD_STORAGE  field_storage = hanalysis::STA_FIELD_STORAGE_R,
const T  element_size[] = NULL 
)
inline

creates a convolution kernel of order $ L \in \mathbb N $

Parameters
kernelnameeither "gauss","gaussLaguerre" or "gaussBessel"
shape
paramsparameter vector [sigma],[sigma,n] or [sigma,k,s]
centered$ \in \{0,1\} $
L$ L \in \mathbb N $, the tensor rank
template<typename T >
hanalysis::stafield< T >::stafield ( const std::size_t  shape[],
int  L,
hanalysis::STA_FIELD_STORAGE  field_storage,
hanalysis::STA_FIELD_TYPE  field_type,
std::complex< T > *  data,
std::size_t  stride = 0,
const T  element_size[] = NULL 
)
inline

creates a spherical tensor field of order $ L \in \mathbb N $
based on existing data. No memory is allocated yet.

Parameters
shape
L$ L \in \mathbb N $, the tensor rank
datapointer to existing memory

Member Function Documentation

template<typename T >
bool hanalysis::stafield< T >::createMemCopy ( )
inline

ensures that the objects has allocated its own memory

Returns
false if objects has already allocated its own memory
template<typename T >
static void hanalysis::stafield< T >::Deriv ( const stafield< T > &  stIn,
stafield< T > &  stOut,
int  Jupdown,
bool  conjugate = false,
std::complex< T >  alpha = T( 1 ),
bool  clear_result = false,
int  accuracy = 0 
)
inlinestatic

spherical tensor derivative: $ \alpha( {\nabla} \bullet_{(J+b)} \mathbf{stIn}) , b \in \{-1,0,1\} $

computes the spherical tensor derivative of $ \mathbf{stIn} \in \mathcal T_{J}$

Parameters
stIn$ \mathbf{stIn} \in \mathcal T_{J}$
stOut$ \mathbf{stOut} \in \mathcal T_{(J+Jupdown)}$, the spherical tensor derivative of $ \mathbf{stIn} $
Jupdown$ \left\{ \begin{array}{ll} \mathbf{stOut}=\alpha({\nabla} \bullet_{(J+1)} \mathbf{stIn}), & \mbox{ if } Jupdown=1\\ \mathbf{stOut}=\alpha({\nabla} \circ_{J} \mathbf{stIn}), & \mbox{ if } Jupdown=0\\ \mathbf{stOut}=\alpha({\nabla} \bullet_{(J-1)} \mathbf{stIn}), & \mbox{ if } Jupdown=-1 \end{array} \right. $
conjugateif conjugate=true the conjugate operator $ \overline{{\nabla}} $ is used
alpha$ \alpha \in \mathbb C $ additional weighting factor
Returns
$ \left\{ \begin{array}{ll} J+Jupdown & \mbox{if derivative exists}\\ -1 & \mbox{ else } \end{array} \right. $
Warning
if not STA_FIELD_STORAGE_C then alpha must be real valued
template<typename T >
static void hanalysis::stafield< T >::Deriv2 ( const stafield< T > &  stIn,
stafield< T > &  stOut,
int  Jupdown,
bool  conjugate = false,
std::complex< T >  alpha = T( 1 ),
bool  clear_result = false 
)
inlinestatic

spherical tensor double-derivative: $ \alpha(({\nabla} \bullet_{2} {\nabla}) \bullet_{(J+b)} \mathbf{stIn}), b \in \{-2,0,2\} $

computes the spherical tensor double-derivative of $ \mathbf{stIn} \in \mathcal T_{J}$

Parameters
stIn$ \mathbf{stIn} \in \mathcal T_{J}$
stOut$ \mathbf{stOut} \in \mathcal T_{(J+Jupdown)}$, the spherical tensor double-derivative of $ \mathbf{stIn} $
Jupdown$ \left\{ \begin{array}{ll} \mathbf{stOut}=\alpha(({\nabla} \bullet_{2} {\nabla}) \bullet_{(J+2)} \mathbf{stIn}), & \mbox{ if } Jupdown=2\\ \mathbf{stOut}=\alpha(({\nabla} \bullet_{2} {\nabla}) \bullet_{J} \mathbf{stIn}), & \mbox{ if } Jupdown=0\\ \mathbf{stOut}=\alpha(({\nabla} \bullet_{2} {\nabla}) \bullet_{(J-2)} \mathbf{stIn}), & \mbox{ if } Jupdown=-2 \end{array} \right. $
conjugateif conjugate=true the conjugate operator $ \overline{{\nabla}} $ is used
alpha$ \alpha \in \mathbb C $ additional weighting factor
Returns
$ \left\{ \begin{array}{ll} J+Jupdown & \mbox{if derivative exists}\\ -1 & \mbox{ else } \end{array} \right. $
Warning
if not STA_FIELD_STORAGE_C then alpha must be real valued
template<typename T >
static void hanalysis::stafield< T >::FFT ( const stafield< T > &  stIn,
stafield< T > &  stOut,
bool  forward,
bool  conjugate = false,
std::complex< T >  alpha = T( 1 ),
int  flag = 0 
)
inlinestatic

tensor fft component by component

transforms a spherical tensor field $ \mathbf{stIn} \in \mathcal T_{J}$ into Fourier domain (and back)

Parameters
stIn$ \mathbf{stIn} \in \mathcal T_{J}$
stOut$ \mathbf{stOut} \in \mathcal T_{J}$
forward$ \left\{ \begin{array}{ll} \mathbf{stOut}=\alpha\mathcal F (\mathbf{stIn}) & \mbox{ if } forward=true \\ \mathbf{stOut}=\alpha\mathcal F^{-1} (\mathbf{stIn}) & \mbox{ if } forward=false \end{array} \right. $
conjugateif true it computes $ \alpha\overline{\mathcal F (\mathbf{stIn})} $ and $ \alpha\overline{\mathcal F^{-1} (\mathbf{stIn})} $, respectively
alpha$ \alpha \in \mathbb C $ additional weighting factor
Warning
Consider that $ \frac{\mathcal F^{-1}(\mathcal F (\mathbf{stIn}))}{shape[0] \cdot shape[1] \cdot shape[2]}=\mathbf{stIn} $ !!
template<typename T >
stafield hanalysis::stafield< T >::get ( int  l) const
inline
Returns
a view on the (sub) component $ l $ with the
tensor rank $ l \in \mathbb N $ of an orientation tensor field
template<typename T >
std::complex<T>* hanalysis::stafield< T >::getData ( )
inline
Returns
data pointer
template<typename T >
const std::complex<T>* hanalysis::stafield< T >::getDataConst ( ) const
inline
Returns
constant data pointer
template<typename T >
static void hanalysis::stafield< T >::Lap ( const stafield< T > &  stIn,
stafield< T > &  stOut,
std::complex< T >  alpha = T( 1 ),
bool  clear_result = false,
int  type = 1 
)
inlinestatic

Laplacian: $ \alpha\triangle(\mathbf{stIn}) \in \mathcal T_{J}$.

computes the Laplacian of $ \mathbf{stIn} \in \mathcal T_{J}$ component by component

Parameters
stIn$ \mathbf{stIn} \in \mathcal T_{J}$
stOut$ \alpha\triangle(\mathbf{stIn}) \in \mathcal T_{J}$
shape
components$ components \in \mathbb N_{>0} $ number of tensor components of the input field $ \mathbf{stIn} $
typeif type=1 the standard 6 neighbours operator is used, if type=0 a 18 neighbours operator is used
alpha$ \alpha \in \mathbb C $ additional weighting factor
template<typename T >
static void hanalysis::stafield< T >::Mult ( const stafield< T > &  stIn,
stafield< T > &  stOut,
std::complex< T >  alpha = T( 1 ),
bool  conjugate = false,
bool  clear_result = false 
)
inlinestatic

computes $ \alpha(\mathbf{stIn}) $

multiplication with a scalar: $ \alpha(\mathbf{stIn}) $

Parameters
stIn$ \mathbf{stIn1} \in \mathcal T_{J}$
stOut$ \alpha(\mathbf{stIn}) \in \mathcal T_{J} $
alpha$ \alpha \in \mathbb C $ weighting factor
conjugatereturns $ \alpha(\overline{\mathbf{stIn}})$ if true
template<typename T >
static void hanalysis::stafield< T >::Norm ( const stafield< T > &  stIn,
stafield< T > &  stOut,
bool  clear_result = false 
)
inlinestatic

returns lengths of vectors component by compnent

Parameters
stIn$ \mathbf{stIn1} \in \mathcal T_{J}$
stOut$ \alpha(\mathbf{stIn}) \in \mathcal T_{0} $
template<typename T >
const stafield hanalysis::stafield< T >::operator* ( std::complex< T >  alpha) const
inline

$ \mathbf{result}:=\mathbf{stafield}+\mathbf{a}$
$ \mathbf{stafield},\mathbf{a} \in \mathcal T_{J}$

template<typename T >
stafield& hanalysis::stafield< T >::operator*= ( std::complex< T >  alpha)
inline

$ \mathbf{stafield}:=\alpha \mathbf{stafield} $
$ \mathbf{stafield} \in \mathcal T_{J}, \alpha \in \mathbb C $

template<typename T >
const stafield hanalysis::stafield< T >::operator+ ( const stafield< T > &  a) const
inline

$ \mathbf{result}:=\mathbf{stafield}+\mathbf{a}$
$ \mathbf{stafield},\mathbf{a} \in \mathcal T_{J}$

template<typename T >
stafield& hanalysis::stafield< T >::operator+= ( const stafield< T > &  a)
inline

$ \mathbf{stafield}:=\mathbf{stafield}+\mathbf{a}$
$ \mathbf{stafield},\mathbf{a} \in \mathcal T_{J}$

template<typename T >
const stafield hanalysis::stafield< T >::operator- ( const stafield< T > &  a) const
inline

$ \mathbf{result}:=\mathbf{stafield}-\mathbf{a}$
$ \mathbf{stafield},\mathbf{a} \in \mathcal T_{J}$

template<typename T >
stafield& hanalysis::stafield< T >::operator-= ( const stafield< T > &  a)
inline

$ \mathbf{stafield}:=\mathbf{stafield}-\mathbf{a}$
$ \mathbf{stafield},\mathbf{a} \in \mathcal T_{J}$

template<typename T >
const stafield hanalysis::stafield< T >::operator/ ( std::complex< T >  alpha) const
inline

$ \mathbf{result}:=\mathbf{stafield}+\mathbf{a}$
$ \mathbf{stafield},\mathbf{a} \in \mathcal T_{J}$

template<typename T >
stafield& hanalysis::stafield< T >::operator/= ( std::complex< T >  alpha)
inline

$ \mathbf{stafield}:=\frac{\mathbf{stafield}}{\alpha} $
$ \mathbf{stafield} \in \mathcal T_{J}, \alpha \in \mathbb C $

template<typename T >
stafield& hanalysis::stafield< T >::operator= ( const stafield< T > &  f)
inline

$ \mathbf{stafield}:=\mathbf{f}, ~~ \mathbf{stafield},\mathbf{f} \in \mathcal T_{J}$ . Allocates new memory only when necessary

template<typename T >
stafield hanalysis::stafield< T >::operator[] ( int  l) const
inline
Returns
a view on the (sub) component $ l $ with the
tensor rank $ l \in \mathbb N $ of an orientation tensor field
template<typename T >
static void hanalysis::stafield< T >::Prod ( const stafield< T > &  stIn1,
const stafield< T > &  stIn2,
stafield< T > &  stOut,
int  J,
bool  normalize = false,
std::complex< T >  alpha = T( 1 ),
bool  clear_result = false 
)
inlinestatic

spherical tensor product: $ \alpha(\mathbf{stIn1} \circ_{J} \mathbf{stIn2}) $ and $ \alpha(\mathbf{stIn1} \bullet_{J} \mathbf{stIn2}) $, respectively

computes the spherical tensor product $ \alpha(\mathbf{stIn1} \circ_{J} \mathbf{stIn2}) $ and $ \alpha(\mathbf{stIn1} \bullet_{J} \mathbf{stIn2}) $, respectively

Parameters
stIn1$ \mathbf{stIn1} \in \mathcal T_{J_1}$
stIn2$ \mathbf{stIn2} \in \mathcal T_{J_2} $
stOut$ \alpha(\mathbf{stIn1} \bullet_{J} \mathbf{stIn2}) \in \mathcal T_{J}$ if normalized, $ \alpha(\mathbf{stIn1} \circ_{J} \mathbf{stIn2}) \in \mathcal T_{J}$ else
J$ J \in \mathbb N $ tensor rank of the resulting field
normalizenormalized tensor products?: true= $ \bullet_{J}$ , false= $ \circ_{J}$
alpha$ \alpha \in \mathbb C $ additional weighting factor
Returns
$ \left\{ \begin{array}{ll} 0 & \mbox{if tensor product exists}\\ -1 & \mbox{ else } \end{array} \right. $
Warning
If field_property= STA_FIELD_STORAGE_R and $ (J_1+J2+J)\%2 \neq 0 $ the function returns
$ (\mathit{i})\alpha(\mathbf{stIn1} \circ_{J} \mathbf{stIn2}) \in \mathcal T_{J}$. This ensures that STA_FIELD_STORAGE_R holds for $ \mathbf{stOut} $, too.
The same is true for field_property= STA_FIELD_STORAGE_RF
if not STA_FIELD_STORAGE_C then alpha must be real valued

The documentation for this class was generated from the following file: