Menu

toeplitz matlab compatibility

2008-09-12
2012-09-15
  • Niklas Johansson

    Dear IT++ developers,

    The output from the matlab function toeplitz(column_vector, row_vector)

    toeplitz([1+i, 2+2*i], [3+3i, 4+4i])

    is

    1.0000 + 1.0000i 4.0000 + 4.0000i
    2.0000 + 2.0000i 1.0000 + 1.0000i

    that is, the toeplitz matrix is constructed directly from the column and row vectors.

    The IT++ version itpp::toeplitz pre-processes the column vector in a special way: it takes the conjugate of all but the first element of the column vector before constructing the toeplitz matrix, which gives the result:

    [[1+1i 4+4i]
    [2-2i 1+1i]]

    produced by the following test code:

    cvec column_vector("1+1i 2+2i");
    cvec row_vector("3+3i 4+4i");
    cmat toeplitz_matrix = toeplitz(column_vector, row_vector);
    cout << toeplitz_matrix << endl;

    Is this difference between the matlab and IT++ versions intentional? If so, it might be a good idea to stress this in the function documentation, and maybe even add this to the "Conversion table between IT++ syntax and Matlab/Octave" in the tutorials.

    Best regards,
    Niklas Johansson

     
    • Adam Piątyszek

      Adam Piątyszek - 2008-09-12

      Hi Niklas,

      This seem to be a bug. When I was implementing this piece of code I was trying to clone the functionality of GNU Octave, which is an open-soruce Matlab alternative. So, it seems that the implementation is wrong.
      Please open a new bug report for this issue. I will try to fix it as soon as possible.

      Thanks!
      /Adam

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.