Registered Member
|
I want to create a sign matrix from a dense matrix. A sign matrix S of a matrix A is one with coefficients +1 or -1, depending on whether the corresponding coeffs in A is positive or negative, i.e.
S(i,j) = 1 if A(i,j)>0 else S(i,j) = -1 I thought I could do this to generate one: Eigen::MatrixXd A(n, m); // initialize entries Eigen::MatrixXi S(n, m); S = (A.cwiseQuotient(A.cwiseAbs())).cast<Eigen::MatrixXi>(); but it refuses to compile with YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY. which in itself is quite a helpful error. Do I need to do anything differently or does something need implementing somewhere? Thanks
Last edited by rkannan on Wed Jan 04, 2012 4:45 pm, edited 1 time in total.
|
Moderator
|
|
Registered Member
|
Registered users: Bing [Bot], Google [Bot], Yahoo [Bot]