title: eigen: Subtracting a scalar from a vector
body: <p>I am having an error when using the Eigen library and all I am trying to do is subtract a scalar from an Eigen::VectorXf. So, my code is something as follows:</p>
  
  <pre><code>#define VECTOR_TYPE Eigen::VectorXf
  #define MATRIX_TYPE Eigen::MatrixXf
  
  // myMat is of MATRIX_TYPE
  JacobiSVD&lt;MATRIX_TYPE&gt; jacobi_svd(myMat,ComputeThinU | ComputeThinV); 
  
  const float offset = 3.0f;
  VECTOR_TYPE singular_values = jacobi_svd.singularValues();
  
  VECTOR_TYPE test = singular_values - offset;
  </code></pre>
  
  <p>The last line results in a compilation error as:</p>
  
  <blockquote>
    <p>error: invalid operands to binary expression ('Eigen::VectorXf' (aka
          'Matrix') and 'float')
            VECTOR_TYPE test = singular_values - scale;</p>
    
    <p>Eigen/src/Core/../plugins/CommonCwiseBinaryOps.h:19:28: note: 
          candidate template ignored: could not match
          'MatrixBase' against 'float'
        EIGEN_MAKE_CWISE_BINARY_OP(operator-,internal::scalar_difference_op)</p>
  </blockquote>