-
Notifications
You must be signed in to change notification settings - Fork 3
/
detmodel.cpp
44 lines (29 loc) · 941 Bytes
/
detmodel.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
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. See the enclosed file LICENSE for a copy or if
* that was not distributed with this file, You can obtain one at
* http://mozilla.org/MPL/2.0/.
*
* Copyright 2017 Max H. Gerlach
*
* */
/*
* detmodel.cpp
*
* Created on: Feb 21, 2013
* Author: gerlach
*/
#include "detmodel.h"
MatNum computePropagator(num scalar, const MatNum& matrix) {
using namespace arma;
VecNum eigval;
MatNum eigvec;
eig_sym(eigval, eigvec, matrix);
return eigvec * diagmat(exp(-scalar * eigval)) * trans(eigvec);
}
MatCpx computePropagator(num scalar, const MatCpx& matrix) {
using namespace arma;
VecNum eigval; // hermitian matrix has real eigenvalues
MatCpx eigvec;
eig_sym(eigval, eigvec, matrix); // for hermitian matrix
return eigvec * diagmat(exp(-scalar * eigval)) * trans(eigvec);
}