-
Notifications
You must be signed in to change notification settings - Fork 2
/
timer.py
26 lines (22 loc) · 895 Bytes
/
timer.py
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
"""
Timer Process
Author : Khin Thandar Kyaw
Date : 12 Jan 2023
"""
import time
################################################################################
def perform_calculations(Covariance, channel_covariance_all):
U = Covariance.eigen_decomposition_channel_covariance(channel_covariance_all)
U_star = Covariance.extract_U_star(U)
U_tilde, size_U_tilde_col = Covariance.construct_U_tilde(U_star)
E_0 = Covariance.SVD_U_tilde(U_tilde, size_U_tilde_col)
V_max = Covariance.project_channel_covariance_onto_E_0(E_0, channel_covariance_all)
W = Covariance.calculate_beamforming_vector(E_0, V_max)
return U_tilde, W
################################################################################
class Timer:
def __enter__(self):
self.start_time = time.time()
return self
def __exit__(self, *args):
self.elapsed_time = time.time() - self.start_time