sopy-quantum 2.0.3__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.3/sopy_quantum.egg-info → sopy_quantum-2.0.4}/PKG-INFO +2 -2
- {sopy_quantum-2.0.3 → sopy_quantum-2.0.4}/README.md +1 -1
- {sopy_quantum-2.0.3 → sopy_quantum-2.0.4}/pyproject.toml +1 -1
- {sopy_quantum-2.0.3 → sopy_quantum-2.0.4}/sopy/vector/operand.py +52 -1
- {sopy_quantum-2.0.3 → sopy_quantum-2.0.4}/sopy/vector/vector.py +22 -15
- {sopy_quantum-2.0.3 → sopy_quantum-2.0.4/sopy_quantum.egg-info}/PKG-INFO +2 -2
- {sopy_quantum-2.0.3 → sopy_quantum-2.0.4}/LICENSE.txt +0 -0
- {sopy_quantum-2.0.3 → sopy_quantum-2.0.4}/setup.cfg +0 -0
- {sopy_quantum-2.0.3 → sopy_quantum-2.0.4}/sopy/__init__.py +0 -0
- {sopy_quantum-2.0.3 → sopy_quantum-2.0.4}/sopy/amplitude/__init__.py +0 -0
- {sopy_quantum-2.0.3 → sopy_quantum-2.0.4}/sopy/amplitude/amplitude.py +0 -0
- {sopy_quantum-2.0.3 → sopy_quantum-2.0.4}/sopy/component/__init__.py +0 -0
- {sopy_quantum-2.0.3 → sopy_quantum-2.0.4}/sopy/component/component.py +0 -0
- {sopy_quantum-2.0.3 → sopy_quantum-2.0.4}/sopy/component/momentum.py +0 -0
- {sopy_quantum-2.0.3 → sopy_quantum-2.0.4}/sopy/pyscf/__init__.py +0 -0
- {sopy_quantum-2.0.3 → sopy_quantum-2.0.4}/sopy/pyscf/ext.py +0 -0
- {sopy_quantum-2.0.3 → sopy_quantum-2.0.4}/sopy/tensorly/__init__.py +0 -0
- {sopy_quantum-2.0.3 → sopy_quantum-2.0.4}/sopy/tensorly/ext.py +0 -0
- {sopy_quantum-2.0.3 → sopy_quantum-2.0.4}/sopy/vector/__init__.py +0 -0
- {sopy_quantum-2.0.3 → sopy_quantum-2.0.4}/sopy_quantum.egg-info/SOURCES.txt +0 -0
- {sopy_quantum-2.0.3 → sopy_quantum-2.0.4}/sopy_quantum.egg-info/dependency_links.txt +0 -0
- {sopy_quantum-2.0.3 → sopy_quantum-2.0.4}/sopy_quantum.egg-info/requires.txt +0 -0
- {sopy_quantum-2.0.3 → sopy_quantum-2.0.4}/sopy_quantum.egg-info/top_level.txt +0 -0
- {sopy_quantum-2.0.3 → sopy_quantum-2.0.4}/tests/test_als.py +0 -0
- {sopy_quantum-2.0.3 → sopy_quantum-2.0.4}/tests/test_overlaps_1.py +0 -0
- {sopy_quantum-2.0.3 → 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
|
|
@@ -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)
|
|
@@ -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)
|
|
@@ -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,27 +102,34 @@ 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
134
|
new.components = content
|
|
128
135
|
ranks += new
|
|
@@ -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
|
|
@@ -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)
|
|
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
|
|
File without changes
|
|
File without changes
|