Commit 6d91c019 authored by Alvarez, Gonzalo's avatar Alvarez, Gonzalo
Browse files

SU(3) model: real and complex modes

parent 55425092
......@@ -128,6 +128,8 @@ public:
typedef Su3RepresentationP1<ComplexOrRealType,
PsimagLite::IsComplexNumber<ComplexOrRealType>::True> Su3RepresentationP1Type;
static const bool IS_REAL = !PsimagLite::IsComplexNumber<ComplexOrRealType>::True;
Su3Model(const SolverParamsType& solverParams,
InputValidatorType& io,
const SuperGeometryType& geometry)
......@@ -170,14 +172,17 @@ public:
assert(block.size() == 1);
MatrixType m3;
// su3Rep_->getMatrix(m3, 2);
su3Rep_->getRealMatrix(m3, 3);
su3Rep_->getMatrix(m3, (IS_REAL) ? 3 : 2);
MatrixType m8;
// su3Rep_->getMatrix(m8, 7);
su3Rep_->getRealMatrix(m8, 4);
su3Rep_->getMatrix(m8, (IS_REAL) ? 4 : 7);
MatrixType m = m3*m3;
MatrixType mtemp = m8*m8;
m += mtemp;
if (IS_REAL) {
MatrixType mtemp = m8*m8;
m += mtemp;
}
m *= modelParameters_.mass;
SparseMatrixType mSparse(m);
......@@ -187,8 +192,15 @@ public:
protected:
/*
void fillLabeledOperators(VectorQnType& qns)
{
if (IS_REAL)
fillLabeledOperatorsReal(qns);
else
fillLabeledOperatorsComplex(qns);
}
void fillLabeledOperatorsComplex(VectorQnType& qns)
{
SizeType site = 0;
BlockType block(1, site);
......@@ -217,8 +229,8 @@ protected:
this->makeTrackable("T" + ttos(a + 1));
}
}
*/
void fillLabeledOperators(VectorQnType& qns)
void fillLabeledOperatorsReal(VectorQnType& qns)
{
SizeType site = 0;
BlockType block(1, site);
......@@ -232,7 +244,7 @@ protected:
MatrixType m;
su3Rep_->getRealMatrix(m, a);
su3Rep_->getMatrix(m, a);
SparseMatrixType sparseMatrix(m);
......@@ -253,7 +265,7 @@ protected:
MatrixType m;
su3Rep_->getRealMatrix(m, a);
su3Rep_->getMatrix(m, a);
SparseMatrixType sparseMatrix(m);
......@@ -273,8 +285,16 @@ protected:
}
}
}
/*
void fillModelLinks()
{
if (IS_REAL)
fillModelLinksReal();
else
fillModelLinksComplex();
}
void fillModelLinksComplex()
{
ModelTermType& jOne = ModelBaseType::createTerm("jOne");
for (SizeType a = 0; a < 8; ++a) {
......@@ -292,8 +312,8 @@ protected:
jTwo.push(aOpForLink, 'N', aOpForLink, 'C');
}
}
*/
void fillModelLinks()
void fillModelLinksReal()
{
ModelTermType& jOnepm = ModelBaseType::createTerm("jOne_pm");
for (SizeType a = 0; a < 3; ++a) {
......
......@@ -8,15 +8,12 @@ class Su3RepresentationBase {
public:
//typedef typename PsimagLite::Real<ComplexOrRealType>::Type RealType;
typedef PsimagLite::Matrix<ComplexOrRealType> MatrixType;
virtual ~Su3RepresentationBase() {}
virtual void getMatrix(MatrixType&, SizeType) const = 0;
virtual void getRealMatrix(MatrixType&, SizeType) const = 0;
virtual SizeType t3OfState(SizeType) const = 0;
virtual SizeType t8OfState(SizeType) const = 0;
......
......@@ -13,28 +13,57 @@ public:
void getMatrix(MatrixType& m, SizeType n) const
{
err("Su3RepresentationP1: Please useComplex\n");
}
m.resize(3, 3);
void getRealMatrix(MatrixType& m, SizeType n) const
{
err("Su3RepresentationP1: Please don't useComplex\n");
// Tplus1
if (n == 0) {
m(0, 1) = 0.5;
return;
}
// Tplus2
if (n == 1) {
m(0, 2) = 0.5;
return;
}
// Tplus3
if (n == 2) {
m(1, 2) = 0.5;
return;
}
// T3
if (n == 3) {
m(0, 0) = 0.5;
m(1, 1) = -0.5;
return;
}
// T8
assert(n == 4);
static const ComplexOrRealType oneOverSqrt3 = 1.0/sqrt(3.0);
m(0, 0) = m(1, 1) = 0.5*oneOverSqrt3;
m(2, 2) = -oneOverSqrt3;
}
// diagonal 1 -1 0 ==> 2 0 1
SizeType t3OfState(SizeType ind) const
{
throw PsimagLite::RuntimeError("Su3RepresentationP1: Please useComplex\n");
if (ind == 0) return 2;
if (ind == 1) return 0;
assert(ind == 2);
return 1;
}
// diagonal 1 1 -2 ==> 3 3 0
SizeType t8OfState(SizeType ind) const
{
throw PsimagLite::RuntimeError("Su3RepresentationP1: Please useComplex\n");
assert(ind < 3);
return (ind < 2) ? 3 : 0;
}
SizeType size() const
{
throw PsimagLite::RuntimeError("Su3RepresentationP1: Please useComplex\n");
}
SizeType size() const { return 3; }
};
template<typename ComplexOrRealType>
......@@ -95,38 +124,6 @@ public:
m(2, 2) = -oneOverSqrt3;
}
void getRealMatrix(MatrixType& m, SizeType n) const
{
m.resize(3, 3);
// Tplus1
if (n == 0) {
m(0, 1) = 0.5;
return;
}
// Tplus2
if (n == 1) {
m(0, 2) = 0.5;
return;
}
// Tplus3
if (n == 2) {
m(1, 2) = 0.5;
return;
}
// T3
if (n == 3) {
m(0, 0) = 0.5;
m(1, 1) = -0.5;
return;
}
// T8
assert(n == 4);
static const RealType oneOverSqrt3 = 1.0/sqrt(3.0);
m(0, 0) = m(1, 1) = 0.5*oneOverSqrt3;
m(2, 2) = -oneOverSqrt3;
}
// diagonal 1 -1 0 ==> 2 0 1
SizeType t3OfState(SizeType ind) const
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment