Commit 8f12b376 authored by Alvarez, Gonzalo's avatar Alvarez, Gonzalo
Browse files

CorrelationsSkeleton: braketSystem: bug fix when bra != ket

parent 70ef409d
...@@ -164,7 +164,6 @@ public: ...@@ -164,7 +164,6 @@ public:
*/ */
void setToProduct(const ThisType& basis1, void setToProduct(const ThisType& basis1,
const ThisType& basis2, const ThisType& basis2,
const QnType* pseudoQn = 0,
SizeType initialSizeOfHashTable = 10) SizeType initialSizeOfHashTable = 10)
{ {
if (useSu2Symmetry_) if (useSu2Symmetry_)
......
...@@ -532,8 +532,7 @@ private: ...@@ -532,8 +532,7 @@ private:
SizeType r2 = A.getCol(k); SizeType r2 = A.getCol(k);
SizeType t2 = helper_.leftRightSuper(ptr).super(). SizeType t2 = helper_.leftRightSuper(ptr).super().
permutationInverse(r2+eta*A.cols()); permutationInverse(r2+eta*A.cols());
if (t2<offset || t2>=total) continue; sum += A.getValue(k)*PsimagLite::conj(vec1.fastAccess(sector, t - offset))*
sum += A.getValue(k)*PsimagLite::conj(vec1.slowAccess(t))*
vec2.slowAccess(t2); vec2.slowAccess(t2);
} }
} }
......
...@@ -159,8 +159,6 @@ public: ...@@ -159,8 +159,6 @@ public:
PsimagLite::Profiling profiling("Diagonalization", std::cout); PsimagLite::Profiling profiling("Diagonalization", std::cout);
assert(direction == ProgramGlobals::DirectionEnum::INFINITE); assert(direction == ProgramGlobals::DirectionEnum::INFINITE);
SizeType loopIndex = 0; SizeType loopIndex = 0;
VectorSizeType sectors;
targetedSymmetrySectors(sectors,target.lrs());
internalMain_(target, energies, direction, loopIndex, blockLeft); internalMain_(target, energies, direction, loopIndex, blockLeft);
// targeting: // targeting:
target.evolve(energies[0], direction, blockLeft, blockRight, loopIndex); target.evolve(energies[0], direction, blockLeft, blockRight, loopIndex);
...@@ -184,20 +182,32 @@ public: ...@@ -184,20 +182,32 @@ public:
private: private:
void targetedSymmetrySectors(VectorSizeType& mVector, SizeType targetedSymmetrySectors(VectorSizeType& mVector,
const LeftRightSuperType& lrs) const VectorSizeType& compactedWeights,
bool findSymmetrySector,
const LeftRightSuperType& lrs) const
{ {
SizeType total = lrs.super().partition()-1; const SizeType total = lrs.super().partition() - 1;
for (SizeType i = 0; i < total; ++i) { SizeType sum = 0;
bool flag = false; for (SizeType j = 0; j < quantumSector_.size(); ++j) {
for (SizeType j = 0; j < quantumSector_.size(); ++j) for (SizeType i = 0; i < total; ++i) {
if (lrs.super().pseudoQn(i) == quantumSector_[j]) {
flag = true; if (j == 0 && verbose_)
break; std::cerr<<lrs.super().qnEx(i);
}
const bool b1 = (lrs.super().pseudoQn(i) != quantumSector_[j] ||
std::find(mVector.begin(), mVector.end(), i) != mVector.end());
if (flag) mVector.push_back(i); if (b1 && !findSymmetrySector) continue;
SizeType bs = lrs.super().partition(i + 1) - lrs.super().partition(i);
mVector.push_back(i);
compactedWeights.push_back(bs);
sum += bs;
}
} }
return sum;
} }
void internalMain_(TargetingType& target, void internalMain_(TargetingType& target,
...@@ -232,33 +242,12 @@ private: ...@@ -232,33 +242,12 @@ private:
msg0<<"Setting up Hamiltonian basis of size="<<lrs.super().size(); msg0<<"Setting up Hamiltonian basis of size="<<lrs.super().size();
progress_.printline(msgg0, std::cout); progress_.printline(msgg0, std::cout);
SizeType total = lrs.super().partition()-1;
SizeType weightsTotal = 0;
VectorSizeType sectors; VectorSizeType sectors;
VectorSizeType compactedWeights; VectorSizeType compactedWeights;
for (SizeType i = 0; i < total; ++i) { const SizeType weightsTotal = targetedSymmetrySectors(sectors,
SizeType bs = lrs.super().partition(i+1)-lrs.super().partition(i); compactedWeights,
if (verbose_) findSymmetrySector,
std::cerr<<lrs.super().qnEx(i); lrs);
// Do only one sector unless doing su(2) with j>0, then do all m's
bool flag = false;
for (SizeType ii = 0; ii < quantumSector_.size(); ++ii) {
if (lrs.super().pseudoQn(i) == quantumSector_[ii]) {
flag = true;
break;
}
}
if (!flag && !findSymmetrySector) {
bs = 0;
} else {
sectors.push_back(i);
compactedWeights.push_back(bs);
}
weightsTotal += bs;
}
if (weightsTotal == 0) { if (weightsTotal == 0) {
PsimagLite::String msg("Diagonalization: "); PsimagLite::String msg("Diagonalization: ");
......
...@@ -358,7 +358,7 @@ obtain ordered ...@@ -358,7 +358,7 @@ obtain ordered
parameters_.adjustQuantumNumbers); parameters_.adjustQuantumNumbers);
assert(0 < quantumSector_.size()); // used only for SU(2) assert(0 < quantumSector_.size()); // used only for SU(2)
lrs_.setToProduct(quantumSector_[0], initialSizeOfHashTable); lrs_.setToProduct(initialSizeOfHashTable);
const BlockType& ystep = findRightBlock(Y,step,E); const BlockType& ystep = findRightBlock(Y,step,E);
...@@ -566,7 +566,7 @@ obtain ordered ...@@ -566,7 +566,7 @@ obtain ordered
parameters_.adjustQuantumNumbers); parameters_.adjustQuantumNumbers);
assert(0 < quantumSector_.size()); // used only for SU(2) assert(0 < quantumSector_.size()); // used only for SU(2)
lrs_.setToProduct(quantumSector_[0], initialSizeOfHashTable); lrs_.setToProduct(initialSizeOfHashTable);
diagonalization_(target, diagonalization_(target,
energies, energies,
......
...@@ -234,12 +234,12 @@ public: ...@@ -234,12 +234,12 @@ public:
} }
/*!PTEX_LABEL{setToProductLrs} */ /*!PTEX_LABEL{setToProductLrs} */
void setToProduct(QnType quantumSector, SizeType initialSizeOfHashTable) void setToProduct(SizeType initialSizeOfHashTable)
{ {
assert(left_); assert(left_);
assert(right_); assert(right_);
assert(super_); assert(super_);
super_->setToProduct(*left_, *right_, &quantumSector, initialSizeOfHashTable); super_->setToProduct(*left_, *right_, initialSizeOfHashTable);
} }
void write(PsimagLite::IoNg::Out& io, void write(PsimagLite::IoNg::Out& io,
......
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