TBTK
|
Need a break? Support the development by playing Polarity Puzzles |
Matrix containing information about a spin. More...
#include <SpinMatrix.h>
Public Member Functions | |
SpinMatrix () | |
SpinMatrix (std::complex< double > value) | |
~SpinMatrix () | |
SpinMatrix & | operator= (std::complex< double > value) |
SpinMatrix & | operator+= (const SpinMatrix &spinMatrix) |
SpinMatrix & | operator-= (const SpinMatrix &spinMatrix) |
double | getDensity () const |
Vector3d | getSpinVector () const |
std::string | toString () const |
Public Member Functions inherited from TBTK::Matrix< std::complex< double >, 2, 2 > | |
Matrix () | |
Matrix (const Matrix< std::complex< double >, ROWS, COLS > &matrix) | |
Matrix (Matrix< std::complex< double >, ROWS, COLS > &&matrix) | |
~Matrix () | |
Matrix< std::complex< double >, ROWS, COLS > & | operator= (const Matrix< std::complex< double >, ROWS, COLS > &rhs) |
Matrix< std::complex< double >, ROWS, COLS > & | operator= (Matrix< std::complex< double >, ROWS, COLS > &&rhs) |
const std::complex< double > & | at (unsigned int row, unsigned int col) const |
std::complex< double > & | at (unsigned int row, unsigned int col) |
unsigned int | getNumRows () const |
unsigned int | getNumCols () const |
Friends | |
std::ostream & | operator<< (std::ostream &stream, const SpinMatrix &spinMatrix) |
Matrix containing information about a spin.
The SpinMatrix is a Matrix with DataType std::complex<double>. If the matrix has the form
\[ \frac{1}{2}\left[\begin{array}{cc} \rho + S_z & S_x + iS_y\\ S_x - iS_y & \rho - S_z \end{array}\right] \]
Then the SpinMatrix extends the Matrix with additional functions for extracting the density and spin-vector. Note that the SpinMatrix in principle can contain arbitrary complex entries in each position, but it is then undefined behavior to use any of the SpinMatrix functions. For such matrices, only those methods derived from Matrix<std::complex> should be used.
Note that the convention for the spin matrix is equal to \(\rho + S_x\sigma_x - S_y\sigma_y + S_z\sigma_z\) rather than \(\rho + S_x\sigma_x + S_y\sigma_y + S_z\sigma_z\). The convention follows from the SpinMatrix being used to store values of the form
\[ \left[\begin{array}{cc} \langle c_{\uparrow}^{\dagger}c_{\uparrow}\rangle & \langle c_{\uparrow}^{\dagger}c_{\downarrow}\rangle\\ \langle c_{\downarrow}^{\dagger}c_{\uparrow}\rangle & \langle c_{\downarrow}^{\dagger}c_{\downarrow}\rangle\\ \end{array}\right] \]
and these expectation values are related to \(\rho, S_x, S_y\), and \(S_z\) through
\begin{eqnarray*} \rho &=& \langle c_{\uparrow}^{\dagger}c_{\uparrow}\rangle + \langle c_{\downarrow}^{\dagger}c_{\downarrow}\rangle\\ S_x &=& \langle c_{\uparrow}^{\dagger}c_{\downarrow}\rangle + \langle c_{\downarrow}^{\dagger}c_{\uparrow}\rangle\\ S_y &=& \textrm{Im}\left( \langle c_{\uparrow}^{\dagger}c_{\downarrow}\rangle - \langle c_{\downarrow}^{\dagger}c_{\uparrow}\rangle\right)\\ S_z &=& \langle c_{\uparrow}^{\dagger}c_{\uparrow}\rangle - \langle c_{\downarrow}^{\dagger}c_{\downarrow}\rangle\\ \end{eqnarray*}
TBTK::SpinMatrix::SpinMatrix | ( | ) |
Constructor.
TBTK::SpinMatrix::SpinMatrix | ( | std::complex< double > | value | ) |
Constructs a SpinMatrix with all elements set to the same value.
value | The value to assign each entry. |
TBTK::SpinMatrix::~SpinMatrix | ( | ) |
Destructor.
double TBTK::SpinMatrix::getDensity | ( | ) | const |
Get desnity.
Vector3d TBTK::SpinMatrix::getSpinVector | ( | ) | const |
Get spin direction.
SpinMatrix& TBTK::SpinMatrix::operator+= | ( | const SpinMatrix & | spinMatrix | ) |
Addition equality operator.
SpinMatrix& TBTK::SpinMatrix::operator-= | ( | const SpinMatrix & | spinMatrix | ) |
Addition equality operator.
SpinMatrix& TBTK::SpinMatrix::operator= | ( | std::complex< double > | value | ) |
Assignment operator for assigning a single value to every element of the matrix.
std::string TBTK::SpinMatrix::toString | ( | ) | const |
Get string representation of the SpinMatrix.
|
friend |
Writes the SpinMatrix toString()-representation to a stream.
stream | The stream to write to. |
spinMatrix | The SpinMatrix to write. |