ampsci
High-precision calculations for one- and two-valence atomic systems
Loading...
Searching...
No Matches
MBPT::SpinorMatrix< T >

#include <SpinorMatrix.hpp>

Public Member Functions

 SpinorMatrix (std::size_t i0, std::size_t stride, std::size_t size, bool incl_g, std::shared_ptr< const Grid > rgrid)
 
T & ff (std::size_t i, std::size_t j)
 direct access to matrix elements
 
T & fg (std::size_t i, std::size_t j)
 
T & gf (std::size_t i, std::size_t j)
 
T & gg (std::size_t i, std::size_t j)
 
const T ff (std::size_t i, std::size_t j) const
 
const T fg (std::size_t i, std::size_t j) const
 
const T gf (std::size_t i, std::size_t j) const
 
const T gg (std::size_t i, std::size_t j) const
 
const LinAlg::Matrix< T > & ff () const
 direct access to matrix's
 
const LinAlg::Matrix< T > & fg () const
 
const LinAlg::Matrix< T > & gf () const
 
const LinAlg::Matrix< T > & gg () const
 
LinAlg::Matrix< T > & ff ()
 
LinAlg::Matrix< T > & fg ()
 
LinAlg::Matrix< T > & gf ()
 
LinAlg::Matrix< T > & gg ()
 
std::size_t size () const
 
std::size_t g_size () const
 
bool includes_g () const
 
std::size_t i0 () const
 
std::size_t stride () const
 
void zero ()
 Sets all matrix elements to zero.
 
SpinorMatrix< T > & drop_g ()
 Kills g parts of spinor matrix, in place!
 
SpinorMatrix< T > & create_g ()
 Creates g parts of spinor matrix - will have value 0.
 
SpinorMatrix< T > & operator+= (const SpinorMatrix< T > &rhs)
 Matrix adition +,-.
 
SpinorMatrix< T > & operator-= (const SpinorMatrix< T > &rhs)
 Matrix adition +,-.
 
SpinorMatrix< T > & operator*= (const T x)
 Scalar multiplication.
 
SpinorMatrix< T > & operator+= (T aI)
 Adition of identity: Matrix<T> += T : T assumed to be *Identity!
 
SpinorMatrix< T > & operator-= (T aI)
 Adition of identity: Matrix<T> -= T : T assumed to be *Identity!
 
SpinorMatrix< T > & mult_elements_by (const SpinorMatrix< T > &rhs)
 Multiply elements (in place): Gij -> Gij*Bij.
 
SpinorMatrix< T > & mult_elements_by (const RadialMatrix< T > &rhs)
 Multiply elements (in place): Gij -> Gij*Bij.
 
SpinorMatrix< T > conj () const
 Returns conjugate of matrix.
 
SpinorMatrix< double > real () const
 Returns real part of complex matrix (changes type; returns a real matrix)
 
SpinorMatrix< double > imag () const
 Returns imag part of complex matrix (changes type; returns a real matrix)
 
SpinorMatrix< std::complex< double > > complex () const
 Converts a real to complex matrix (changes type; returns a complex matrix)
 
SpinorMatrix< T > & invert_in_place ()
 Inversion (in place)
 
SpinorMatrix< T > inverse () const
 Returns inverse of matrix; original matrix unchanged.
 
SpinorMatrix< T > & drj_in_place ()
 Multiplies by drj: Q_ij -> Q_ij*dr_j, in place.
 
SpinorMatrix< T > & dri_in_place ()
 Multiplies by dri: Q_ij -> Q_ij*dr_i, in place.
 
SpinorMatrix< T > drj () const
 Multiplies by drj: Q_ij -> Q_ij*dr_j. Returns new matrix (orig unchanged)
 
SpinorMatrix< T > dri () const
 Multiplies by dri: Q_ij -> Q_ij*dr_i. Returns new matrix (orig unchanged)
 
double dr (std::size_t sub_index) const
 returns dr at position along sub grid
 
std::size_t index_to_fullgrid (std::size_t i) const
 Converts an index on the sub-grid to the full grid.
 
void add (const DiracSpinor &ket, const DiracSpinor &bra, T k=T(1.0))
 Adds k*|ket><bra| to matrix (used for building Green's functions)
 
DiracSpinor operator* (const DiracSpinor &Fn) const
 Action of SpinorMatrix operator on DiracSpinor. Inludes Integration: G*F = Int[G(r,r')*F(r') dr'] = sum_j G_ij*F_j*drdu_j*du.
 

Friends

SpinorMatrix< T > operator+ (SpinorMatrix< T > lhs, const SpinorMatrix< T > &rhs)
 Matrix adition +,-.
 
SpinorMatrix< T > operator- (SpinorMatrix< T > lhs, const SpinorMatrix< T > &rhs)
 Matrix adition +,-.
 
SpinorMatrix< T > operator* (const T x, SpinorMatrix< T > rhs)
 Scalar multiplication.
 
SpinorMatrix< T > operator+ (SpinorMatrix< T > M, T aI)
 Adition of identity: Matrix<T> + T : T assumed to be *Identity!
 
SpinorMatrix< T > operator- (SpinorMatrix< T > M, T aI)
 Adition of identity: Matrix<T> - T : T assumed to be *Identity!
 
SpinorMatrix< T > operator* (const SpinorMatrix< T > &a, const SpinorMatrix< T > &b)
 Matrix multplication: \( C=A\times B \equiv C_{ij} = \sum_k A_{ik}\,B_{kj}. \) Note: integration measure not automatically included: call .drj() first to include it!
 
SpinorMatrix< T > mult_elements (SpinorMatrix< T > lhs, const SpinorMatrix< T > &rhs)
 Multiply elements (new matrix): Gij = Aij*Bij.
 
SpinorMatrix< T > mult_elements (SpinorMatrix< T > lhs, const RadialMatrix< T > &rhs)
 Multiply elements (new matrix): Gij = Aij*Bij.
 
SpinorMatrix< T > mult_elements (const RadialMatrix< T > &rhs, SpinorMatrix< T > lhs)
 Multiply elements (new matrix): Gij = Aij*Bij.
 
std::ostream & operator<< (std::ostream &os, const SpinorMatrix< T > &a)
 

Detailed Description

template<typename T>
class MBPT::SpinorMatrix< T >

Defines SpinorMatrix, Radial Dirac Spinor matrix. Designed to store Greens-function like operators: |Fa><Fb| (where Fa, Fb are radial Dirac spinors), as a radial matrix. The matrix is stored on a sub-grid (between r0 and rmax), with a specified stride.

SpinorMatrix is a 2*2 matrix in spinor space {ff, fg, gf, gg} - the g blocks are small and are optional. Each block is an N*N radial matrix, where N is a subset of the number of points along the full radial grid. May store doubles or complex doubles.

SpinorMatrix = {ff fg} {gf gg} SpinorMatrix * F = {ff fg} * (f) {gf gg} (g) = (ff(r,r')*f(r') + fg(r,r')*g(r')) (gf(r,r')*f(r') + gg(r,r')*g(r'))

Note: Careful to distinguish SpinorMatrix multiplication/integration: G1 * G2 = Int G1(ra,rb)*G2(rb,rc) = Sum_j G1(i,j)*G2(j,k)

G1.drj() * G2 = Int G1(ra,rb)*G2(rb,rc)*dr_b = Sum_j G1(i,j)*G2(j,k)*drdu_j*du = G1 * G2.dri()

While almost always symmetric, this doesn't assume that.

Member Function Documentation

◆ ff() [1/2]

template<typename T >
T & MBPT::SpinorMatrix< T >::ff ( std::size_t  i,
std::size_t  j 
)
inline

direct access to matrix elements

◆ ff() [2/2]

template<typename T >
const LinAlg::Matrix< T > & MBPT::SpinorMatrix< T >::ff ( ) const
inline

direct access to matrix's

◆ zero()

template<typename T >
void MBPT::SpinorMatrix< T >::zero ( )
inline

Sets all matrix elements to zero.

◆ drop_g()

template<typename T >
SpinorMatrix< T > & MBPT::SpinorMatrix< T >::drop_g ( )
inline

Kills g parts of spinor matrix, in place!

◆ create_g()

template<typename T >
SpinorMatrix< T > & MBPT::SpinorMatrix< T >::create_g ( )
inline

Creates g parts of spinor matrix - will have value 0.

◆ operator+=() [1/2]

template<typename T >
SpinorMatrix< T > & MBPT::SpinorMatrix< T >::operator+= ( const SpinorMatrix< T > &  rhs)
inline

Matrix adition +,-.

◆ operator-=() [1/2]

template<typename T >
SpinorMatrix< T > & MBPT::SpinorMatrix< T >::operator-= ( const SpinorMatrix< T > &  rhs)
inline

Matrix adition +,-.

◆ operator*=()

template<typename T >
SpinorMatrix< T > & MBPT::SpinorMatrix< T >::operator*= ( const T  x)
inline

Scalar multiplication.

◆ operator+=() [2/2]

template<typename T >
SpinorMatrix< T > & MBPT::SpinorMatrix< T >::operator+= ( aI)
inline

Adition of identity: Matrix<T> += T : T assumed to be *Identity!

◆ operator-=() [2/2]

template<typename T >
SpinorMatrix< T > & MBPT::SpinorMatrix< T >::operator-= ( aI)
inline

Adition of identity: Matrix<T> -= T : T assumed to be *Identity!

◆ mult_elements_by() [1/2]

template<typename T >
SpinorMatrix< T > & MBPT::SpinorMatrix< T >::mult_elements_by ( const SpinorMatrix< T > &  rhs)
inline

Multiply elements (in place): Gij -> Gij*Bij.

◆ mult_elements_by() [2/2]

template<typename T >
SpinorMatrix< T > & MBPT::SpinorMatrix< T >::mult_elements_by ( const RadialMatrix< T > &  rhs)
inline

Multiply elements (in place): Gij -> Gij*Bij.

◆ conj()

template<typename T >
SpinorMatrix< T > MBPT::SpinorMatrix< T >::conj ( ) const
inline

Returns conjugate of matrix.

◆ real()

template<typename T >
SpinorMatrix< double > MBPT::SpinorMatrix< T >::real ( ) const
inline

Returns real part of complex matrix (changes type; returns a real matrix)

◆ imag()

template<typename T >
SpinorMatrix< double > MBPT::SpinorMatrix< T >::imag ( ) const
inline

Returns imag part of complex matrix (changes type; returns a real matrix)

◆ complex()

template<typename T >
SpinorMatrix< std::complex< double > > MBPT::SpinorMatrix< T >::complex ( ) const
inline

Converts a real to complex matrix (changes type; returns a complex matrix)

◆ invert_in_place()

template<typename T >
SpinorMatrix< T > & MBPT::SpinorMatrix< T >::invert_in_place ( )
inline

Inversion (in place)

◆ inverse()

template<typename T >
SpinorMatrix< T > MBPT::SpinorMatrix< T >::inverse ( ) const
inline

Returns inverse of matrix; original matrix unchanged.

◆ drj_in_place()

template<typename T >
SpinorMatrix< T > & MBPT::SpinorMatrix< T >::drj_in_place ( )
inline

Multiplies by drj: Q_ij -> Q_ij*dr_j, in place.

◆ dri_in_place()

template<typename T >
SpinorMatrix< T > & MBPT::SpinorMatrix< T >::dri_in_place ( )
inline

Multiplies by dri: Q_ij -> Q_ij*dr_i, in place.

◆ drj()

template<typename T >
SpinorMatrix< T > MBPT::SpinorMatrix< T >::drj ( ) const
inline

Multiplies by drj: Q_ij -> Q_ij*dr_j. Returns new matrix (orig unchanged)

◆ dri()

template<typename T >
SpinorMatrix< T > MBPT::SpinorMatrix< T >::dri ( ) const
inline

Multiplies by dri: Q_ij -> Q_ij*dr_i. Returns new matrix (orig unchanged)

◆ dr()

template<typename T >
double MBPT::SpinorMatrix< T >::dr ( std::size_t  sub_index) const
inline

returns dr at position along sub grid

◆ index_to_fullgrid()

template<typename T >
std::size_t MBPT::SpinorMatrix< T >::index_to_fullgrid ( std::size_t  i) const
inline

Converts an index on the sub-grid to the full grid.

◆ add()

template<typename T >
void MBPT::SpinorMatrix< T >::add ( const DiracSpinor ket,
const DiracSpinor bra,
k = T(1.0) 
)
inline

Adds k*|ket><bra| to matrix (used for building Green's functions)

◆ operator*()

template<typename T >
DiracSpinor MBPT::SpinorMatrix< T >::operator* ( const DiracSpinor Fn) const
inline

Action of SpinorMatrix operator on DiracSpinor. Inludes Integration: G*F = Int[G(r,r')*F(r') dr'] = sum_j G_ij*F_j*drdu_j*du.

Friends And Related Symbol Documentation

◆ operator+ [1/2]

template<typename T >
SpinorMatrix< T > operator+ ( SpinorMatrix< T >  lhs,
const SpinorMatrix< T > &  rhs 
)
friend

Matrix adition +,-.

◆ operator- [1/2]

template<typename T >
SpinorMatrix< T > operator- ( SpinorMatrix< T >  lhs,
const SpinorMatrix< T > &  rhs 
)
friend

Matrix adition +,-.

◆ operator* [1/2]

template<typename T >
SpinorMatrix< T > operator* ( const T  x,
SpinorMatrix< T >  rhs 
)
friend

Scalar multiplication.

◆ operator+ [2/2]

template<typename T >
SpinorMatrix< T > operator+ ( SpinorMatrix< T >  M,
aI 
)
friend

Adition of identity: Matrix<T> + T : T assumed to be *Identity!

◆ operator- [2/2]

template<typename T >
SpinorMatrix< T > operator- ( SpinorMatrix< T >  M,
aI 
)
friend

Adition of identity: Matrix<T> - T : T assumed to be *Identity!

◆ operator* [2/2]

template<typename T >
SpinorMatrix< T > operator* ( const SpinorMatrix< T > &  a,
const SpinorMatrix< T > &  b 
)
friend

Matrix multplication: \( C=A\times B \equiv C_{ij} = \sum_k A_{ik}\,B_{kj}. \) Note: integration measure not automatically included: call .drj() first to include it!

◆ mult_elements [1/3]

template<typename T >
SpinorMatrix< T > mult_elements ( SpinorMatrix< T >  lhs,
const SpinorMatrix< T > &  rhs 
)
friend

Multiply elements (new matrix): Gij = Aij*Bij.

◆ mult_elements [2/3]

template<typename T >
SpinorMatrix< T > mult_elements ( SpinorMatrix< T >  lhs,
const RadialMatrix< T > &  rhs 
)
friend

Multiply elements (new matrix): Gij = Aij*Bij.

◆ mult_elements [3/3]

template<typename T >
SpinorMatrix< T > mult_elements ( const RadialMatrix< T > &  rhs,
SpinorMatrix< T >  lhs 
)
friend

Multiply elements (new matrix): Gij = Aij*Bij.


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