![]() |
|
High-precision calculations for one- and two-valence atomic systems
|
Radial Dirac spinor matrix.
Designed to store Greens-function like operators: \( \ket{F_a}\bra{F_b} \) (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.
\[ \begin{align} G &= \begin{pmatrix} G_{ff} & G_{fg} \\ G_{gf} & G_{gg} \end{pmatrix},\\ G F &= \begin{pmatrix} G_{ff} & G_{fg} \\ G_{gf} & G_{gg} \end{pmatrix} \begin{pmatrix} f \\ g \end{pmatrix} = \begin{pmatrix} G_{ff}(r,r')\,f(r') + G_{fg}(r,r')\,g(r') \\ G_{gf}(r,r')\,f(r') + G_{gg}(r,r')\,g(r') \end{pmatrix}. \end{align} \]
Careful to distinguish SpinorMatrix multiplication/integration:
\[ \begin{align} G_1 * G_2 &= \int G_1(r_a,r_b)\,G_2(r_b,r_c) = \sum_j G_1(i,j)\,G_2(j,k),\\ G_1.{\rm drj}() * G_2 &= \int G_1(r_a,r_b)\,G_2(r_b,r_c)\,dr_b = \sum_j G_1(i,j)\,G_2(j,k)\,dr_j = G_1 * G_2.{\rm dri}(), \end{align} \]
where \( dr_j = (dr/du)_j \times du \times {\rm stride} \) (see dr()).
While almost always symmetric, this doesn't assume that.
#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) | |
| Constructs a zero matrix on the given radial sub-grid. | |
| 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 matrices | |
| 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 () |
| LinAlg::Matrix< T > & | sp (std::size_t mu, std::size_t nu) |
| Spinor block by index: 0 = f, 1 = g. | |
| const LinAlg::Matrix< T > & | sp (std::size_t mu, std::size_t nu) const |
| Spinor block by index: 0 = f, 1 = g (const) | |
| std::size_t | size () const |
| Number of sub-grid points (dimension of each block) | |
| std::size_t | g_size () const |
| Dimension of the g blocks: size(), or 0 if g parts are not included. | |
| bool | includes_g () const |
| True if g parts (fg, gf, gg) are included. | |
| std::size_t | i0 () const |
| Full-grid index of the first sub-grid point. | |
| std::size_t | stride () const |
| Sub-grid stride: every stride-th point of the full grid. | |
| 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 addition +,-. | |
| SpinorMatrix< T > & | operator-= (const SpinorMatrix< T > &rhs) |
| Matrix addition +,- (see operator+= for matrices without g parts) | |
| SpinorMatrix< T > & | operator*= (const T x) |
| Scalar multiplication. | |
| SpinorMatrix< T > & | operator+= (T aI) |
| Addition of identity: Matrix<T> += T : T assumed to be *Identity! | |
| SpinorMatrix< T > & | operator-= (T aI) |
| Addition 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. | |
Friends | |
| SpinorMatrix< T > | operator+ (SpinorMatrix< T > lhs, const SpinorMatrix< T > &rhs) |
| Matrix addition +,-. | |
| SpinorMatrix< T > | operator- (SpinorMatrix< T > lhs, const SpinorMatrix< T > &rhs) |
| Matrix addition +,-. | |
| SpinorMatrix< T > | operator* (const T x, SpinorMatrix< T > rhs) |
| Scalar multiplication. | |
| SpinorMatrix< T > | operator+ (SpinorMatrix< T > M, T aI) |
| Addition of identity: Matrix<T> + T : T assumed to be *Identity! | |
| SpinorMatrix< T > | operator- (SpinorMatrix< T > M, T aI) |
| Addition of identity: Matrix<T> - T : T assumed to be *Identity! | |
| SpinorMatrix< T > | operator* (const SpinorMatrix< T > &a, const SpinorMatrix< T > &b) |
| Matrix multiplication. | |
| 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) |
|
inline |
Constructs a zero matrix on the given radial sub-grid.
Sub-grid point i is full-grid point i0 + i*stride (see index_to_fullgrid). The last sub-grid point must lie on the full grid (checked by assert).
| i0 | Full-grid index of the first sub-grid point |
| stride | Sub-grid stride: every stride-th point of the full grid |
| size | Number of sub-grid points (each block is size*size) |
| incl_g | Include the g blocks (fg, gf, gg) |
| rgrid | Full radial grid |
|
inline |
direct access to matrix elements
|
inline |
direct access to matrices
|
inline |
Spinor block by index: 0 = f, 1 = g.
(mu, nu) = (0, 0): ff; (0, 1): fg; (1, 0): gf; (1, 1): gg.
mu and nu must be 0 or 1; aborts otherwise.
|
inline |
Spinor block by index: 0 = f, 1 = g (const)
|
inline |
Number of sub-grid points (dimension of each block)
|
inline |
Dimension of the g blocks: size(), or 0 if g parts are not included.
|
inline |
True if g parts (fg, gf, gg) are included.
|
inline |
Full-grid index of the first sub-grid point.
|
inline |
Sub-grid stride: every stride-th point of the full grid.
|
inline |
Sets all matrix elements to zero.
|
inline |
Kills g parts of spinor matrix, in place!
|
inline |
Creates g parts of spinor matrix - will have value 0.
|
inline |
Matrix addition +,-.
A matrix without g parts is treated as having zero g parts: adding one to a matrix with g parts leaves its g parts unchanged; adding a matrix with g parts to one without creates them.
|
inline |
Matrix addition +,- (see operator+= for matrices without g parts)
|
inline |
Scalar multiplication.
|
inline |
Addition of identity: Matrix<T> += T : T assumed to be *Identity!
|
inline |
Addition of identity: Matrix<T> -= T : T assumed to be *Identity!
|
inline |
Multiply elements (in place): Gij -> Gij*Bij.
|
inline |
Multiply elements (in place): Gij -> Gij*Bij.
|
inline |
Returns conjugate of matrix.
|
inline |
Returns real part of complex matrix (changes type; returns a real matrix)
|
inline |
Returns imag part of complex matrix (changes type; returns a real matrix)
|
inline |
Converts a real to complex matrix (changes type; returns a complex matrix)
|
inline |
Inversion (in place)
|
inline |
Returns inverse of matrix; original matrix unchanged.
|
inline |
Multiplies by drj: Q_ij -> Q_ij*dr_j, in place.
|
inline |
Multiplies by dri: Q_ij -> Q_ij*dr_i, in place.
|
inline |
Multiplies by drj: Q_ij -> Q_ij*dr_j. Returns new matrix (orig unchanged)
|
inline |
Multiplies by dri: Q_ij -> Q_ij*dr_i. Returns new matrix (orig unchanged)
|
inline |
returns dr at position along sub grid
|
inline |
Converts an index on the sub-grid to the full grid.
|
inline |
Adds k*|ket><bra| to matrix (used for building Green's functions)
|
inline |
Action of SpinorMatrix operator on DiracSpinor.
Assumes matrix already includes integration measure. Formed on the sub-grid, then interpolated onto the full grid of Fn. Result is zero outside the sub-grid.
Fn is not used).
|
friend |
Matrix addition +,-.
|
friend |
Matrix addition +,-.
|
friend |
Scalar multiplication.
|
friend |
Addition of identity: Matrix<T> + T : T assumed to be *Identity!
|
friend |
Addition of identity: Matrix<T> - T : T assumed to be *Identity!
|
friend |
Matrix multiplication.
\( C=A\times B \equiv C_{ij} = \sum_k A_{ik}\,B_{kj}, \) including the sum over spinor blocks (e.g., ff = a.ff*b.ff + a.fg*b.gf).
A matrix without g parts is treated as having zero g parts (as in operator+=); the result includes g parts if either a or b does.
|
friend |
Multiply elements (new matrix): Gij = Aij*Bij.
|
friend |
Multiply elements (new matrix): Gij = Aij*Bij.
|
friend |
Multiply elements (new matrix): Gij = Aij*Bij.