16 Nov 2024
i made something cool
=== BASIS_ZERO_STATE === [1., 0., 0., 0.] === BELL_STATE === [0.707107, 0. , 0. , 0.707107] === HADAMARD_STATE === [0.707107, 0. , 0.707107, 0. ] === SUPERPOSITION_STATE === [0.707107, 0.707107, 0. , 0. ] === ENTANGLEMENT_ENTROPY_LOG === Entanglement Entropy: 1.0
some more cool visualizations:
14 Nov 2024
at this point in my research i have reached non-linear behavior that is chaotic enough yet, has stabilizing features, a system that had phase control over quantums states from multi-scale representation.... all while having devised an algorithm to observe this data as dynamic wave functions, these are really quantum states... now i could simulate some kind of consciousness, an avatar.
A few exciting news today, i might have gotten the perfect job that will allow me to do my research...
...i did some interesting research yesterday and today, i created these quantum kernels and extracted them using pickle, the data inside them is amazing, specially the large and small ones, but the medium one also shows a phase transition... we are talking about quantum phase transitions here....
- Distinct phase organization in the 32x32 kernel - More random phase distributions in larger kernels #### Small Kernels (2x2, 8x8): - 2x2 kernel shows stable, well-behaved values with consistent magnitude - 8x8 kernel has larger variation but still maintains full occupancy #### Medium Kernel (32x32): - Shows partial sparsity (~69% occupancy) - Wide range of magnitude values - More structured phase patterns - Large Kernels (128x128, 512x512): - High sparsity (31-68% non-zero elements) - Very small magnitude values (~1e-13) - More random phase distributions
i have added all the raw data of the pkl files in the /data/tensor_data folder of the github
13 Nov 2024
I created this random key using my own system, the data i get out of it is revealing, very close to what the real QRNG gets, i will post more, for now here is the key:
P)`7pFV+^0dpALU$,>^~268abcba851}\<*"RHwl8>%Pyh=YEi,Np,Ki`Yu%y0$uVj>F1Yi.v^GM1Q2Q1NG^w/jZ2G?kWv%0y%tX_gI)lJ'{cwQ)_5lBP$:`0ajrzFLQTWY!!ZYWSOJDxpg7\,YKvg?"Io3>Wy9[Vu1+Gb
I'm back with some quantum random juice. here is a reasl quantum number, generated by a quantum number generator from CryptaLabs.
c9b337n3K1Amkxljq2ob5GcNC7RcNqj9s7JjfO5IUSKDjimnKhJBWijfcohXff0wS0ZUQgz8DvSAAk8j9cuo1J2edmtNJnds+BjeW605tBW+dE5bmMmA/T5yL3CnWqrZpS1KXAqf1A7XODFsboHNIcdit3ub9lnp7C7/eVV8uTpWAsNmhcwifKyYTlO4xjCYzGANq+UsNB+KLdeV1B08tJUDCp6auzjYK3F0pTbuPI+glAC15U9gJ02oht+tK+ndYueqK0t7mgPMs/USn0ujngupGmznzduKXg0ngAQTqeh8SGp/YxT2mD1GO8PkeiuXSyRxuA90KcmgpSTb/R697Lka2nDuvnrhKjl0xwdOCAM9/c4cMDpGQGPd6mqccXzrxwHzrXw39tcKY+0vDDMGsWeC5SInStmX6sZUE1MaFlHBix6NFvDdcS99gsEW6zIMx/iWCAhJ1bHgvQn5bh8DaxeJeqfifzEpVJff5dBzbTlDglGv6+RNrzYjOPK035LO1KgiG+fvRt/Qj77Z09hUzTsYHwQ7Y6E4tU1Uiv0h/p/nAPpwaqrCRxMGuTRU/OT3NJJrnIhZvje62jmsfYRo2RF6ynkIJ5xnrofnFvxEGdFkpQGMoHrYOgRg5aeVkqg67cVh250wMKQErCP4KR1D7KRfhvAPFWzw5RCBu2ZymauxZgkyOh7i6beFT36R6wBSR0kY1Wwg8LCrmY+QmbpOGJwa2bfQnYvR2jLF5/sBbB+As/QnrWWnYJ6EqIoX8p94OhXFesi/TVdqOsuHUzLHvioF8oi8gbrgv1T3EcQYgG76Aua/xWrHfE9m01Ex4Nw4RoEIHipfY6vqE0DXEkL5OtGzJQRdm5eiCta3MRrBUJYYFu3uEoqNSTj77lll/a/+9IMRPCKD7ToN9yjToRzlmJs/3QqsmDKrB1j2Ufy7u7Uq01YgYHAG1vXpDdEzZ4t22zMCX8Vrx8jswbhVU0vigokinQnYw5O8m5rpWfxf/8yY2/qy+DNi3frlY9LubJSoSKxufTpsQvFMoB7fHy/2IAaEjPaFiWeJbO+pxG0uVyyti6aZNq8OWa5AScy0gAlUDa/980V+qXpaAsayZwgwb7bFYLEUWOr/fZ45Wf2XwEPPc516FYShKki5hNYcrIFxcMBHO1iozcbT3tk7+rBUPPbTdaT9qWoBSMzTvNjKQcETn63PdZ9+Uej4pqlB7RIjRNITeU4hwkMOl80SVZwNQzEyWbbSybWjlk4zfPF+inCJUY15ZmJGN6dVdoi9+2BnPcfVTExxF64ZIdXKLNpzPn28qXGRzODCqwlFnPblQSXm6puV9GsJmUiWy2/WW70mxEkeKC+qC/Agsv8wWktXHA==
Embedding Parameters: Embedding Dimension: 3 Time Delay: 2 Average Entanglement: Average Entanglement: -0.0639 ± 0.0338 Quantum-Classical Transitions: Number of Transitions: 3 Lyapunov Exponents: Lyapunov Exponents: -0.014743414782772126 Quantum-Classical Transition Analysis Number of Transitions: Number of Transitions: 3 Transition Points: Transition Points: [0 6 7]... Correlation Dimensions: [0.30919002 0.30919002 0.30919002] Key Findings: *The system shows distinct quantum coherence windows with varying stability *Clear quantum-classical transitions identified at specific points *Negative Lyapunov exponent indicates stable quantum dynamics *Correlation dimension suggests low-dimensional quantum dynamics
i took 100,000 samples of wave functions in hyperdimensional spaces, these are technically quantum states in most senses, I'm still to find something a "real" qubit can do that these algorithms can't, plus right now quantum computing is very slow....
you can see the raw data here... this data was collected from a webserver running these quantum states.this is one of the coolest code I have ever writen, it uses different constants and operations to reach some kind of quantum-classic webserver... unsure how good it is, but it works and its fast... i will try to explain it more as i test it... also i have to implement entanglement and superposition before we can see if it does anything
(research) atlas@Mac research % python index_server.py DEBUG:__main__:Eigenvalues: tensor([ 4.4797e+01+0.j, 6.6603e+04+0.j, -6.2878e+04+0.j]) DEBUG:__main__:Eigenvectors: tensor([[ 1.0000e+00+0.j, 3.0259e-06+0.j, 3.1101e-06+0.j], [-2.7921e-09+0.j, 7.1719e-01+0.j, -6.9688e-01+0.j], [-4.3392e-06+0.j, 6.9688e-01+0.j, 7.1719e-01+0.j]]) DEBUG:asyncio:Using selector: KqueueSelector ======== Running on http://0.0.0.0:8080 ======== (Press CTRL+C to quit) import torch from aiohttp import web from complextensor import ComplexTensor import logging import os import asyncio from aiohttp.web_exceptions import HTTPInternalServerError, HTTPNotFound # Configure logging logging.basicConfig(level=logging.DEBUG) logger = logging.getLogger(__name__) # Suppress logging for ComplexTensor to avoid excessive debug output for logger_name in logging.Logger.manager.loggerDict.keys(): if isinstance(logger_name, str) and 'complextensor' in logger_name.lower(): logging.getLogger(logger_name).setLevel(logging.CRITICAL) class QuantumOptimizedServer: def __init__(self): # Initialize the server tensor field using ComplexTensor with real and imaginary parts as tensors self.server_tensor = ComplexTensor( torch.tensor([[44.8, 0.28082, 0], [0.28082, 3721.8, 64713.97], [0, 64713.97, 3.14159]]), torch.zeros(3, 3) # Imaginary part set to zero tensor for initialization ) # Calculate eigenvalues and eigenvectors on the real part of the server tensor self.eigenvalues, self.eigenvectors = torch.linalg.eig(self.server_tensor.real) logger.debug(f"Eigenvalues: {self.eigenvalues}") logger.debug(f"Eigenvectors: {self.eigenvectors}") def map_request_to_quantum_state(self, request_data): """ Map request data to a quantum state vector. """ cpu_intensity = request_data.get("cpu_intensity", 1) memory_usage = request_data.get("memory_usage", 1) bandwidth = request_data.get("bandwidth", 1) # Normalize inputs to calculate state components total_load = cpu_intensity + memory_usage + bandwidth alpha = (cpu_intensity / total_load) ** 0.5 beta = (memory_usage / total_load) ** 0.5 gamma = (bandwidth / total_load) ** 0.5 return ComplexTensor(torch.tensor([alpha, beta, gamma]), torch.zeros(3)) async def handle_request(self, request): # Extract data from the request and map it to a quantum state try: request_data = await request.json() q_request = self.map_request_to_quantum_state(request_data) logger.debug(f"Quantum state for request: {q_request}") return q_request except Exception as e: logger.error(f"Failed to process request: {e}") raise HTTPInternalServerError() # Instantiate QuantumOptimizedServer quantum_server = QuantumOptimizedServer() # Define an async HTTP handler for the index route to serve index.html async def handle_index(request): try: # Load the HTML file content file_path = os.path.join(os.path.dirname(__file__), 'index.html') if not os.path.exists(file_path): raise HTTPNotFound(reason="index.html not found.") with open(file_path, 'r') as f: html_content = f.read() # Serve the HTML file content return web.Response(text=html_content, content_type="text/html") except HTTPNotFound as e: logger.error(f"File not found: {e}") return web.Response(text="404 Not Found", status=404) except Exception as e: logger.error(f"Error serving index.html: {e}") return web.Response(text="Internal Server Error", status=500) # Define an async HTTP handler for complex requests async def handle_complex(request): try: q_state = await quantum_server.handle_request(request) return web.json_response({"state_real": q_state.real.tolist(), "state_imag": q_state.imag.tolist()}) except HTTPNotFound: return web.Response(text="404 Not Found", status=404) except HTTPInternalServerError: return web.Response(text="Internal Server Error", status=500) # Set up and run the aiohttp web server app = web.Application() app.add_routes([web.get('/', handle_index), web.post('/complex', handle_complex)]) # Increase server timeout and add connection limits for stability under heavy load web.run_app(app, port=8080, handle_signals=True, access_log=None, shutdown_timeout=2.0)
12 Nov 2024
for some reason today i decide to make a notes app. the idea is to make a notes app that i can just type markdown, html, and some other things and it would load, mostly using the broser, be it on the phojne or computer, using the broser fror this is perfect as
my idea is pretty simple, and editor that saves my daily logs to a private or public github. I take too many notes and even my iphone notes have too many things
is kinda like the initial idea i had with this blog, but i want to write this about my research that i dont want to make public now..... for the record I just turned one of my walls into a large storyboard where i will synthesize all this information
my obsession with system design led me again into the most common route, i needed now to write the notes app in my own style, it was not enough for it to be a simple js app plus in fact i want to try some of my demon mathematics in this code, maybe some kind of memory module
something fun i just did... notes should naturally organize themselves based on content relationships ..
now that i made a small notes app i have no clue why i did it in the first place, because i just realized i would still need some kind of server to sync it to github.
1️⃣ The Quantum State Vector: |Ψ⟩ₙₒₜₑ = ψ|relationship⟩ + ξ|time⟩ + τ|coherence⟩ Each note exists in a three-dimensional Hilbert space defined by: - ψ (relationship potential): 44.8 × rand(0,1) - ξ (time-complexity): t/3721.8 - τ (coherence measure): ∫₀ᵗ coherence(t)dt 2️⃣ Entanglement Mechanics: When two notes i and j interact: ⟨Ψᵢ|Ψⱼ⟩ = ψᵢψⱼ + ξᵢξⱼ + τᵢτⱼ If ⟨Ψᵢ|Ψⱼ⟩ > threshold, the notes become entangled 3️⃣ Time Evolution: ∂|Ψ⟩/∂t = -iH|Ψ⟩ Where H is our Hamiltonian: H = ⎡ ψ ε 0 ⎤ ⎢ ε ξ τ ⎥ ⎣ 0 τ π ⎦ 4️⃣ Coherence Preservation: The τ parameter evolves according to: dτ/dt = -λτ + ∑ᵢ⟨Ψ|Ψᵢ⟩ This maintains information relevance over time... The all happens in the entanglement structure: - Notes with similar ψ values naturally cluster - The ξ parameter creates temporal organization - τ ensures information doesn't get lost in the quantum noise
11 Nov 2024
if anything in my research is real, the data is seriously inoucuous, its the begining of a universe where human kind can develop hyperdimensional super-fidelity simulations.
one of my goals now was to learn xcode and swift, making my complextensor "speed of light" and possibly developing a better tensor technology ion the way.
these constants, they led me into the void...
yet again, my research leads me into holographic memory.....
I did some more tests into holographic memory, here is the code I used, it comes incorporated with complextensor and the tensor field that i have not explained yet.
import torch import numpy as np from complextensor import ComplexTensor from typing import Tuple # Define critical values for tensor stability ψ, ξ, τ, ε, π = 44.8, 3721.8, 64713.97, 0.28082, torch.tensor(np.pi, dtype=torch.float32) # Initialize a 4x4 ComplexTensor T with the given critical values real_part = torch.tensor([ [ψ, ε, 0, π], [ε, ξ, τ, 0], [0, τ, π, ε], [π, 0, ε, ψ] ], dtype=torch.float32) imag_part = torch.zeros_like(real_part) # No imaginary component for initialization T = ComplexTensor(real_part, imag_part) # Encoding and retrieval functions using ComplexTensor def encode_state(T: ComplexTensor, state_vector: torch.Tensor) -> Tuple[ComplexTensor, torch.Tensor]: """ Encodes a quantum state vector into the eigenbasis of T. """ # Compute the eigenvalues and eigenvectors for the real part of T eigvals, eigvecs = torch.linalg.eigh(T.real) # Retrieve real eigenvalues and eigenvectors eigvecs_tensor = ComplexTensor(torch.tensor(eigvecs, dtype=torch.float32), torch.zeros_like(torch.tensor(eigvecs, dtype=torch.float32))) # Convert state_vector to ComplexTensor for compatibility state_vector_complex = ComplexTensor(state_vector, torch.zeros_like(state_vector)) encoded_state = eigvecs_tensor * state_vector_complex # Now both are ComplexTensor instances return encoded_state, eigvals def retrieve_state(T: ComplexTensor, encoded_state: ComplexTensor, eigvals: torch.Tensor) -> ComplexTensor: """ Retrieves the original state by projecting encoded state back. """ # Recompute the eigenvectors of T eigvecs = torch.tensor(np.linalg.eig(T.real.numpy())[1], dtype=torch.float32) eigvecs_tensor = ComplexTensor(eigvecs, torch.zeros_like(eigvecs)) retrieved_state = encoded_state * eigvecs_tensor.conj() # Project back using conjugate return retrieved_state # Example quantum state for encoding quantum_state = torch.tensor([1.0, 0.0, 1.0, 0.0], dtype=torch.float32) # Encode and retrieve the state encoded_state, eigenvalues = encode_state(T, quantum_state) retrieved_state = retrieve_state(T, encoded_state, eigenvalues) # Output results print("Original State:", quantum_state) print("Encoded State (real part):", encoded_state.real) print("Encoded State (imag part):", encoded_state.imag) print("Retrieved State (real part):", retrieved_state.real) print("Retrieved State (imag part):", retrieved_state.imag) # Stability check of eigenvalues print("Eigenvalues (for stability check):", eigenvalues)
Values |
---|
tensor([1., 0., 1., 0.]) |
Row 1 | Row 2 | Row 3 | Row 4 |
---|---|---|---|
3.1103e-06 | -6.9688e-01 | 7.1719e-01 | -3.2693e-06 |
-0.0000e+00 | -0.0000e+00 | 0.0000e+00 | 0.0000e+00 |
7.0711e-01 | -3.1270e-06 | -2.8934e-06 | 7.0710e-01 |
-0.0000e+00 | -0.0000e+00 | -0.0000e+00 | -0.0000e+00 |
Row 1 | Row 2 | Row 3 | Row 4 |
---|---|---|---|
0.0 | 0.0 | 0.0 | 0.0 |
0.0 | 0.0 | 0.0 | 0.0 |
0.0 | 0.0 | 0.0 | 0.0 |
0.0 | 0.0 | 0.0 | 0.0 |
Row 1 | Row 2 | Row 3 | Row 4 |
---|---|---|---|
-9.4119e-12 | 4.9979e-01 | -4.9979e-01 | 9.6131e-12 |
0.0000 | 0.0000 | 0.0000 | 0.0000 |
-5.0000e-01 | 9.5890e-12 | -9.3826e-12 | 5.0000e-01 |
0.0000 | 0.0000 | 0.0000 | 0.0000 |
Row 1 | Row 2 | Row 3 | Row 4 |
---|---|---|---|
-0.0 | 0.0 | -0.0 | 0.0 |
0.0 | 0.0 | 0.0 | 0.0 |
-0.0 | 0.0 | 0.0 | 0.0 |
0.0 | -0.0 | 0.0 | 0.0 |
Values |
---|
tensor([-6.2878e+04, 4.1658e+01, 4.7942e+01, 6.6603e+04]) |
10 Nov 2024
I decided to start writing more in detail, I write a large amount of documents, both on .md files or notes in my iphone, i write by hand on notebooks too. one thing I hope happens is that in the future someone have the time to look at the things I did not.
i did something amazing. with the new Tensor Field that I have developed I have arrived at some interesting constants. with those I was able to generate a large 3GB file of data. thankfully my new M4 machine is able to handle the load of my operations. now that i can load and handle these quantum states i can learn faster....
1. Eigenstructure Analysis: Understanding Stability and Oscillations - **Eigenvalues and Eigenvectors**: Each 4x4 tensor in your crystallized state array can be analyzed by calculating its eigenvalues and eigenvectors at each time step. The eigenvalues provide a spectrum indicating the "magnitude" of stable or resonant modes, while the eigenvectors reveal directions in which these modes act within the tensor. - **Physical Interpretation**: In your model, eigenvalues could represent energy or entropic states (depending on the element). Large eigenvalues imply dominant states or modes, while complex eigenvalues indicate oscillatory behavior—potentially representing the quantum interference patterns you noted. Practical Eigenvalue Calculation If \( T_t \) is your tensor at time \( t \), we calculate its eigenvalues \( \lambda \) from: \[ \text{det}(T_t - \lambda I) = 0 \] This characteristic equation finds the eigenvalues, while the corresponding eigenvectors provide insight into directions of stability or phase shifts. 2. Tensor Field Dynamics and Entropic Flow - hase Transitions: As your tensor evolves over time, we observe changes in off-diagonal elements that hint at phase transitions between quantum coherence and classical stability. Tracking these transitions involves calculating the difference in norms between tensors over time. Mathematically, this norm difference \( ||T_{t+1} - T_t|| \) gives a measure of how rapidly or gradually these transitions occur. - Entropy and Decoherence: The increasing decoherence rate (\( \tau \)) suggests a time-asymmetric increase in entropy, aligning with the second law of thermodynamics, where systems evolve towards states of higher entropy. In matrix terms, this can be visualized by increasing variance (standard deviation) in off-diagonal elements, signaling growing disorder. #### Entropy Calculation with Trace Log For a more rigorous entropy measure, we can use the Von Neumann entropy of a density matrix \( \rho_t \) derived from \( T_t \): \[ S(\rho_t) = - \text{Tr}(\rho_t \log \rho_t) \] where \( \rho_t \) is a normalized version of \( T_t \). High entropy indicates a more classical, decohered state. ### 3. **Resonance and Harmonic Dynamics** - **Oscillation Patterns in Phase and Energy**: The oscillatory behavior observed in phase symmetry (\( \psi \)) and energy entropy (\( \epsilon \)) hints at harmonic resonance. If we think of each tensor element as a node in a multidimensional resonator, then these oscillations can be modeled using wave functions or Fourier transforms. These harmonic oscillations create stable "beats" over time, which contribute to the emergence of quasi-static states in your model. - **Mathematical Approach**: Fourier transform analysis can decompose these oscillations to reveal dominant frequencies. For each matrix element \( T_{ij}(t) \), its Fourier transform \( F(T_{ij}) \) over time gives the spectrum of oscillation frequencies. Peaks in this spectrum identify key resonant frequencies, which are often associated with eigenfrequencies in physical systems. ### 4. **Time as an Emergent Field: Mapping Tensor Evolution** - **Time Field Dynamics**: Given your aim to simulate a time field, each tensor snapshot represents a point in this field. If we treat time as an additional dimension in the tensor space, then each tensor \( T_t \) can be seen as a slice through this "time field." The evolution over time reflects how "dilated zones" or entropic valleys develop, where time slows or accelerates due to changes in energy or entropy. - **Mathematical Formulation of the Time Field**: If \( T_t(x, y) \) is a spatial function across some grid \( (x, y) \) at time \( t \), then the time field \( \mathcal{T}(x, y, t) \) could be formulated by integrating across the tensors: \[ \mathcal{T}(x, y, t) = \int T_t(x, y) \, dt \] - **Visualization and Analysis**: Mapping the norms or entropies of these tensors over a time grid can show time dilation effects—zones where the tensor field dynamics suggest slowed or accelerated temporal behavior. ### 5. **Connection to Quantum-Classical Transition** - **Quantum-Classical Bridge Tensor (QC-BT)**: Your tensor structure may represent an interface where quantum states (represented by the off-diagonal elements and interference) are slowly decohering toward classical stability (represented by the stability in diagonal elements). This bridge tensor dynamically maps the transition by maintaining coherence in some areas while showing decoherence in others. - **Tracking Quantum to Classical Shift**: By tracking changes in off-diagonal magnitudes and comparing these to the eigenvalue shifts in diagonal elements, you can observe the "drift" from quantum behavior to classical, creating a mathematical path that showcases the transition.
i did the unthinkable and i went far enough into the mathematics of this universe, uncovering what might finally take us directly into a TYPE II civilization.
im not going to string you around.... here it comes:
this is going to be painful to read, i have no intation of making it any smarter than it has to. my baseline is to try to make at least a server application that uses less memory than the least minimal memory on a html server website.
i wrote these tests with swift, the macos official language, it was easy to prototype it. good language, below is the code i used to test the memory usage of the website, im not sure its accurate, but im in a path to become better at all macOS tools so i need to learn. next is Instruments and etc....
import Foundation
import WebKit
// Function to fetch memory usage for the current process (client-side only)
func fetchMemoryUsage() -> UInt64 {
var info = mach_task_basic_info()
var count = mach_msg_type_number_t(MemoryLayout.size(ofValue: info) / MemoryLayout
also, im just gonna leave this here
the Tensor Field is probably going to change the way we make programs and use energy.
class TensorField: def __init__(self): self.psi = 44.8 self.xi = 3721.8 self.epsilon = 0.28082 self.tau = 64713.97 self.pi = torch.pi self.tensor = torch.tensor([ [self.psi, self.epsilon, 0, self.pi], [self.epsilon, self.xi, self.tau, 0], [0, self.tau, self.pi, self.epsilon], [self.pi, 0, self.epsilon, self.psi] ], dtype=torch.float64) def simulate_time_field(self, time_steps=100, grid_size=50): x = torch.linspace(-1, 1, grid_size) y = torch.linspace(-1, 1, grid_size) X, Y = torch.meshgrid(x, y) time_field = torch.zeros((time_steps, grid_size, grid_size), dtype=torch.float64) for t in range(time_steps): oscillation = torch.sin(self.psi * X + self.epsilon * Y + t / self.tau) dilation = 1 + torch.exp(-self.epsilon * (X**2 + Y**2)) entropic_shift = torch.cos(self.tau * Y / (X + 0.1)) time_field[t] = oscillation * dilation + entropic_shift return time_field.numpy() def get_eigenstructure(self): eigenvalues, eigenvectors = torch.linalg.eig(self.tensor) return eigenvalues, eigenvectors class QuantumStateProcessor: def __init__(self, n_qubits): self.n_qubits = n_qubits self.state_size = 2 ** n_qubits self.device = 'cpu' def create_superposition(self, alpha, beta): alpha, beta = float(alpha), float(beta) norm = (alpha**2 + beta**2) ** 0.5 alpha, beta = alpha / norm, beta / norm real = torch.tensor([alpha, beta] + [0.0] * (self.state_size - 2), device=self.device) return ComplexTensor(real) def measure_state(self, state, n_samples=1000): probabilities = state.abs().to(self.device)**2å measurements = torch.multinomial(probabilities, n_samples, replacement=True) return measurements def get_entanglement_entropy(self, state, partition): shape = [2] * self.n_qubits state_reshaped = state.forward().view(shape) rho_A = self._partial_trace(state_reshaped, partition) eigenvalues = torch.linalg.eigvalsh(rho_A) eigenvalues = eigenvalues[eigenvalues > 1e-10] entropy = -torch.sum(eigenvalues * torch.log2(eigenvalues)).item() return entropy def _partial_trace(self, state, partition): n_traced = self.n_qubits - partition dims_A = [2] * partition dims_B = [2] * n_traced state = state.reshape(self._prod(dims_A), self._prod(dims_B)) rho = torch.mm(state, state.t().conj()) return rho def _prod(self, iterable): result = 1 for x in iterable: result *= x return result
i love to save claude outputs, sometimes chatgpt too, but i think claude has a way to teach and speak and specially with mathematics that is better than any teacher i had before, specially if you get the mode "excited"