sopy-quantum 2.0.0__tar.gz → 2.0.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {sopy_quantum-2.0.0/sopy_quantum.egg-info → sopy_quantum-2.0.4}/PKG-INFO +3 -3
- {sopy_quantum-2.0.0 → sopy_quantum-2.0.4}/README.md +2 -2
- {sopy_quantum-2.0.0 → sopy_quantum-2.0.4}/pyproject.toml +1 -1
- sopy_quantum-2.0.4/sopy/pyscf/__init__.py +26 -0
- sopy_quantum-2.0.4/sopy/tensorly/__init__.py +26 -0
- {sopy_quantum-2.0.0 → sopy_quantum-2.0.4}/sopy/vector/operand.py +52 -1
- {sopy_quantum-2.0.0 → sopy_quantum-2.0.4}/sopy/vector/vector.py +23 -16
- {sopy_quantum-2.0.0 → sopy_quantum-2.0.4/sopy_quantum.egg-info}/PKG-INFO +3 -3
- sopy_quantum-2.0.0/sopy/pyscf/__init__.py +0 -16
- sopy_quantum-2.0.0/sopy/tensorly/__init__.py +0 -15
- {sopy_quantum-2.0.0 → sopy_quantum-2.0.4}/LICENSE.txt +0 -0
- {sopy_quantum-2.0.0 → sopy_quantum-2.0.4}/setup.cfg +0 -0
- {sopy_quantum-2.0.0 → sopy_quantum-2.0.4}/sopy/__init__.py +0 -0
- {sopy_quantum-2.0.0 → sopy_quantum-2.0.4}/sopy/amplitude/__init__.py +0 -0
- {sopy_quantum-2.0.0 → sopy_quantum-2.0.4}/sopy/amplitude/amplitude.py +0 -0
- {sopy_quantum-2.0.0 → sopy_quantum-2.0.4}/sopy/component/__init__.py +0 -0
- {sopy_quantum-2.0.0 → sopy_quantum-2.0.4}/sopy/component/component.py +0 -0
- {sopy_quantum-2.0.0 → sopy_quantum-2.0.4}/sopy/component/momentum.py +0 -0
- {sopy_quantum-2.0.0 → sopy_quantum-2.0.4}/sopy/pyscf/ext.py +0 -0
- {sopy_quantum-2.0.0 → sopy_quantum-2.0.4}/sopy/tensorly/ext.py +0 -0
- {sopy_quantum-2.0.0 → sopy_quantum-2.0.4}/sopy/vector/__init__.py +0 -0
- {sopy_quantum-2.0.0 → sopy_quantum-2.0.4}/sopy_quantum.egg-info/SOURCES.txt +0 -0
- {sopy_quantum-2.0.0 → sopy_quantum-2.0.4}/sopy_quantum.egg-info/dependency_links.txt +0 -0
- {sopy_quantum-2.0.0 → sopy_quantum-2.0.4}/sopy_quantum.egg-info/requires.txt +0 -0
- {sopy_quantum-2.0.0 → sopy_quantum-2.0.4}/sopy_quantum.egg-info/top_level.txt +0 -0
- {sopy_quantum-2.0.0 → sopy_quantum-2.0.4}/tests/test_als.py +0 -0
- {sopy_quantum-2.0.0 → sopy_quantum-2.0.4}/tests/test_overlaps_1.py +0 -0
- {sopy_quantum-2.0.0 → sopy_quantum-2.0.4}/tests/test_overlaps_2.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: sopy-quantum
|
|
3
|
-
Version: 2.0.
|
|
3
|
+
Version: 2.0.4
|
|
4
4
|
Summary: Representation and Decomposition with Sums of Product for Operations in separated dimensions. Now using bandlimit place data on lattice.
|
|
5
5
|
Author-email: Jonathan Jerke <jonathan@quantumgalaxies.org>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -112,7 +112,7 @@ Get the Euclidean distance from vector v-k and q
|
|
|
112
112
|
|
|
113
113
|
Reduce v with Fibonacci procedure
|
|
114
114
|
|
|
115
|
-
v.Fibonacci(ambiguity_rate=0
|
|
115
|
+
v.Fibonacci(ambiguity_rate=0).dist(v)
|
|
116
116
|
|
|
117
117
|
The ambiguity rate will keep things real under recursive iterations driven by external programs.
|
|
118
118
|
|
|
@@ -129,6 +129,6 @@ The ambiguity rate will keep things real under recursive iterations driven by ex
|
|
|
129
129
|
|
|
130
130
|
[ SoPy Website ](https://sopy.quantumgalaxies.org)
|
|
131
131
|
|
|
132
|
-
[ Quantum Galaxies Articles ](https://www.quantumgalaxies.org
|
|
132
|
+
[ Quantum Galaxies Articles ](https://www.quantumgalaxies.org)
|
|
133
133
|
|
|
134
134
|
[ Quantum Galaxies Corporation ](https://www.quantumgalaxies.com)
|
|
@@ -88,7 +88,7 @@ Get the Euclidean distance from vector v-k and q
|
|
|
88
88
|
|
|
89
89
|
Reduce v with Fibonacci procedure
|
|
90
90
|
|
|
91
|
-
v.Fibonacci(ambiguity_rate=0
|
|
91
|
+
v.Fibonacci(ambiguity_rate=0).dist(v)
|
|
92
92
|
|
|
93
93
|
The ambiguity rate will keep things real under recursive iterations driven by external programs.
|
|
94
94
|
|
|
@@ -105,6 +105,6 @@ The ambiguity rate will keep things real under recursive iterations driven by ex
|
|
|
105
105
|
|
|
106
106
|
[ SoPy Website ](https://sopy.quantumgalaxies.org)
|
|
107
107
|
|
|
108
|
-
[ Quantum Galaxies Articles ](https://www.quantumgalaxies.org
|
|
108
|
+
[ Quantum Galaxies Articles ](https://www.quantumgalaxies.org)
|
|
109
109
|
|
|
110
110
|
[ Quantum Galaxies Corporation ](https://www.quantumgalaxies.com)
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# A generic stub that covers all the required extras for this module
|
|
2
|
+
def _missing_ext_stub(*args, **kwargs):
|
|
3
|
+
raise ImportError(
|
|
4
|
+
"This feature requires additional optional dependencies (pyscf, numpy, pandas). "
|
|
5
|
+
"Please install them using: pip install sopy-quantum[pyscf]"
|
|
6
|
+
# Update the bracket tag above if you named the group something else!
|
|
7
|
+
)
|
|
8
|
+
|
|
9
|
+
try:
|
|
10
|
+
from .ext import get_orbital, get_basis, tabulate, rotation_matrix_from_euler
|
|
11
|
+
|
|
12
|
+
except ImportError as e:
|
|
13
|
+
# Check if the error is caused by ANY of the missing optional packages
|
|
14
|
+
error_msg = str(e).lower()
|
|
15
|
+
known_extras = ['pyscf', 'numpy', 'pandas',]
|
|
16
|
+
|
|
17
|
+
if any(pkg in error_msg for pkg in known_extras):
|
|
18
|
+
get_orbital = _missing_ext_stub
|
|
19
|
+
get_basis = _missing_ext_stub
|
|
20
|
+
tabulate = _missing_ext_stub
|
|
21
|
+
rotation_matrix_from_euler = _missing_ext_stub
|
|
22
|
+
else:
|
|
23
|
+
# If the import failed for a completely different reason (e.g., a typo in .ext), raise it
|
|
24
|
+
raise e
|
|
25
|
+
|
|
26
|
+
__all__ = ['get_orbital', 'get_basis', 'tabulate', 'rotation_matrix_from_euler']
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# A generic stub that covers all the required extras for this module
|
|
2
|
+
def _missing_ext_stub(*args, **kwargs):
|
|
3
|
+
raise ImportError(
|
|
4
|
+
"This feature requires additional optional dependencies (pyscf, numpy, pandas). "
|
|
5
|
+
"Please install them using: pip install sopy-quantum[pyscf]"
|
|
6
|
+
# Update the bracket tag above if you named the group something else!
|
|
7
|
+
)
|
|
8
|
+
|
|
9
|
+
try:
|
|
10
|
+
from .ext import reduce, image
|
|
11
|
+
|
|
12
|
+
except ImportError as e:
|
|
13
|
+
# Check if the error is caused by ANY of the missing optional packages
|
|
14
|
+
error_msg = str(e).lower()
|
|
15
|
+
known_extras = ['tensorly']
|
|
16
|
+
|
|
17
|
+
if any(pkg in error_msg for pkg in known_extras):
|
|
18
|
+
get_orbital = _missing_ext_stub
|
|
19
|
+
get_basis = _missing_ext_stub
|
|
20
|
+
tabulate = _missing_ext_stub
|
|
21
|
+
rotation_matrix_from_euler = _missing_ext_stub
|
|
22
|
+
else:
|
|
23
|
+
# If the import failed for a completely different reason (e.g., a typo in .ext), raise it
|
|
24
|
+
raise e
|
|
25
|
+
|
|
26
|
+
__all__ = ['reduce','image']
|
|
@@ -21,6 +21,8 @@ class Operand():
|
|
|
21
21
|
def copy(self, norm_ = True, threshold = 0.):
|
|
22
22
|
return Operand(self.re.copy(norm_ = norm_, threshold = threshold), self.im.copy(norm_=norm_, threshold = threshold))
|
|
23
23
|
|
|
24
|
+
def __len__(self):
|
|
25
|
+
return (len(self.re)+len(self.im))
|
|
24
26
|
|
|
25
27
|
def complex1(self, ctl1, ext_i, mask = [] , dict_lattices = None):
|
|
26
28
|
"""
|
|
@@ -240,7 +242,7 @@ class Operand():
|
|
|
240
242
|
f = Operand( Vector().flat(lattices) , Vector().flat(lattices))
|
|
241
243
|
return self.cdot(f)
|
|
242
244
|
|
|
243
|
-
def
|
|
245
|
+
def dot(self, other):
|
|
244
246
|
"""complex outer product"""
|
|
245
247
|
return self.cdot(other)
|
|
246
248
|
|
|
@@ -248,3 +250,52 @@ class Operand():
|
|
|
248
250
|
"""complex dot product"""
|
|
249
251
|
return complex( self.re.dot(other.re) + self.im.dot(other.im) , self.im.dot(other.re) - self.re.dot(other.im) )
|
|
250
252
|
|
|
253
|
+
def __imul__(self, c):
|
|
254
|
+
if abs(c) == 0:
|
|
255
|
+
return Operand( Vector(), Vector())
|
|
256
|
+
if abs( tf.math.imag(c)) < 1e-6 :
|
|
257
|
+
re = tf.math.real(c)
|
|
258
|
+
im = None
|
|
259
|
+
elif abs( tf.math.real(c)) < 1e-6 :
|
|
260
|
+
im = tf.math.imag(c)
|
|
261
|
+
re = None
|
|
262
|
+
else:
|
|
263
|
+
re = tf.math.real(c)
|
|
264
|
+
im = tf.math.imag(c)
|
|
265
|
+
|
|
266
|
+
if re is not None:
|
|
267
|
+
self.re *= re
|
|
268
|
+
self.im *= re
|
|
269
|
+
return self
|
|
270
|
+
if im is not None:
|
|
271
|
+
self.re *= im
|
|
272
|
+
self.im *= -im
|
|
273
|
+
return self.swap()
|
|
274
|
+
return Operand( self.re.mul(re) - self.im.mul(im), self.re.mul(im) + self.im.mul(re))
|
|
275
|
+
|
|
276
|
+
|
|
277
|
+
def swap(self):
|
|
278
|
+
self.re, self.im = self.im, self.re
|
|
279
|
+
return self
|
|
280
|
+
|
|
281
|
+
def __iadd__(self, other):
|
|
282
|
+
self.re += other.re
|
|
283
|
+
self.im += other.im
|
|
284
|
+
return self
|
|
285
|
+
|
|
286
|
+
def Fibonacci(self, canon=None, ambiguity_rate = 0.1, level = 0, iterate=10, total_iterate=3, alpha=1e-9, total_alpha=1e-9, tune_rate=0.01, max_allowed_distance=2.0):
|
|
287
|
+
return Operand( self.re.Fibonacci(canon, ambiguity_rate, level, iterate, total_iterate, alpha, total_alpha, tune_rate),
|
|
288
|
+
self.im.Fibonacci(canon, ambiguity_rate, level, iterate, total_iterate, alpha, total_alpha, tune_rate)
|
|
289
|
+
)
|
|
290
|
+
|
|
291
|
+
def mul(self, re):
|
|
292
|
+
self *= re
|
|
293
|
+
return self
|
|
294
|
+
|
|
295
|
+
def n(self):
|
|
296
|
+
return tf.math.real(tf.math.sqrt( self.dot(self) ) )
|
|
297
|
+
|
|
298
|
+
def __sub__(self, spc):
|
|
299
|
+
self.re -= spc.re
|
|
300
|
+
self.im -= spc.im
|
|
301
|
+
return self
|
|
@@ -102,29 +102,36 @@ class Vector :
|
|
|
102
102
|
|
|
103
103
|
def copy(self, norm_:bool =False, threshold:float = 0.):
|
|
104
104
|
new = Vector()
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
105
|
+
if not self.components:
|
|
106
|
+
return new
|
|
107
|
+
if len(self) == 0:
|
|
108
|
+
return new
|
|
109
|
+
components = [self.components[0].copy()]
|
|
110
|
+
for d in self.dims(True):
|
|
111
|
+
components += [self.components[d].copy()]
|
|
112
|
+
new.components = components
|
|
112
113
|
if norm_:
|
|
113
114
|
return new.balance(threshold)
|
|
114
115
|
return new
|
|
115
116
|
|
|
116
117
|
def balance(self, threshold = 0.):
|
|
117
118
|
ranks = Vector()
|
|
118
|
-
for rank in self:
|
|
119
|
+
for i,rank in enumerate(self):
|
|
119
120
|
amp = rank.n()
|
|
120
|
-
if tf.math.
|
|
121
|
-
|
|
121
|
+
if (tf.math.is_nan(amp) or (amp == 0.)).numpy() :
|
|
122
|
+
## sometimes i pass in a single zero term
|
|
123
|
+
content = [Amplitude(a=0)]
|
|
124
|
+
for d in self.dims(True):
|
|
125
|
+
content += [rank.components[d].flat()]
|
|
122
126
|
else:
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
127
|
+
if tf.math.abs(amp) < threshold:
|
|
128
|
+
continue
|
|
129
|
+
else:
|
|
130
|
+
content = [Amplitude(a = amp)]
|
|
131
|
+
for d in self.dims(True):
|
|
132
|
+
content += [rank.components[d].normalize()]
|
|
126
133
|
new = Vector()
|
|
127
|
-
new.components =
|
|
134
|
+
new.components = content
|
|
128
135
|
ranks += new
|
|
129
136
|
return ranks
|
|
130
137
|
|
|
@@ -505,8 +512,8 @@ class Vector :
|
|
|
505
512
|
return self
|
|
506
513
|
if len(self) == 0:
|
|
507
514
|
return Vector()
|
|
508
|
-
kmeans = KMeans(n_clusters=(len(self)
|
|
509
|
-
M = (self+other).dot(
|
|
515
|
+
kmeans = KMeans(n_clusters=min(len(self), len(other)+1), random_state=42, n_init="auto")
|
|
516
|
+
M = (self+other).dot(other, sum_ = False)
|
|
510
517
|
kmeans.fit(M)
|
|
511
518
|
new = Vector()
|
|
512
519
|
for ic, canon in enumerate(self):
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: sopy-quantum
|
|
3
|
-
Version: 2.0.
|
|
3
|
+
Version: 2.0.4
|
|
4
4
|
Summary: Representation and Decomposition with Sums of Product for Operations in separated dimensions. Now using bandlimit place data on lattice.
|
|
5
5
|
Author-email: Jonathan Jerke <jonathan@quantumgalaxies.org>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -112,7 +112,7 @@ Get the Euclidean distance from vector v-k and q
|
|
|
112
112
|
|
|
113
113
|
Reduce v with Fibonacci procedure
|
|
114
114
|
|
|
115
|
-
v.Fibonacci(ambiguity_rate=0
|
|
115
|
+
v.Fibonacci(ambiguity_rate=0).dist(v)
|
|
116
116
|
|
|
117
117
|
The ambiguity rate will keep things real under recursive iterations driven by external programs.
|
|
118
118
|
|
|
@@ -129,6 +129,6 @@ The ambiguity rate will keep things real under recursive iterations driven by ex
|
|
|
129
129
|
|
|
130
130
|
[ SoPy Website ](https://sopy.quantumgalaxies.org)
|
|
131
131
|
|
|
132
|
-
[ Quantum Galaxies Articles ](https://www.quantumgalaxies.org
|
|
132
|
+
[ Quantum Galaxies Articles ](https://www.quantumgalaxies.org)
|
|
133
133
|
|
|
134
134
|
[ Quantum Galaxies Corporation ](https://www.quantumgalaxies.com)
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
try:
|
|
2
|
-
from .ext import get_orbital
|
|
3
|
-
from .ext import get_basis
|
|
4
|
-
from .ext import tabulate
|
|
5
|
-
from .ext import rotation_matrix_from_euler
|
|
6
|
-
|
|
7
|
-
__all__ = ['get_orbital', 'get_basis', 'tabulate', 'rotation_matrix_from_euler']
|
|
8
|
-
|
|
9
|
-
except ImportError as e:
|
|
10
|
-
if 'pyscf' in str(e):
|
|
11
|
-
raise ImportError(
|
|
12
|
-
"Missing optional dependency 'pyscf'. "
|
|
13
|
-
"Please install it using: pip install sopy[pyscf]"
|
|
14
|
-
) from e
|
|
15
|
-
else:
|
|
16
|
-
raise e
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
try:
|
|
2
|
-
from .ext import reduce
|
|
3
|
-
from .ext import image
|
|
4
|
-
__all__ = ['reduce', 'image']
|
|
5
|
-
|
|
6
|
-
except ImportError as e:
|
|
7
|
-
# Check if the error is actually because 'tensorly' is missing
|
|
8
|
-
# (and not some other syntax error in your code)
|
|
9
|
-
if 'tensorly' in str(e) or 'tensorflow' in str(e):
|
|
10
|
-
raise ImportError(
|
|
11
|
-
"Missing optional dependency 'tensorly'. "
|
|
12
|
-
"Please install it using: pip install sopy[tensorly]"
|
|
13
|
-
) from e
|
|
14
|
-
else:
|
|
15
|
-
raise e
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|