mirror of
https://github.com/kuhyx/WUT_Computer_Science.git
synced 2026-07-04 13:03:05 +02:00
feat: calculate eigenvalues using numpy library
This commit is contained in:
parent
90fb64506a
commit
2619f041d7
@ -5,6 +5,7 @@ from processing_type import ProcessingType
|
||||
from time_measurement import time_measurement, time_accumulator, tests_time
|
||||
import time
|
||||
import gc
|
||||
import numpy as np
|
||||
|
||||
class RichardsonMethod:
|
||||
@time_measurement(time_accumulator)
|
||||
@ -23,7 +24,10 @@ class RichardsonMethod:
|
||||
|
||||
@staticmethod
|
||||
def calculate_eigenvalues(LinAlgType, A, type):
|
||||
return EigenvalueMethods.inverse_power_method(LinAlgType, A, type), EigenvalueMethods.power_method(LinAlgType, A, type)
|
||||
eigenvalues = np.linalg.eigvals(A)
|
||||
lambda_min = np.min(eigenvalues)
|
||||
lambda_max = np.max(eigenvalues)
|
||||
return lambda_min, lambda_max
|
||||
|
||||
@staticmethod
|
||||
def calculate_omega(lambda_min, lambda_max):
|
||||
|
||||
Loading…
Reference in New Issue
Block a user