Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
M
MeanFi
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Quantum Tinkerer
MeanFi
Merge requests
!6
Documentation
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Documentation
documentation
into
main
Overview
16
Commits
28
Pipelines
19
Changes
15
Merged
Kostas Vilkelis
requested to merge
documentation
into
main
10 months ago
Overview
16
Commits
28
Pipelines
19
Changes
8
Expand
Construct the documentation for the release of the package.
0
0
Merge request reports
Compare
version 6
version 16
abc2e688
10 months ago
version 15
fe00fad7
10 months ago
version 14
1194fdf1
10 months ago
version 13
396802da
10 months ago
version 12
ce285fdc
10 months ago
version 11
849b41f6
10 months ago
version 10
84971514
10 months ago
version 9
23f4b5d8
10 months ago
version 8
06ee3d62
10 months ago
version 7
7e07f78a
10 months ago
version 6
5904b9ac
10 months ago
version 5
f750ade0
10 months ago
version 4
ff709ebe
10 months ago
version 3
5b30eda8
10 months ago
version 2
a7d0f6f3
10 months ago
version 1
661bea6a
10 months ago
main (base)
and
version 7
latest version
d18ddc5b
28 commits,
10 months ago
version 16
abc2e688
27 commits,
10 months ago
version 15
fe00fad7
26 commits,
10 months ago
version 14
1194fdf1
25 commits,
10 months ago
version 13
396802da
21 commits,
10 months ago
version 12
ce285fdc
18 commits,
10 months ago
version 11
849b41f6
17 commits,
10 months ago
version 10
84971514
16 commits,
10 months ago
version 9
23f4b5d8
11 commits,
10 months ago
version 8
06ee3d62
10 commits,
10 months ago
version 7
7e07f78a
9 commits,
10 months ago
version 6
5904b9ac
8 commits,
10 months ago
version 5
f750ade0
5 commits,
10 months ago
version 4
ff709ebe
4 commits,
10 months ago
version 3
5b30eda8
3 commits,
10 months ago
version 2
a7d0f6f3
2 commits,
10 months ago
version 1
661bea6a
1 commit,
10 months ago
Show latest version
8 files
+
166
−
106
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
8
Search (e.g. *.vue) (Ctrl+P)
pymf/params/param_transforms.py
+
29
−
18
Options
import
numpy
as
np
from
pymf.tb.tb
import
tb_type
def
tb_to_flat
(
tb
)
:
def
tb_to_flat
(
tb
:
tb_type
)
->
np
.
ndarray
:
"""
Convert a hermitian tight-binding dictionary to flat complex matrix.
Parameters
----------
tb :
dict with nd-array elements
Hermitian tigh-binding
dictionary
tb :
Hermitian tigh-binding
model
Returns
-------
flat :
complex 1d numpy array
Flattened tight-binding dictionary
flat :
1D complex array that parametrises the tb model.
"""
if
len
(
list
(
tb
)[
0
])
==
0
:
matrix
=
np
.
array
(
list
(
tb
.
values
()))
@@ -23,24 +24,29 @@ def tb_to_flat(tb):
return
sorted_vals
[:
N
].
flatten
()
def
flat_to_tb
(
flat
,
shape
,
tb_keys
):
def
flat_to_tb
(
flat
:
np
.
ndarray
,
shape
:
tuple
[
int
,
int
],
tb_keys
:
list
[
tuple
[
None
]
|
tuple
[
int
,
...]],
)
->
tb_type
:
"""
Reverse operation to `tb_to_flat`.
It takes a flat complex 1d array and return the tight-binding dictionary.
Parameters
----------
flat : dict with nd-array elements
Hermitian tigh-binding dictionary
shape : tuple
shape of the tb elements
tb_keys : iterable
original tb key elements
flat :
1d complex array that parametrises the tb model.
shape :
Tuple (n, n) where n is the number of internal degrees of freedom
(e.g. orbitals, spin, sublattice) within the tight-binding model.
tb_keys :
A list of the keys within the tight-binding model (all the hoppings).
Returns
-------
tb :
dict
tight-binding
dictionary
tb :
tight-binding
model
"""
if
len
(
tb_keys
[
0
])
==
0
:
matrix
=
np
.
zeros
((
shape
[
-
1
],
shape
[
-
2
]),
dtype
=
complex
)
@@ -59,17 +65,22 @@ def flat_to_tb(flat, shape, tb_keys):
return
tb
def
complex_to_real
(
z
)
:
"""
Split real and imaginary parts of a complex array.
def
complex_to_real
(
z
:
np
.
ndarray
)
->
np
.
ndarray
:
"""
Split
and concatenate
real and imaginary parts of a complex array.
Parameters
----------
z :
array
z :
Complex array.
Returns
-------
:
Real array that concatenates the real and imaginary parts of the input array.
"""
return
np
.
concatenate
((
np
.
real
(
z
),
np
.
imag
(
z
)))
def
real_to_complex
(
z
)
:
def
real_to_complex
(
z
:
np
.
ndarray
)
->
np
.
ndarray
:
"""
Undo `complex_to_real`.
"""
return
z
[:
len
(
z
)
//
2
]
+
1j
*
z
[
len
(
z
)
//
2
:]
Loading