Warren Weckesser wrote:
I am going to update linalg.toeplitz to fix the problem reported in ticket #667, but I have some questions about the desired behavior of the function when either `c` (the first column) or `r` (the first row) is complex. The docstring does not say anything about complex values, but the code does some undocumented and unexpected things in this case, one example of which is the bug reported in the ticket #667.
I would like to fix this, but I would first like opinions on exactly how it *should* handle complex arguments. I *think* the idea is that if `c` is complex and `r` is not given, then a Hermitian Toeplitz matrix is created. Is that correct? Note that this requires that c[0] be real, since c[0] is the value that will be in the diagonal of the matrix.
While I am fixing this, I would like to remove the printed warning that occurs when r[0] != c[0]. I would like to change this to raise a ValueError--that is, adopt the philosophy that either the arguments are correct (and the code handles them as [not yet, but soon to be] documented in the docstring, with no warnings needed), or the arguments are wrong and an exception should be raised.
This means that when `r` is not given, an exception would be raised if c[0] is not real.
A very different way to handle the case of `r` not being given is to assume it means a square matrix should be created with r[1:] = 0 (i.e. zeros in all the upper off-diagonals). This avoids the whole issue of complex numbers and conjugates, but it is also a more drastic change.
By the way, that is how linalg.hankel handles the case where `r` is not given. Warren