mirror of
https://github.com/kuhyx/WUT_Computer_Science.git
synced 2026-07-04 14:43:08 +02:00
10 lines
366 B
Python
10 lines
366 B
Python
import numpy as np
|
|
|
|
class MatrixGenerator:
|
|
@staticmethod
|
|
def generate_random_matrix_and_vector(size):
|
|
A = np.random.uniform(-1, 1, (size, size))
|
|
A = np.dot(A.T, A) + np.eye(size) * size # dodanie `size` do przekątnej zwiększa wartości własne -> obejście problemu z overflow
|
|
b = np.random.uniform(-1, 1, size)
|
|
return A, b
|