TBTK
Need a break? Support the development by playing Polarity Puzzles
SpinMatrix.h
1 /* Copyright 2017 Kristofer Björnson
2  *
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
23 #ifndef COM_DAFER45_TBTK_SPIN_MATRIX
24 #define COM_DAFER45_TBTK_SPIN_MATRIX
25 
26 #include "TBTK/Matrix.h"
27 #include "TBTK/Vector3d.h"
28 
29 #include <complex>
30 
31 namespace TBTK{
32 
82 class SpinMatrix : public Matrix<std::complex<double>, 2, 2>{
83 public:
85  SpinMatrix();
86 
90  SpinMatrix(std::complex<double> value);
91 
93  ~SpinMatrix();
94 
97  SpinMatrix& operator=(std::complex<double> value);
98 
100  SpinMatrix& operator+=(const SpinMatrix &spinMatrix);
101 
103  SpinMatrix& operator-=(const SpinMatrix &spinMatrix);
104 
106  double getDensity() const;
107 
109  Vector3d getSpinVector() const;
110 
114  std::string toString() const;
115 
122  friend std::ostream& operator<<(
123  std::ostream &stream,
124  const SpinMatrix &spinMatrix
125  );
126 private:
127 };
128 
129 inline std::ostream& operator<<(
130  std::ostream &stream,
131  const SpinMatrix &spinMatrix
132 ){
133  stream << spinMatrix.toString();
134 
135  return stream;
136 }
137 
138 }; //End namespace TBTK
139 
140 #endif
SpinMatrix & operator+=(const SpinMatrix &spinMatrix)
SpinMatrix & operator-=(const SpinMatrix &spinMatrix)
Three-dimensional vector with components of double type.
SpinMatrix & operator=(std::complex< double > value)
Vector3d getSpinVector() const
std::string toString() const
Custom matrix.
Definition: Matrix.h:33
Definition: Vector3d.h:33
Definition: Boolean.h:32
friend std::ostream & operator<<(std::ostream &stream, const SpinMatrix &spinMatrix)
Definition: SpinMatrix.h:129
double getDensity() const
Matrix containing information about a spin.
Definition: SpinMatrix.h:82