MATLAB Eigen Notes
[Y,IX] = sort(Y,dim,mode)
igl::sort(X,dim,mode,Y,IX)
MATLAB version allows Y to be a multidimensional matrix, but the Eigen version is only for 1D or 2D matrices.
B(i:(i+w),j:(j+h)) = A(x:(x+w),y:(y+h))
B.block(i,j,w,h) = A.block(i,j,w,h)
MATLAB version would allow w and h to be non-positive since the colon operator evaluates to a list of indices, but the Eigen version needs non-negative width and height values.
max(A(:))
A.maxCoeff()
Find the maximum coefficient over all entries of the matrix.
min(A(:))
A.minCoeff()
Find the minimum coefficient over all entries of the matrix.
eye(w,h)
MatrixXd::Identity(w,h), MatrixXf::Identity(w,h), etc.
A(i:(i+w),j:(j+h)) = eye(w,h)
A.setIdentity()
[I,J,V] = find(X)
igl::find(X,I,J,V)
Matlab supports finding subscripts (I and J) as well as indices (just I), but so far igl::find only supports subscripts. Also, igl::find requires X to be sparse.
X(:,j) = X(:,j) + x
X.col(j).array() += x
Adim_sum = sum(A,dim)
igl::sum(A,dim,Adim_sum)
Currently the igl version only supports sparse matrix input (and dim must be 1 or 2)
D = diag(M)
igl::diag(M,D)
Extract the main diagonal of a matrix. Currently igl version supports sparse only.
M = diag(D)
igl::diag(D,M)
Construct new square matrix M with entries of vector D along the diagonal. Currently igl version supports sparse only.