File size: 632 Bytes
1c703f0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26


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