Spaces:
Runtime error
Runtime error
import torch as tr | |
import numpy as np | |
def init_v0(dim): | |
v=np.zeroes(dim, dtype=tr.complex128) | |
return v | |
def init_vrand(dim): | |
mean_real = 0 # Mean of the real part | |
std_dev_real = 1 # Standard deviation of the real part | |
mean_imag = 0 # Mean of the imaginary part | |
std_dev_imag = 1 # Standard deviation of the imaginary part | |
# Generate real and imaginary parts | |
real_part = np.random.normal(mean_real, std_dev_real, dim) | |
imaginary_part = np.random.normal(mean_imag, std_dev_imag, dim) | |
# Create complex numbers | |
v = real_part + 1j * imaginary_part | |
v=tr.from_numpy(v) | |
return v | |