i have 1D array with shape is 777599. i want to make matrix diagonal of my data 1D array be 2D array matrix diagonal. but i have a problem. this is my code:
import numpy as np
a = np.linspace(0, 2000, 777599)
b = np.diag(a)
print(b.shape)
and the response is:
Traceback (most recent call last):
File "/home/willi/PycharmProjects/006_TA/017_gravkorCG5.py", line 29, in <module>
b = np.diag(a)
File "<__array_function__ internals>", line 6, in diag
File "/home/willi/PycharmProjects/venv/lib/python3.5/site-packages/numpy/lib/twodim_base.py", line 275, in diag
res = zeros((n, n), v.dtype)
MemoryError: Unable to allocate 4.40 TiB for an array with shape (777599, 777599) and data type float64