Skip to content
Snippets Groups Projects
Commit 811405ba authored by Yuriel Núñez Fernández's avatar Yuriel Núñez Fernández
Browse files

add the two notebooks

parent 792debfc
No related branches found
No related tags found
No related merge requests found
%% Cell type:code id:f09f3e65-fd73-4a36-8e30-7229dfe11581 tags:
``` python
import numpy as np
import matplotlib.pyplot as plt
grid_b=np.load('K2t1_frequency_grid_bose.npy')
grid_f=np.load('K2t1_frequency_grid_fermi.npy')
K2=np.load('K2t1.npy')
[K2.shape, grid_b.shape, grid_f.shape]
```
%% Output
[(101, 81, 2), (101,), (81,)]
%% Cell type:code id:6ff81f14-390d-48ef-9069-2e872ef57c51 tags:
``` python
plt.plot(grid_f,'o')
plt.plot(np.diff(grid_b))
```
%% Output
[<matplotlib.lines.Line2D at 0x7f59199b23a0>]
%% Cell type:code id:c9762dc6-40f3-4214-9f7f-faa1a5470961 tags:
``` python
for site in [0,1]:
(u,s,vh)=np.linalg.svd(K2[:,:,site])
sum=np.sum(s);
plt.plot(1-np.cumsum(s)/sum, label=f'site {site}')
plt.xlabel('rank')
plt.ylabel('relative truncation error')
plt.yscale('log')
plt.legend();
plt.ylim(1e-7)
```
%% Output
(1e-07, 0.5196395541063292)
%% Cell type:code id:3cb08aaa-eb9d-4f9f-a663-feff6bb35495 tags:
``` python
name='K3a0'
K3data=np.load(f'{name}.npy')
K3data.shape
```
%% Output
(31, 61, 61, 2)
%% Cell type:code id:dd68b40b-e959-44aa-a965-868b9debc9d3 tags:
``` python
for K3 in [K3data,K3data.transpose([1,0,2,3])]:
fig, ax = plt.subplots()
fig.set_size_inches(4,4)
fig.set_dpi(100)
ax.set_title(f"{name} tensor {K3.shape}")
ax.set_xlabel('rank')
ax.set_ylabel('relative truncation error')
ax.set_yscale('log')
for shape in [(K3.shape[0],-1), (-1,K3.shape[2])]:
for site in [0,1]:
K3m=K3[:,:,:,site].reshape(shape)
(u,s,vh)=np.linalg.svd(K3m)
sum=np.sum(s);
ax.plot(1-np.cumsum(s)/sum, label=f'site {site}, {K3m.shape}')
ax.legend()
ax.set_ylim(1e-7)
```
%% Output
%% Cell type:code id:34c29218-7406-447e-8ae8-545784f117fa tags:
``` python
```
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment