-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathFreeFunctions.cpp
64 lines (59 loc) · 2.27 KB
/
FreeFunctions.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#include <fstream>
#include "FinalSuperblock.h"
#include "GlobalPrecisionParameters.h"
using namespace Eigen;
rmMatrixX_t randomSeed(const TheBlock& leftBlock, const TheBlock& rightBlock)
{
return rmMatrixX_t::Random(leftBlock.blockParts.m * d
* rightBlock.blockParts.m * d, 1).normalized();
};
void reflectPredictedPsi(rmMatrixX_t& psiGround, const TheBlock& bigBlock,
const TheBlock& littleBlock)
{
psiGround.resize(bigBlock.blockParts.m * d, littleBlock.blockParts.m * d);
psiGround.transposeInPlace();
psiGround.resize(bigBlock.blockParts.m * d * littleBlock.blockParts.m * d, 1);
};
VectorXd oneSiteExpValues(const obsMatrixD_t& oneSiteOp, int lSys,
FinalSuperblock& hSuperFinal,
std::vector<TheBlock>& westBlocks,
std::vector<TheBlock>& eastBlocks)
{
opsVec ops; // list of observable single-site operators
ops.push_back(std::make_pair(oneSiteOp, 0));
VectorXd oneSiteVals(lSys);
for(int i = 0; i < lSys; i++)
{
ops[0].second = i;
double exactValue = hSuperFinal.expValue(ops, westBlocks, eastBlocks);
oneSiteVals(i) = std::abs(exactValue) < observableThreshold ?
0. : exactValue;
};
return oneSiteVals;
};
double expiDotj(int i, int j, FinalSuperblock& hSuperFinal,
std::vector<TheBlock>& westBlocks,
std::vector<TheBlock>& eastBlocks)
{
obsMatrixD_t splus,
sminus,
sz;
splus << 0, 1,
0, 0;
sminus << 0, 0,
1, 0;
sz << .5, 0,
0, -.5;
opsVec ops; // list of observable single-site operators
ops.reserve(2);
ops.push_back(std::make_pair(splus, i));
ops.push_back(std::make_pair(sminus, j));
double dotExpValue = hSuperFinal.expValue(ops, westBlocks, eastBlocks) / 2;
ops[0].first = sminus;
ops[1].first = splus;
dotExpValue += hSuperFinal.expValue(ops, westBlocks, eastBlocks) / 2;
ops[0].first = sz;
ops[1].first = sz;
dotExpValue += hSuperFinal.expValue(ops, westBlocks, eastBlocks);
return dotExpValue;
};