matlab-to-eigen.html 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. <html>
  2. <head>
  3. <title>MATLAB to Eigen</title>
  4. <style type="text/css">
  5. table
  6. {
  7. border-spacing: 0px;
  8. }
  9. tr.header th
  10. {
  11. border-bottom: 1px solid;
  12. background-color: #ffb;
  13. padding-left: 10px;
  14. padding-right: 20px;
  15. }
  16. tr.d0 td
  17. {
  18. background-color: #EEE;
  19. color: black;
  20. padding-left: 10px;
  21. padding-right: 20px;
  22. min-width: 200px;
  23. }
  24. tr.d1 td
  25. {
  26. background-color: #bcf;
  27. color: black;
  28. padding-left: 10px;
  29. padding-right: 20px;
  30. min-width: 200px;
  31. }
  32. </style>
  33. </head>
  34. <body>
  35. <table>
  36. <tr class="header">
  37. <th>MATLAB</th>
  38. <th>Eigen</th>
  39. <th>Notes</th>
  40. </tr>
  41. <tr class=d0>
  42. <td><pre><code>[Y,IX] = sort(Y,dim,mode)</code></pre></td>
  43. <td><pre><code>igl::sort(X,dim,mode,Y,IX)</code></pre></td>
  44. <td>MATLAB version allows Y to be a multidimensional matrix, but the
  45. Eigen version is only for 1D or 2D matrices.</td>
  46. </tr>
  47. <tr class=d1>
  48. <td><pre><code>B(i:(i+w),j:(j+h)) = A(x:(x+w),y:(y+h))</code></pre></td>
  49. <td><pre><code>B.block(i,j,w,h) = A.block(i,j,w,h)</code></pre></td>
  50. <td>MATLAB version would allow w and h to be non-positive since the
  51. colon operator evaluates to a list of indices, but the Eigen version
  52. needs non-negative width and height values.</td>
  53. </tr>
  54. <tr class=d0>
  55. <td><pre><code>max(A(:))</code></pre></td>
  56. <td><pre><code>A.maxCoeff()</code></pre></td>
  57. <td>Find the maximum coefficient over all entries of the matrix.</td>
  58. </tr>
  59. <tr class=d1>
  60. <td><pre><code>min(A(:))</code></pre></td>
  61. <td><pre><code>A.minCoeff()</code></pre></td>
  62. <td>Find the minimum coefficient over all entries of the matrix.</td>
  63. </tr>
  64. <!-- Insert rows for each command pair -->
  65. <!-- Leave this here for copy and pasting
  66. <tr class=d0>
  67. <td><pre><code>Matlab code</code></pre></td>
  68. <td><pre><code>Eigen code</code></pre></td>
  69. <td>Notes</td>
  70. </tr>
  71. -->
  72. </table>
  73. </body>
  74. </html>