7#ifndef REAL_TIME_TRANSPORT_RENORMALIZED_PT_CONDUCTANCE_DIAGRAMS_H
8#define REAL_TIME_TRANSPORT_RENORMALIZED_PT_CONDUCTANCE_DIAGRAMS_H
10#include "../BlockMatrices/BlockDiagonalCheb.h"
11#include "../BlockMatrices/BlockDiagonalMatrix.h"
12#include "../BlockMatrices/BlockMatrix.h"
13#include "../BlockMatrices/BlockVector.h"
16#include <SciCore/ChebAdaptive.h>
17#include <SciCore/Utility.h>
23namespace RealTimeTransport::RenormalizedPT::Detail
30template <
typename MemoryKernelT>
31Model::SupervectorType compute_d_dmu_rhoStat(
32 const MemoryKernelT& memoryKernel,
33 const BlockDiagonalCheb& d_dmu_memoryKernel,
34 const Model::SupervectorType& rhoStat,
35 const Model::SuperRowVectorType& idRow,
38 using namespace SciCore;
39 using Supervector = Model::SupervectorType;
41 Supervector returnValue = Supervector::Zero(idRow.size());
42 Real tMax = memoryKernel.tMax();
43 const std::vector<
int>& blockDims = memoryKernel.model()->blockDimensions();
46 if (block < 0 || block > 0)
49 Supervector b = -(d_dmu_SigmaZeroFreq * rhoStat);
50 Matrix A = memoryKernel.zeroFrequency().toDense();
51 A.row(A.rows() - 1) = idRow;
52 b[A.rows() - 1] = 0.0;
53 returnValue = A.colPivHouseholderQr().solve(b);
57 if (rhoStat.tail(rhoStat.size() - blockDims[block]).isZero() ==
false)
59 throw Error(
"Stationary state does not have the required structure");
62 if (idRow.tail(idRow.size() - blockDims[block]).isZero() ==
false)
64 throw Error(
"Inconsistent block structure");
67 Matrix A = memoryKernel.zeroFrequency()(block);
68 Matrix d_dmu_SigmaZeroFreq = d_dmu_memoryKernel.block(block).integrate()(tMax);
69 Supervector b = -(d_dmu_SigmaZeroFreq * rhoStat.segment(0, blockDims[block]));
71 A.row(A.rows() - 1) = idRow.segment(0, blockDims[block]);
72 b[A.rows() - 1] = 0.0;
73 returnValue.head(blockDims[block]) = A.colPivHouseholderQr().solve(b);
77 throw Error(
"Logic error");
80 truncToZero(returnValue, std::numeric_limits<Real>::epsilon());
89SciCore::Matrix d_dmu_diagram_1(
93 const std::function<BlockDiagonalMatrix(SciCore::Real)>& computePi,
94 const std::vector<BlockMatrix>& superfermion,
107BlockVector d_dmu_effectiveVertexDiagram1_col(
110 SciCore::Real t_minus_tau,
111 SciCore::Real tau_minus_s,
113 SciCore::Real epsAbs,
114 const std::function<BlockDiagonalMatrix(SciCore::Real)>& computePi,
115 const std::vector<BlockMatrix>& superfermion,
129SciCore::Matrix d_dmu_diagram_2(
133 SciCore::Real epsAbs,
134 SciCore::Real epsRel,
135 const std::function<BlockDiagonalMatrix(SciCore::Real)>& computePi,
136 const std::function<BlockVector(
int,
int, SciCore::Real, SciCore::Real)>& computeD_col,
137 const std::function<BlockVector(
int,
int, SciCore::Real, SciCore::Real,
int)>& compute_d_dmu_D_col,
138 const std::vector<BlockMatrix>& superfermion,
152SciCore::Matrix d_dmu_diagram_2_2(
156 SciCore::Real epsAbs,
157 SciCore::Real epsRel,
158 const std::function<BlockDiagonalMatrix(SciCore::Real)>& computePi,
159 const std::function<BlockDiagonalMatrix(SciCore::Real)>& computeDiagram_1,
160 const std::function<BlockDiagonalMatrix(SciCore::Real)>& compute_d_dmu_diagram_1,
161 const std::vector<BlockMatrix>& superfermion,
169Model::SuperRowVectorType d_dmu_currentDiagram_1(
173 const std::function<BlockDiagonalMatrix(SciCore::Real)>& computePi,
174 const std::vector<Model::SuperRowVectorType>& Tr_superfermionAnnihilation,
175 const std::vector<BlockMatrix>& superfermion,
176 const std::vector<
int>& blockStartIndices,
190Model::SuperRowVectorType d_dmu_currentDiagram_2(
194 SciCore::Real epsAbs,
195 SciCore::Real epsRel,
196 const std::function<BlockDiagonalMatrix(SciCore::Real)>& computePi,
197 const std::function<BlockVector(
int,
int, SciCore::Real, SciCore::Real)>& computeD_col,
198 const std::function<BlockVector(
int,
int, SciCore::Real, SciCore::Real,
int)>& compute_d_dmu_D_col,
199 const std::vector<Model::SuperRowVectorType>& Tr_superfermionAnnihilation,
200 const std::vector<
int>& blockStartIndices,
215Model::SuperRowVectorType d_dmu_currentDiagram_2_2(
219 SciCore::Real epsAbs,
220 SciCore::Real epsRel,
221 const std::function<BlockDiagonalMatrix(SciCore::Real)>& computePi,
222 const std::function<BlockDiagonalMatrix(SciCore::Real)>& computeDiagram_1,
223 const std::function<BlockDiagonalMatrix(SciCore::Real)>& compute_d_dmu_diagram_1,
224 const std::vector<BlockMatrix>& superfermion,
225 const std::vector<Model::SuperRowVectorType>& Tr_superfermionAnnihilation,
226 const std::vector<
int>& blockStartIndices,
Represents a block diagonal matrix.
Definition BlockDiagonalMatrix.h:33
Abstract class representing a model.
Definition Model.h:47