Matrix Product Equation of Motion: Matrix Product State approximation for dynamical processes on networks.
If you use this code, please cite:
-  Thomas Barthel, Caterina De Bacco and Silvio Franz, Matrix product algorithm for stochastic dynamics on networks applied to nonequilibrium Glauber dynamics, Phys. Rev. E 97, 010104 R, 2018.
Copyright (c) 2017 Caterina De Bacco.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
python: Python code and a test script as follows.
python/one_time_update.py. Contains the main algorithmic steps for the matrix product state decomposition.
python/tools_dynamics.py. Contains two examples of dynamics transition probabilities: the majority rule and Glauber dynamics. Feel free to add new types of rules.
python/tools_observables.py. Contains functions to calculate observables like marginals and magnetization.
python/tools_main.py. Contains command line parameters sepcifications.
data: Contains sample result for the dynamics of some observables.
Need to make a directory called
data at the same level of the
To make one, just type from the command line, inside that folder:
For a usage example, inside folder
python/ type in the command line:
Feel free to modify the script
python test_mpem.py or to add command line parameters.
The dynamics transition probabilities are specified in
python/tools_dynamics.py. Feel free to add new types of dynamics.
If you use the script
test_mpem.py then you can specify various parameter from the command line:
hor --help gives you the parameters explanation
dsets graph connected component: 0=Keep the whole graph; 1=Keep only the max connected component
nsets graph number of nodes
ksets average degree
tsets T_max, max iteration time
ssets svd_routine: 0=fix the number of singular values; 1=fix the norm ratio between truncated and exact matrices.
psets the svd_parameter: either the max number of singular values or the norm cutoff ratio
isets random number generator seed
msets max number of singular values accepted
Jsets mean value Js (needed for Glauber Spin-Glass dynamics)
jsets variance Js (needed for Glauber Spin-Glass dynamics)
bsets initial bias spin
Bsets beta (needed for Glauber Spin-Glass dynamics)
esets type of dynamic 0=majority; 1=Glauber
Various files will be generated inside the
data folder, see the script
python/test_mpem.py for files names and quantities in output. Feel free to modify the script to output what you prefer.