mbruno46 / pyobs Goto Github PK
View Code? Open in Web Editor NEWA Python library to analyse data generated from (Monte Carlo) Markov chains.
Home Page: https://mbruno46.github.io/pyobs/
License: GNU General Public License v2.0
A Python library to analyse data generated from (Monte Carlo) Markov chains.
Home Page: https://mbruno46.github.io/pyobs/
License: GNU General Public License v2.0
Diagonalization using pyobs.linalg.eigLR
fails when the eigenvalues/eigenvectors are complex. For example
mat = np.array([[0.0, -1], [1, 0.0]]) # eigenvalues are +- i
obs = pyobs.observable()
obs.create_from_cov('Ens', mat.flatten(), np.zeros(len(mat.flatten())))
obs = pyobs.reshape(obs, mat.shape)
eigv, legiv, reigv = pyobs.linalg.eigLR(obs)
fails with the error
UFuncTypeError Traceback (most recent call last)
Cell In[41], line 1
----> 1 eigv, legiv, reigv = pyobs.linalg.eigLR(obs)
2 print(eigv)
File ~/pyenv/lib/python3.11/site-packages/pyobs/tensor/linalg.py:157, in eigLR(x)
154 gv[:, n] += tmp[m, n] / (l[n] - l[m]) * w[:, m]
155 return gv
--> 157 gv = pyobs.gradient(gradv, x.mean)
159 # d w_n = sum_{m \neq n} (v_m, dA^T w_n) / (l_n - l_m) v_m
160 def gradw(y):
File ~/pyenv/lib/python3.11/site-packages/pyobs/core/gradient.py:36, in gradient.__init__(self, g, x0, gtype)
33 self.grad = g
34 return
---> 36 self.Na = numpy.size(g(x0))
37 self.Ni = numpy.size(x0)
38 self.gtype = gtype
File ~/pyenv/lib/python3.11/site-packages/pyobs/tensor/linalg.py:154, in eigLR.<locals>.gradv(y)
152 for m in range(x.shape[1]):
153 if n != m:
--> 154 gv[:, n] += tmp[m, n] / (l[n] - l[m]) * w[:, m]
155 return gv
UFuncTypeError: Cannot cast ufunc 'add' output from dtype('complex128') to dtype('float64') with casting rule 'same_kind'
This can be fixed by e.g. defining gv = numpy.zeros(x.shape, dtype=numpy.complex128)
instead, but in the subsequent calls to pyobs.gradient
arrays of floats are explicitly used in the __init__
call.
How to work with generic matrix observables, which are bound to have complex eigenvalues?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.