ttpy icon indicating copy to clipboard operation
ttpy copied to clipboard

Manipulation of complex TT vectors

Open rborrelli opened this issue 8 years ago • 0 comments

I have found a problem when using TT complex vectors. When adding complex vectors with a zero imaginary component the code automatically change the result to real. This is due to the use of the numpy.iscomplex() function that return false if the imaginary component of a number is zero, (1+1j*0.0 is not complex). While this seems a desired feature I found that it can be a trouble when reading and writing vector from a file, because it might happen that you think you are writing a complex vector but it is written as a real, so when you try to read it you have problems because you don't know what you are reading. Wouldn't it be simpler to stick to complex numbers even if the imaginary part is zero? After all if the user is using complex numbers probably he knows that his data are complex. This can be easily done by checking the data type instead of using iscomplex().

rborrelli avatar Jan 19 '17 08:01 rborrelli