33 using LogValue = std::complex<QMCTraits::QTFull::RealType>;
36 TEST_CASE(
"DiracMatrix_identity",
"[wavefunction][fermion]")
58 TEST_CASE(
"DiracMatrix_inverse",
"[wavefunction][fermion]")
83 TEST_CASE(
"DiracMatrix_inverse_matching",
"[wavefunction][fermion]")
116 inv_M(0, 0) = -0.0650406504065041;
117 inv_M(0, 1) = -0.2113821138211382;
118 inv_M(0, 2) = 0.2113821138211382;
119 inv_M(0, 3) = 0.04065040650406502;
120 inv_M(1, 0) = 0.3739837398373983;
121 inv_M(1, 1) = -0.28455284552845533;
122 inv_M(1, 2) = -0.21544715447154467;
123 inv_M(1, 3) = 0.016260162601626094;
124 inv_M(2, 0) = 0.3902439024390243;
125 inv_M(2, 1) = 0.2682926829268292;
126 inv_M(2, 2) = -0.2682926829268292;
127 inv_M(2, 3) = -0.24390243902439013;
128 inv_M(3, 0) = -0.6422764227642275;
129 inv_M(3, 1) = 0.1626016260162603;
130 inv_M(3, 2) = 0.33739837398373973;
131 inv_M(3, 3) = 0.2764227642276421;
137 TEST_CASE(
"DiracMatrix_inverse_matching_2",
"[wavefunction][fermion]")
167 int pivot[4]{-1, -1, -1, -1};
169 std::vector<double>
lu{7.0,
176 -0.18750000000000022,
180 -0.05882352941176502,
195 inv_M(0, 0) = -0.0650406504065041;
196 inv_M(0, 1) = -0.2113821138211382;
197 inv_M(0, 2) = 0.2113821138211382;
198 inv_M(0, 3) = 0.04065040650406502;
199 inv_M(1, 0) = 0.3739837398373983;
201 inv_M(1, 1) = -0.28455284552845533;
202 inv_M(1, 2) = -0.21544715447154467;
203 inv_M(1, 3) = 0.016260162601626094;
204 inv_M(2, 0) = 0.3902439024390243;
205 inv_M(2, 1) = 0.2682926829268292;
206 inv_M(2, 2) = -0.2682926829268292;
207 inv_M(2, 3) = -0.24390243902439013;
208 inv_M(3, 0) = -0.6422764227642275;
209 inv_M(3, 1) = 0.1626016260162603;
210 inv_M(3, 2) = 0.33739837398373973;
211 inv_M(3, 3) = 0.2764227642276421;
220 TEST_CASE(
"DiracMatrix_inverse_complex",
"[wavefunction][fermion]")
230 a(0, 0) = {2.0, 0.1};
231 a(0, 1) = {5.0, 0.1};
232 a(0, 2) = {7.0, 0.2};
233 a(0, 3) = {5.0, 0.0};
234 a(1, 0) = {5.0, 0.1};
235 a(1, 1) = {2.0, 0.2};
236 a(1, 2) = {5.0, 1.0};
237 a(1, 3) = {4.0, -0.1};
238 a(2, 0) = {8.0, 0.5};
239 a(2, 1) = {2.0, 0.1};
240 a(2, 2) = {6.0, -0.2};
241 a(2, 3) = {4.0, -0.6};
242 a(3, 0) = {7.0, 1.0};
243 a(3, 1) = {8.0, 0.5};
244 a(3, 2) = {6.0, -0.2};
245 a(3, 3) = {8.0, -2.0};
248 int pivot[4]{-1, -1, -1, -1};
256 -0.0031128404669260694,
258 -0.026459143968871595,
264 -0.01831314754114669,
282 -0.10853319738453365};
294 b(0, 0) = {-0.05356228836958328, 0.018778132944668208};
295 b(0, 1) = {0.20217332569060176, 0.10247607676441389};
296 b(0, 2) = {0.1752053760997507, 0.08545803475354152};
297 b(0, 3) = {-0.22019253129809616, -0.23960901438764967};
298 b(1, 0) = {-0.16917709116094917, 0.18307841761769691};
299 b(1, 1) = {-0.6356039515926515, 0.24028909525203923};
300 b(1, 2) = {-0.16030725389326506, -0.2749054789157097};
301 b(1, 3) = {0.9251760746083686, 0.09385511919367814};
302 b(2, 0) = {0.21572431303125872, -0.10633509516999905};
303 b(2, 1) = {0.24869726332502523, -0.11905352270298367};
304 b(2, 2) = {0.16292868571183988, 0.17275739697798137};
305 b(2, 3) = {-0.560684625012445, -0.09607837395378985};
306 b(3, 0) = {0.023435592783503056, -0.030184486280558254};
307 b(3, 1) = {0.09553876547173154, -0.09007339752988484};
308 b(3, 2) = {-0.11510984212629605, -0.020898880528951114};
309 b(3, 3) = {0.05299966349431483, 0.13363053130258684};
315 TEST_CASE(
"DiracMatrix_update_row",
"[wavefunction][fermion]")
350 CHECK(det_ratio1 == ValueApprox(det_ratio));
351 updateEng.
acceptRow(a_inv, 0, v, det_ratio1);
356 b(0, 0) = 3.455170657;
357 b(0, 1) = -1.35124809;
358 b(0, 2) = -0.9233316353;
359 b(1, 0) = 0.05476311768;
360 b(1, 1) = 0.1591951095;
361 b(1, 2) = -0.1362710138;
362 b(2, 0) = -2.235099338;
363 b(2, 1) = 0.7119205298;
364 b(2, 2) = 0.9105960265;
helper functions for EinsplineSetBuilder
T dot(const T *restrict a, const T *restrict b, int n, TRES res=TRES())
dot product
QTBase::RealType RealType
void acceptRow(Matrix< T > &Ainv, int rowchanged, const VVT &psiV, const RATIOT ratio_new)
accept a move with the update delayed
TEST_CASE("complex_helper", "[type_traits]")
CHECKED_ELSE(check_matrix_result.result)
void transpose(const T *restrict A, size_t m, size_t lda, TO *restrict B, size_t n, size_t ldb)
transpose of A(m,n) to B(n,m)
void resize(size_type n, size_type m)
Resize the container.
implements delayed update on CPU using BLAS
int Xgetrf(int n, int m, float *restrict a, int lda, int *restrict piv)
wrappers around xgetrf lapack routines
Catch::Detail::LogComplexApprox LogComplexApprox
size_type size() const
return the current size
QTBase::ValueType ValueType
helper class to compute matrix inversion and the log value of determinant
static void fillInverse(Matrix< T > &b)
testing::MatrixAccessor< double > lu_mat(lu.data(), 4, 4)
QMCTraits::RealType RealType
CheckMatrixResult checkMatrix(M1 &a_mat, M2 &b_mat, const bool check_all=false, std::optional< const double > eps=std::nullopt)
This function checks equality a_mat and b_mat elements M1, M2 need to have their element type declare...
void resize(int norb, int delay)
resize the internal storage
CHECK(log_values[0]==ComplexApprox(std::complex< double >{ 5.603777579195571, -6.1586603331188225 }))
void fillIdentityMatrix(Matrix< T > &m)
std::vector< StdComp, CUDAHostAllocator< StdComp > > lu
LatticeGaussianProduct::ValueType ValueType
Declaration of WaveFunctionComponent.
std::complex< double > LogValue
std::enable_if_t< std::is_same< T_FP, TMAT >::value > invert_transpose(const Matrix< TMAT, ALLOC1 > &amat, Matrix< TMAT, ALLOC2 > &invMat, std::complex< TREAL > &LogDet)
compute the inverse of the transpose of matrix A and its determinant value in log when T_FP and TMAT ...
static void fillInput(Matrix< T > &a)
void getInvRow(const Matrix< T > &Ainv, int rowchanged, VVT &invRow)
compute the row of up-to-date Ainv