QMCPACK
createTestMatrix.h
Go to the documentation of this file.
1
//////////////////////////////////////////////////////////////////////////////////////
2
// This file is distributed under the University of Illinois/NCSA Open Source License.
3
// See LICENSE file in top directory for details.
4
//
5
// Copyright (c) 2022 QMCPACK developers.
6
//
7
// File developed by: Mark Dewing, mdewing@anl.gov, Argonne National Laboratory
8
//
9
// File created by: Mark Dewing, mdewing@anl.gov, Argonne National Laboratory
10
//////////////////////////////////////////////////////////////////////////////////////
11
12
#ifndef QMCPLUSPLUS_CREATETESTMATRIX_H
13
#define QMCPLUSPLUS_CREATETESTMATRIX_H
14
15
// Create matrices and their inverses for testing matrix inversion code
16
// Matrix values are from gen_inverse.py
17
18
#include <algorithm>
19
20
namespace
qmcplusplus
21
{
22
23
// Create an identity matrix.
24
// Assumes matrix is square (or at least the number of rows >= number of columns)
25
template
<
typename
T>
26
void
fillIdentityMatrix
(
Matrix<T>
&
m
)
27
{
28
std::fill(
m
.begin(),
m
.end(), T(0));
29
for
(
int
i = 0; i <
m
.cols(); i++)
30
m
(i, i) = 1.0;
31
}
32
33
34
// Inverse test 1
35
// Assumes input matrix is 3x3
36
struct
TestMatrix1
37
{
38
template
<
typename
T>
39
static
void
fillInput
(
Matrix<T>
& a)
40
{
41
a(0, 0) = 2.3;
42
a(0, 1) = 4.5;
43
a(0, 2) = 2.6;
44
a(1, 0) = 0.5;
45
a(1, 1) = 8.5;
46
a(1, 2) = 3.3;
47
a(2, 0) = 1.8;
48
a(2, 1) = 4.4;
49
a(2, 2) = 4.9;
50
}
51
52
// Inverse of test matrix 1
53
template
<
typename
T>
54
static
void
fillInverse
(
Matrix<T>
& b)
55
{
56
b(0, 0) = 0.6159749342;
57
b(0, 1) = -0.2408954682;
58
b(0, 2) = -0.1646081192;
59
b(1, 0) = 0.07923894288;
60
b(1, 1) = 0.1496231042;
61
b(1, 2) = -0.1428117337;
62
b(2, 0) = -0.2974298429;
63
b(2, 1) = -0.04586322768;
64
b(2, 2) = 0.3927890292;
65
}
66
67
// Log of determinant of test matrix 1
68
inline
static
double
logDet
() {
return
3.78518913425; }
69
};
70
71
}
// namespace qmcplusplus
72
#endif
qmcplusplus
helper functions for EinsplineSetBuilder
Definition:
Configuration.h:43
qmcplusplus::Units::distance::m
const real m
Definition:
unit_conversion.h:37
qmcplusplus::TestMatrix1
Definition:
createTestMatrix.h:36
qmcplusplus::TestMatrix1::fillInverse
static void fillInverse(Matrix< T > &b)
Definition:
createTestMatrix.h:54
qmcplusplus::TestMatrix1::logDet
static double logDet()
Definition:
createTestMatrix.h:68
qmcplusplus::Matrix< T >
qmcplusplus::fillIdentityMatrix
void fillIdentityMatrix(Matrix< T > &m)
Definition:
createTestMatrix.h:26
qmcplusplus::TestMatrix1::fillInput
static void fillInput(Matrix< T > &a)
Definition:
createTestMatrix.h:39
src
QMCWaveFunctions
tests
createTestMatrix.h
Generated on Fri Jun 28 2024 10:45:27 for QMCPACK by
1.8.14