Hello Kasper!



 ksteensig:

But because D consists of complex eigenvalues, and in PyTorch a complex value is a vector of two values, I am unable to calculate the original matrix again using matrix multiplication.


Pytorch does not currently support complex tensor operations (to
the best of my knowledge).
First, what is your actual use case?  There may be some other way
to accomplish your goal.
Second, for work on complex tensors in pytorch, please see this
post:

  
    
    
    Pytorch with complex tensors 
  
  
    Is there a solution for dealing with complex tensors yet? Is there a similar function to numpy.angle in PyTorch? 
thanks!
  


and the linked github issue:

  
      github.com/pytorch/pytorch
  
  
    
  
	  
  

  
    
      Integrating complex tensors 8
    

    
      
        opened 
        
          
        
        Feb 15, 2017
      
      


      
        
          
          PhilippPelz
        
      
    
  



  New description from @ezyang:
Work is in progress at https://github.com/Roger-luo/pytorch-complex
Organizational principles
Complex tensor support is important to PyTorch, and we will accept patches...



    feature
    module: complex
    triaged


  
  
    
    
  
  


Last, for a number of operations, including matrix multiplication, it is
easy enough to build your own complex tensor operations out of
real tensor operations.
You can write cm = rm + I * im, where cm is your complex matrix,
rm and im are real matrices, and I is the notional sqrt (-1) (the
“imaginary unit”).  You can then expand out the product of two complex
matrices in terms of these real matrices, and collect terms to get the
real and imaginary parts of your product matrix.  (In your example of
reconstructing the real matrix that you diagonalized you should find
that the imaginary part of your final result is zero to within floating-point
precision.)
Good luck!
K. Frank