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