I would like to use a matrix with complex entries to construct a new matrix, but it gives me the warning
"ComplexWarning: Casting complex values to real discards the imaginary part".
As a result, the new matrix's entries are all real numbers. How to make all the entries keep their imaginary part?
This is the image containing my original code
I know where I make this warning happen.
I need to add dtype = "complex_", when I construct a new empty matrix.
For example,
mat__ = np.zeros((k*nboxes,k*nboxes),dtype = 'complex_')
If we just write
mat__ = np.zeros((k*nboxes,k*nboxes))
and do some manipulations on that like using a complex matrix to forming a new matrix, then the new matrix will discard the imaginary part.